1    /*
     2     *  Copyright 2019 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 CCS 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     *
    46     *  @a(Example)
    47     *  @p(code)
    48     *      xs xdc.tools.product.plugingen 
    49     *                      -p exampleprod_1_0_0_00
    50     *                      -m xdc.tools.product.plugingen.examples.ExampleProduct
    51     *  @p
    52     */
    53    metaonly module Main inherits xdc.tools.ICmd
    54    {
    55        override config String usage[] = [
    56            '[-p product_root_directory]',
    57            ' -m module',
    58            '[-o outdir]',
    59            '[-f pluginFragment]'
    60        ];
    61    
    62    instance:
    63    
    64        /*!
    65         *  ======== productDir ========
    66         *  Product root directory
    67         *
    68         *  This option names the product root directory that is used by the
    69         *  tool to generate the plugin.  For example, its declared repositories
    70         *  are added to the package path and are searched for contributed
    71         *  platforms.
    72         *
    73         *  If the '-o' option is not specified, the tool generates the plugin
    74         *  in a sub-directory named `eclipse` in the product root directory.
    75         *
    76         *  If this option is not specified, the product root directory is
    77         *  assumed to be `./`.
    78         *
    79         */
    80        @CommandOption("p")
    81        config String productDir = "./";
    82    
    83        /*!
    84         *  ======== productModule ========
    85         *  Input description of the plug-in to be specified
    86         *
    87         *  This required option names a module that implements
    88         *  `{@link xdc.tools.product.IProduct}`.
    89         */
    90        @CommandOption("m")
    91        config String productModule;
    92    
    93        /*!
    94         *  ======== outputDir ========
    95         *  Output directory in which the plugin will be generated.
    96         *
    97         *  This option names the directory in which the plugin
    98         *  will be generated in a sub-directory named `eclipse`.
    99         *  If this option is not specified the tool will generate
   100         *  the plugin in the product root directory specified with
   101         *  the '-p' option.
   102         */
   103        @CommandOption("o")
   104        config String outputDir = null;
   105    
   106        /*!
   107         *  ======== pluginFragment ========
   108         *  Text file containing plugin fragment
   109         *
   110         *  This option names the text file containing a plugin fragment.
   111         *  This allows users to contribute extensions to the UI plugins
   112         *  generated by the tool.
   113         *
   114         *  The tool does not perform syntax checking of the contributed
   115         *  fragment. Users need to ensure the correctness of the
   116         *  contributed fragment. Note that syntactically incorrect
   117         *  fragments can disable the plugin completely in the eclipse
   118         *  platform.
   119         */
   120        @CommandOption("f")
   121        config String pluginFragment = null;
   122    
   123        /*!
   124         *  ======== generationFormat ========
   125         *  Plugin generation format
   126         */
   127        @CommandOption("generation_format")
   128        config String generationFormat = null;
   129    
   130        /*!
   131         *  ======== suppress_product_type_info ========
   132         *  This Option is now removed from PluginGen.
   133         *  We shall throw an error to flag this change to users.
   134         *
   135         *  Suppress generation of product type information
   136         *
   137         *  This option generates eclipse plugin without the product
   138         *  type information. Should only be invoked to generate plugins
   139         *  whose product type information was hard coded into CCS 4.x prior
   140         *  to the creation of this tool.
   141         *
   142         *  This option should not be used by _any_ new products.
   143         */
   144        @CommandOption("suppress_product_type_info")
   145        config Bool suppressProductTypeInfo = false;
   146    
   147        /*!
   148         *  ======== dynamic_toc ========
   149         *  @_nodoc
   150         *
   151         *  This switch allows us to enable the new (to 3.30) dynamic TOC provider
   152         *  which can read TOC files that are _not_ in any of the signed plugins.
   153         *  Which means we can completely encapsulate the docs in a product's
   154         *  directories and there is no possibility of using a TOC that doesn't
   155         *  match the docs provided.
   156         *
   157         *  This option should only be used for products that will only be used
   158         *  with versions of XDCtools 3.30 or later (unless we backport this
   159         *  provider to 3.26, for example).
   160         *
   161         *  Someday we may ignore this switch as default to using dynamic_toc.
   162         *  But for now (3.30), dynamic_toc is only used by xdctools itself.
   163         */
   164        @CommandOption("dynamic_toc")
   165        config Bool dynamicToc = false;
   166    
   167        /*!
   168         *  ======== run ========
   169         */
   170        override Any run(xdc.tools.Cmdr.Instance cmdr, String args[]);
   171    }
   172    /*
   173     *  @(#) xdc.tools.product.plugingen; 1, 0, 0,3; 2-18-2019 11:04:03; /db/ztree/library/trees/xdctools/xdctools-h03/src/
   174     */
   175