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