1    /*
     2     *  Copyright 2014 by Texas Instruments Incorporated.
     3     *
     4     */
     5    
     6    /*!
     7     *  ======== Main ========
     8     *  Command-line tool for generating eclipse plugins for RTSC content
     9     *
    10     *  The `plugingen` tool allows RTSC content producers to
    11     *  create eclipse plugins that allows their content to be 
    12     *  integrated in the CCS4 environment. As input, the tool requires 
    13     *  @p(blist)
    14     *      - a RTSC module implementing {@link xdc.tools.product.IProduct}
    15     *  @p
    16     *  Refer to {@link ./doc-files/ExampleProduct.xdc ExampleProduct}
    17     *  for an implementation of {@link xdc.tools.product.IProduct IProduct}.
    18     *
    19     *  The tool may also be used to generate starter examples that will showup 
    20     *  in the new project wizard. This is accomplished by implementing
    21     *  {@link xdc.tools.product.IProductTemplate IProductTemplate} and setting
    22     *  the {@link xdc.tools.product.IProduct#templateModule templateModule} 
    23     *  configuration parameter of the {@link xdc.tools.product.IProduct IProduct} 
    24     *  implementation to the name of the implementation module. 
    25     *  Refer to {@link ./doc-files/Examples.xdc Examples}
    26     *  for a sample implementation of {@link
    27     *  xdc.tools.product.IProductTemplate IProductTemplate}.
    28     *  
    29     *  The XGCONF product view maybe developed by implementing
    30     *  {@link xdc.tools.product.IProductView IProductView} and setting
    31     *  the {@link xdc.tools.product.IProduct#productViewModule productViewModule} 
    32     *  configuration parameter of the {@link xdc.tools.product.IProduct IProduct} 
    33     *  implementation to the name of the implementation module.
    34     *  Refer to {@link ./doc-files/ProductView.xdc ProductView.xdc} and 
    35     *  {@link ./doc-files/ProductView.xs ProductView.xs}
    36     *  for a sample implementation of {@link
    37     *  xdc.tools.product.IProductView IProductView}.
    38     *
    39     *  The tool operates on a product that is either specified by the `-p`
    40     *  option or is present in the folder from which the tool is executed.
    41     *  The tool will create the plugin in a sub-folder named `eclipse`
    42     *  in the output directory specified with `-o` option. If the `-o`
    43     *  option is not specified the plugin is created in the product root
    44     *  directory. 
    45     *  The tool will search the repositories specified in the module
    46     *  implementing {@link xdc.tools.product.IProduct} for RTSC platforms.
    47     *  This search can be disabled by specifying the`--disable_repo_search` 
    48     *  option. The user needs to ensure that the repositories are installed 
    49     *  in the product root directory before using the tool.
    50     *
    51     *  @a(Example)
    52     *  @p(code)
    53     *      xs xdc.tools.product.plugingen 
    54     *                      -p exampleprod_1_0_0_00
    55     *                      -m xdc.tools.product.plugingen.examples.ExampleProduct
    56     *  @p
    57     */
    58    metaonly module Main inherits xdc.tools.ICmd
    59    {
    60        override config String usage[] = [
    61            '[-p product_root_directory]',
    62            ' -m module',
    63            '[-o outdir]',
    64            '[-f pluginFragment]',
    65            '[--disable_repo_search]'
    66        ];
    67    
    68    instance:
    69    
    70        /*!
    71         *  ======== productDir ========
    72         *  Product root directory
    73         *
    74         *  This option names the product root directory that is used by the 
    75         *  tool to generate the plugin.  For example, its declared repositories
    76         *  are added to the package path and are searched for contributed
    77         *  platforms.
    78         *
    79         *  If the '-o' option is not specified, the tool generates the plugin
    80         *  in a sub-directory named `eclipse` in the product root directory.
    81         *
    82         *  If this option is not specified, the product root directory is
    83         *  assumed to be `./`.
    84         *
    85         */
    86        @CommandOption("p")
    87        config String productDir = "./";
    88    
    89        /*!
    90         *  ======== productModule ========
    91         *  Input description of the plug-in to be specified
    92         *
    93         *  This required option names a module that implements
    94         *  `{@link xdc.tools.product.IProduct}`.
    95         */
    96        @CommandOption("m")
    97        config String productModule;
    98    
    99        /*!
   100         *  ======== outputDir ========
   101         *  Output directory in which the plugin will be generated.
   102         *
   103         *  This option names the directory in which the plugin 
   104         *  will be generated in a sub-directory named `eclipse`.
   105         *  If this option is not specified the tool will generate
   106         *  the plugin in the product root directory specified with
   107         *  the '-p' option.
   108         */
   109        @CommandOption("o")
   110        config String outputDir = null;
   111    
   112        /*!
   113         *  ======== pluginFragment ========
   114         *  Text file containing plugin fragment
   115         *
   116         *  This option names the text file containing a plugin fragment.
   117         *  This allows users to contribute extensions to the UI plugins
   118         *  generated by the tool.
   119         *
   120         *  The tool does not perform syntax checking of the contributed
   121         *  fragment. Users need to ensure the correctness of the 
   122         *  contributed fragment. Note that syntactically incorrect 
   123         *  fragments can disable the plugin completely in the eclipse 
   124         *  platform.
   125         */
   126        @CommandOption("f")
   127        config String pluginFragment = null;
   128    
   129        /*!
   130         *  ======== generationFormat ========
   131         *  Plugin generation format
   132         */
   133        @CommandOption("generation_format")
   134        config String generationFormat = null;
   135    
   136        /*!
   137         *  ======== suppress_product_type_info ========
   138         *  This Option is now removed from PluginGen.
   139         *  We shall throw an error to flag this change to users.
   140         *
   141         *  Suppress generation of product type information 
   142         *
   143         *  This option generates eclipse plugin without the product
   144         *  type information. Should only be invoked to generate plugins 
   145         *  whose product type information was hard coded into CCS 4.x prior
   146         *  to the creation of this tool.
   147         *
   148         *  This option should not be used by _any_ new products.
   149         */
   150        @CommandOption("suppress_product_type_info")
   151        config Bool suppressProductTypeInfo = false;
   152    
   153        /*!
   154         *  ======== disable_repo_search ========
   155         *  Suppress search of product repositories
   156         *
   157         *  If this option is specified the tool does not
   158         *  search the product repositories for RTSC platforms.
   159         */
   160        @CommandOption("disable_repo_search")
   161        config Bool suppressSearch = false;
   162            
   163        /*!
   164         *  ======== dynamic_toc ========
   165         *  @_nodoc
   166         *
   167         *  This switch allows us to enable the new (to 3.30) dynamic TOC provider
   168         *  which can read TOC files that are _not_ in any of the signed plugins.
   169         *  Which means we can completely encapsulate the docs in a product's
   170         *  directories and there is no possibility of using a TOC that doesn't
   171         *  match the docs provided.
   172         *
   173         *  This option should only be used for products that will only be used
   174         *  with versions of XDCtools 3.30 or later (unless we backport this
   175         *  provider to 3.26, for example).
   176         *
   177         *  Someday we may ignore this switch as default to using dynamic_toc.
   178         *  But for now (3.30), dynamic_toc is only used by xdctools itself.
   179         */
   180        @CommandOption("dynamic_toc")
   181        config Bool dynamicToc = false;
   182    
   183        /*!
   184         *  ======== run ========
   185         */
   186        override Any run(xdc.tools.Cmdr.Instance cmdr, String args[]);
   187    }
   188    /*
   189     *  @(#) xdc.tools.product.plugingen; 1, 0, 0,106; 3-7-2014 16:17:49; /db/ztree/library/trees/xdctools/xdctools-f47x/src/
   190     */
   191