1    /* 
     2     *Copyright (c) 2008 Texas Instruments and others.
     3     *  All rights reserved. This program and the accompanying materials
     4     *  are made available under the terms of the Eclipse Public License v1.0
     5     *  which accompanies this distribution, and is available at
     6     *  http://www.eclipse.org/legal/epl-v10.html
     7     *
     8     *  Contributors:
     9     *      Texas Instruments - initial implementation
    10     *
    11     * */
    12    
    13    package xdc.tools.closure;
    14    
    15    /*!
    16     *  ======== xdc.tools.closure.Main ========
    17     *  Utility that creates a closed bundle
    18     *
    19     *  The purpose of this tool is to build a bundle containing all packages
    20     *  loaded in the process of configuring an application. The bundle is
    21     *  built in a user-selected repository, which can be then relocated to
    22     *  a different location or to a different host, where the application
    23     *  being configured can be recompiled and relinked.
    24     *
    25     *  The closure tool can run only after {@link xdc.tools.configuro} runs
    26     *  and finishes the configuration step. Then, `xdc.tools.closure' detects
    27     *  all packages involved in the configuration and copies them to a new
    28     *  repository. All absolute paths in the relevant generated files that
    29     *  could be accessed by the user's makefile, when the application is
    30     *  rebuilt, are transformed into the paths relative to the the directory
    31     *  containing the closed bundle.
    32     *
    33     *  Some files in the copied packages are deleted to keep the size of
    34     *  the closed bundle manageable. The default filtering setting causes only
    35     *  selected files to be deleted, for example C sources or object files that
    36     *  are copied into a library. A user has an option of requesting other
    37     *  evels of filtering from not filtering anything to the most aggressive
    38     *  filtering of files, which leaves in the closed bundle only header files
    39     *  and libraries referenced by linker command files. Here are the filtering
    40     *  levels:
    41     *  @p(blist)
    42     *  - 0   - all files are preserved
    43     *  - 1   - C sources, object files, Java sources and class files,
    44     *          PDF files and internal RTSC files are deleted
    45     *  - 2   - left for future expansion, currently same as 1
    46     *  - 3   - libraries not referenced by the linker command file
    47     *          are also deleted
    48     *  - 4   - same as 3
    49     *  - 5   - only rov.xs file used by the ROV tools is left
    50     *  - 6   - all nonessential file are removed
    51     *  - 7+  - same as 6
    52     *  @p
    53     *
    54     *  @a(Examples)
    55     *  @p(code)
    56     *      xs xdc.tools.configuro -t gnu.targets.arm.GCArmv6 -o configPkg
    57     *      xs xdc.tools.closure -d D:/bundle C:/examples/memory/configPkg
    58     *  @p
    59     *
    60     *  After `xdc.tools.configuro` creates a configuration in `configPkg`,
    61     *  `xdc.tools.closure` gathers all packages loaded during the 
    62     *  configuration into a repository located in `D:/bundle`.
    63     */
    64    metaonly module Main inherits xdc.tools.ICmd {
    65    
    66        override config String usage[] = [
    67            '[-v] [--filter=N] [-i pkg1 [-i pkg2 ...]] [-d dst_dir] package_base_dir'
    68        ];
    69    
    70    instance:
    71    
    72        //!Print informative messages during execution
    73        @CommandOption('v')
    74        config Bool verboseFlag = false;
    75    
    76        /*!
    77         * ======== aggFilter ========
    78         * Alias for --filter=5
    79         *
    80         * This flag was used for requesting aggressive filtering. It was superceded
    81         * by 'filter'.
    82         */
    83        @CommandOption('f')
    84        config Bool aggFilter = false;
    85    
    86        /*!
    87         * ======== filter ========
    88         * Set the level of deleting nonessential files
    89         *
    90         * Library and header files are the only files that must be present for the
    91         * bundle generated by this tool to be used when building an application.
    92         * Other files are optional, and might be used by other tools if present.
    93         * The levels of filtering that can be specified by this parameter are:
    94         * 0   - all files are preserved
    95         * 1   - C sources, object files, Java sources and class files, PDF files and
    96         *       internal RTSC files are deleted
    97         * 2   - left for future expansion, currently same as 1
    98         * 3   - libraries not referenced by the linker command file are also
    99         *       deleted
   100         * 4   - same as 3
   101         * 5   - only rov.xs file used by the ROV tools is left
   102         * 6   - all nonessential file are removed
   103         * 7+  - same as 6
   104         */
   105        @CommandOption('filter')
   106        config UInt filter = 3;
   107    
   108        //!Name of the destination directory
   109        @CommandOption('d')
   110        config String destination = "";
   111    
   112        //!Additional packages to be included in the bundle
   113        @CommandOption('i')
   114        config String includes[] = [];
   115    }
   116    
   117    
   118    /*
   119     *  @(#) xdc.tools.closure; 1, 0, 0,194; 12-8-2015 17:33:12; /db/ztree/library/trees/xdctools/xdctools-g03x/src/
   120     */
   121