1 2 3 4 5 6 7 8 9 10 11
12 13 14
15 package xdc.bld;
16
17 /*!
18 * ======== Script ========
19 * Model of a script
20 */
21 metaonly module Script {
22 /*!
23 * ======== Attrs ========
24 * Optional attributes for a script instance.
25 *
26 * @field(releases) This array contains releases that will contain the
27 * script. Thus, a single script can be part of any set of
28 * releases. Each script is always added to the package's
29 * "default release" in addition to any releases specified in
30 * the releases array.
31 *
32 * @field(hasMain) This script defines a `main()` function. This
33 * function is called after the capsule is loaded. If the
34 * script does not define `main()`, it must contain statements
35 * that will run script as part of loading the script.
36 *
37 * @field(exportSrc) Scripts are added to the default release
38 * unless this flag is set to `false`.
39 *
40 * @see #attrs
41 */
42 struct Attrs {
43 Bool hasMain; /*! if true, this script defines main() */
44 Bool exportSrc; /*! if false, don't add to default release */
45 Release.Instance releases[]; /*! releases this script is a part of */
46 };
47
48 instance:
49 /*!
50 * ======== create ========
51 * @_nodoc
52 * Instances should only be created via PackageContents.addScript()
53 */
54 create();
55
56 config String name;
57
58 /*!
59 * ======== attrs ========
60 * Optional attributes for this test instance.
61 *
62 */
63 config Script.Attrs attrs;
64
65 /*!
66 * ======== addTest ========
67 * Add specified test to script
68 *
69 * A test encapsulates a script and a set of arguments passed to
70 * the script when it is run.
71 *
72 * Tests are run by naming the goal "<test_name>.test" on the xdc
73 * command line; <test_name> is the test's name.
74 *
75 * Multiple tests may have the same name; in this case, it is possible
76 * to run all tests using the single goal "<test_name>.test"
77 *
78 * @param(testAttrs) optional test attrs object
79 * (`{@link xdc.bld.Test#Attrs}`)
80 *
81 * @a(returns) Returns the `{@link xdc.bld.Test}` instance object
82 * created.
83 *
84 * @a(throws) `Error` exceptions are thrown for fatal errors.
85 *
86 * @see xdc.bld.Test
87 * @see xdc.bld.Test#Attrs
88 */
89 Test.Instance addTest(Test.Attrs testAttrs = {});
90 }
91 92 93
94