metaonly module xdc.tools.closure.Main

Creates a directory containing all packages/files referenced by a configuration

The purpose of this tool is to build a single directory containing all packages loaded in the process of configuring an application. The bundle is built in a user-selected repository, which can be then relocated to a different location or to a different host, where the application being configured can be recompiled and relinked. [ more ... ]
Configuration settings sourced in xdc/tools/closure/Main.xdc
var Main = xdc.useModule('xdc.tools.closure.Main');
module-wide config parameters
        '[-v] [--filter=N] [-i pkg1 [-i pkg2 ...]] [-d dst_dir] package_base_dir'
    ];
module-wide functions
    Main.exec// xs script entry point(Any args) returns Any
    Main.main// xs shell entry point(Any args) returns Any
per-instance config parameters
    var params = new Main.Params// Instance config-params object;
        params.aggFilter// Alias for --filter=5 = Bool false;
        params.destination// Name of the destination directory = String "";
        params.includes// Additional packages to be included in the bundle = String[] [ ];
        params.verboseFlag// Print informative messages during execution = Bool false;
per-instance functions
    inst.run// Underlying implementation of the command(Cmdr.Instance cmdr, String[] args) returns Any
 
DETAILS
The purpose of this tool is to build a single directory containing all packages loaded in the process of configuring an application. The bundle is built in a user-selected repository, which can be then relocated to a different location or to a different host, where the application being configured can be recompiled and relinked.
The closure tool can run only after xdc.tools.configuro runs and finishes the configuration step. Then, `xdc.tools.closure' detects all packages involved in the configuration and copies them to a new repository. All absolute paths in the relevant generated files that could be accessed by the user's makefile, when the application is rebuilt, are transformed into the paths relative to the the directory containing the closed bundle.
Some files in the copied packages are deleted to keep the size of the closed bundle manageable. The default filtering setting causes only selected files to be deleted, for example C sources or object files that are copied into a library. A user has an option of requesting other evels of filtering from not filtering anything to the most aggressive filtering of files, which leaves in the closed bundle only header files and libraries referenced by linker command files. Here are the filtering levels:
  • 0 - all files are preserved
  • 1 - C/C++ sources, object files, Java sources and class files, PDF files and internal RTSC files are deleted
  • 2 - left for future expansion, currently same as 1
  • 3 - libraries not referenced by the linker command file are also deleted
  • 4 - same as 3
  • 5 - only rov.xs file used by the ROV tools is left
  • 6 - all nonessential file are removed
  • 7+ - same as 6
EXAMPLES
      xs xdc.tools.configuro -t gnu.targets.arm.GCArmv6 -o configPkg
      xs xdc.tools.closure -d D:/bundle C:/examples/memory/configPkg
After xdc.tools.configuro creates a configuration in configPkg, xdc.tools.closure gathers all packages loaded during the configuration into a repository located in D:/bundle.
 
config Main.usage  // module-wide

Usage for this command

Configuration settings
Main.usage = String[] [
    '[-v] [--filter=N] [-i pkg1 [-i pkg2 ...]] [-d dst_dir] package_base_dir'
];
 
 
Main.exec()  // module-wide

xs script entry point

Configuration settings
Main.exec(Any args) returns Any
 
DETAILS
This function is called from within other XDCscript scripts and performs the same operations as main() except that, rather than output the return value of inst.run(), this value is simply returned to the caller of exec().
 
Main.main()  // module-wide

xs shell entry point

Configuration settings
Main.main(Any args) returns Any
 
DETAILS
This function
  • creates a no-arg instance, inst, of the module inheriting this interface;
  • parses command line arguments placing all options in the config params of the inheriting module;
  • creates a xdc.tools.Cmdr instance, cmdr;
  • calls inst.run() with the cmdr and any command line command line arguments not parsed as options; and
  • outputs the return result from inst.run()
Instance Config Parameters

Configuration settings
var params = new Main.Params;
// Instance config-params object
    params.aggFilter = Bool false;
    // Alias for --filter=5
    params.destination = String "";
    // Name of the destination directory
    params.filter = UInt 3;
    // Set the level of deleting nonessential files
    params.includes = String[] [ ];
    // Additional packages to be included in the bundle
    params.verboseFlag = Bool false;
    // Print informative messages during execution
 
config Main.Params.aggFilter  // instance

Alias for --filter=5

Configuration settings
var params = new Main.Params;
  ...
params.aggFilter = Bool false;
 
DETAILS
This flag was used for requesting aggressive filtering. It was superceded by 'filter'.
 
config Main.Params.destination  // instance

Name of the destination directory

Configuration settings
var params = new Main.Params;
  ...
params.destination = String "";
 
 
config Main.Params.filter  // instance

Set the level of deleting nonessential files

Configuration settings
var params = new Main.Params;
  ...
params.filter = UInt 3;
 
DETAILS
Library and header files are the only files that must be present for the bundle generated by this tool to be used when building an application. Other files are optional, and might be used by other tools if present. The levels of filtering that can be specified by this parameter are: 0 - all files are preserved 1 - C sources, object files, Java sources and class files, PDF files and internal RTSC files are deleted 2 - left for future expansion, currently same as 1 3 - libraries not referenced by the linker command file are also deleted 4 - same as 3 5 - only rov.xs file used by the ROV tools is left 6 - all nonessential file are removed 7+ - same as 6
 
config Main.Params.includes  // instance

Additional packages to be included in the bundle

Configuration settings
var params = new Main.Params;
  ...
params.includes = String[] [ ];
 
 
config Main.Params.verboseFlag  // instance

Print informative messages during execution

Configuration settings
var params = new Main.Params;
  ...
params.verboseFlag = Bool false;
 
 
Main.run()  // instance

Underlying implementation of the command

Configuration settings
inst.run(Cmdr.Instance cmdr, String[] args) returns Any
 
DETAILS
Since this method is used to support both command line tools and other XDCscript scripts, it is important to avoid explicit termination of the JVM via java.lang.System.exit(); doing so precludes callers from handling failures.
Implementations should instead call
generated on Fri, 22 Feb 2019 01:33:19 GMT