blob: 84e62344d484627ba468196d6fdf10663ab9c80e [file] [log] [blame]
Stuart McCullochf3173222012-06-07 21:57:32 +00001package aQute.bnd.help;
2
3import java.util.*;
4import java.util.regex.*;
5
Stuart McCulloch42151ee2012-07-16 13:43:38 +00006import aQute.bnd.osgi.*;
Stuart McCullochf3173222012-06-07 21:57:32 +00007
8public class Syntax implements Constants {
Stuart McCulloch4482c702012-06-15 13:27:53 +00009 final String header;
10 final String lead;
11 final String example;
12 final Pattern pattern;
13 final String values;
14 final Syntax[] children;
Stuart McCullochf3173222012-06-07 21:57:32 +000015
Stuart McCulloch4482c702012-06-15 13:27:53 +000016 static Syntax version = new Syntax(
17 VERSION_ATTRIBUTE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000018 "A version range to select the version of an export definition. The default value is 0.0.0.",
19 VERSION_ATTRIBUTE + "=\"[1.2,3.0)\"", null,
Stuart McCulloch4482c702012-06-15 13:27:53 +000020 Verifier.VERSIONRANGE);
21 static Syntax bundle_symbolic_name = new Syntax(
22 BUNDLE_SYMBOLIC_NAME_ATTRIBUTE,
23 "The bundle symbolic name of the exporting bundle.",
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000024 BUNDLE_SYMBOLIC_NAME_ATTRIBUTE + "=com.acme.foo.daffy",
Stuart McCulloch4482c702012-06-15 13:27:53 +000025 null, Verifier.SYMBOLICNAME);
Stuart McCullochf3173222012-06-07 21:57:32 +000026
Stuart McCulloch4482c702012-06-15 13:27:53 +000027 static Syntax bundle_version = new Syntax(
28 BUNDLE_VERSION_ATTRIBUTE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000029 "A version range to select the bundle version of the exporting bundle. The default value is 0.0.0.",
30 BUNDLE_VERSION_ATTRIBUTE + "=1.3", null,
Stuart McCulloch4482c702012-06-15 13:27:53 +000031 Verifier.VERSIONRANGE);
Stuart McCullochf3173222012-06-07 21:57:32 +000032
Stuart McCulloch4482c702012-06-15 13:27:53 +000033 static Syntax path_version = new Syntax(
34 VERSION_ATTRIBUTE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000035 "Specifies the range in the repository, project or file.",
36 VERSION_ATTRIBUTE + "=project", "project,type", Pattern
Stuart McCulloch4482c702012-06-15 13:27:53 +000037 .compile("project|type|"
38 + Verifier.VERSIONRANGE
39 .toString()));
Stuart McCullochf3173222012-06-07 21:57:32 +000040
Stuart McCulloch4482c702012-06-15 13:27:53 +000041 static Syntax[] syntaxes = new Syntax[] {
42 new Syntax(
43 BUNDLE_ACTIVATIONPOLICY,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000044 "The " + BUNDLE_ACTIVATIONPOLICY + " header specifies how the framework should activate the bundle once started.",
45 BUNDLE_ACTIVATIONPOLICY + ": lazy", "lazy", Pattern.compile("lazy")),
Stuart McCullochf3173222012-06-07 21:57:32 +000046
Stuart McCulloch4482c702012-06-15 13:27:53 +000047 new Syntax(BUNDLE_ACTIVATOR,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000048 "The " + BUNDLE_ACTIVATOR + " header specifies the name of the class used to start and stop the bundle.",
49 BUNDLE_ACTIVATOR + ": com.acme.foo.Activator",
Stuart McCulloch4482c702012-06-15 13:27:53 +000050 "${classes;implementing;org.osgi.framework.BundleActivator}", Verifier.FQNPATTERN),
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000051 new Syntax(BUNDLE_CATEGORY, "The " + BUNDLE_CATEGORY + " header holds a comma-separated list of category names.",
52 BUNDLE_CATEGORY + ": test", "osgi,test,game,util,eclipse,netbeans,jdk,specification", null),
Stuart McCulloch4482c702012-06-15 13:27:53 +000053 new Syntax(
54 BUNDLE_CLASSPATH,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000055 "The " + BUNDLE_CLASSPATH + " header defines a comma-separated list of JAR file path names or directories (inside the bundle) containing classes and resources. The period (’.’) specifies the root directory of the bundle’s JAR. The period is also the default.",
56 BUNDLE_CLASSPATH + ": /lib/libnewgen.so, .", null, Verifier.PATHPATTERN),
Stuart McCulloch4482c702012-06-15 13:27:53 +000057 new Syntax(BUNDLE_CONTACTADDRESS,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000058 "The " + BUNDLE_CONTACTADDRESS + " header provides the contact address of the vendor.",
59 BUNDLE_CONTACTADDRESS + ": 2400 Oswego Road, Austin, TX 74563", null, null),
Stuart McCulloch4482c702012-06-15 13:27:53 +000060 new Syntax(BUNDLE_COPYRIGHT,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000061 "The " + BUNDLE_COPYRIGHT + " header contains the copyright specification for this bundle.",
62 BUNDLE_COPYRIGHT + ": OSGi (c) 2002", null, null),
63 new Syntax(BUNDLE_DESCRIPTION, "The " + BUNDLE_DESCRIPTION + " header defines a short description of this bundle.",
64 BUNDLE_DESCRIPTION + ": Ceci ce n'est pas une bundle", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +000065
Stuart McCulloch4482c702012-06-15 13:27:53 +000066 new Syntax(BUNDLE_DOCURL,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000067 "The " + BUNDLE_DOCURL + " header must contain a URL pointing to documentation about this bundle.",
68 BUNDLE_DOCURL + ": http://www.aQute.biz/Code/Bnd", null, Verifier.URLPATTERN),
Stuart McCullochf3173222012-06-07 21:57:32 +000069
Stuart McCulloch4482c702012-06-15 13:27:53 +000070 new Syntax(
71 BUNDLE_ICON,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000072 "The optional " + BUNDLE_ICON + " header provides a list of (relative) URLs to icons representing this bundle in different sizes.",
73 BUNDLE_ICON + ": /icons/bnd.png;size=64", "/icons/bundle.png", Verifier.URLPATTERN, new Syntax("size",
74 "Icons size in pixels, e.g. 64.", "size=64", "16,32,48,64,128", Verifier.NUMBERPATTERN)),
Stuart McCullochf3173222012-06-07 21:57:32 +000075
Stuart McCulloch4482c702012-06-15 13:27:53 +000076 new Syntax(
77 BUNDLE_LICENSE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000078 "The " + BUNDLE_LICENSE + " header provides an optional machine readable form of license information. The purpose of this header is to automate some of the license processing required by many organizations.",
79 BUNDLE_LICENSE + ": http://www.opensource.org/licenses/jabberpl.php",
Stuart McCulloch4482c702012-06-15 13:27:53 +000080 "http://www.apache.org/licenses/LICENSE-2.0,<<EXTERNAL>>", Pattern.compile("("
81 + Verifier.URLPATTERN + "|<<EXTERNAL>>)"), new Syntax(DESCRIPTION_ATTRIBUTE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000082 "Human readable description of the license.", DESCRIPTION_ATTRIBUTE + "=\"Describe the license here\"",
Stuart McCulloch4482c702012-06-15 13:27:53 +000083 null, Verifier.ANYPATTERN), new Syntax(LINK_ATTRIBUTE, "", "", null, Verifier.URLPATTERN)),
84 new Syntax(
85 BUNDLE_LOCALIZATION,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000086 "The " + BUNDLE_LOCALIZATION + " header contains the location in the bundle where localization files can be found. The default value is OSGI-INF/l10n/bundle. Translations are by default therefore OSGI-INF/l10n/bundle_de.properties, OSGI-INF/l10n/bundle_nl.properties, etc.",
87 BUNDLE_LOCALIZATION + ": OSGI-INF/l10n/bundle", "OSGI-INF/l10n/bundle", Verifier.URLPATTERN),
Stuart McCulloch4482c702012-06-15 13:27:53 +000088 new Syntax(
89 BUNDLE_MANIFESTVERSION,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000090 "The " + BUNDLE_MANIFESTVERSION + " header is set by bnd automatically to 2. The header defines that the bundle follows the rules of this specification.",
91 "# " + BUNDLE_MANIFESTVERSION + ": 2", "2", Verifier.NUMBERPATTERN),
Stuart McCulloch4482c702012-06-15 13:27:53 +000092 new Syntax(
93 BUNDLE_NAME,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000094 "The " + BUNDLE_NAME + " header will be derived from the " + BUNDLE_SYMBOLICNAME + " header if not set. The " + BUNDLE_NAME + " header defines a readable name for this bundle. This should be a short, human-readable name that can contain spaces.",
95 BUNDLE_NAME + ": My Bundle", null, Verifier.ANYPATTERN),
Stuart McCulloch4482c702012-06-15 13:27:53 +000096 new Syntax(
97 BUNDLE_NATIVECODE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +000098 "The " + BUNDLE_NATIVECODE + " header contains a specification of native code libraries contained in this bundle.",
99 BUNDLE_NATIVECODE + ": /lib/http.DLL; osname = QNX; osversion = 3.1",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000100 null,
101 Verifier.PATHPATTERN,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000102 new Syntax(OSNAME_ATTRIBUTE, "The name of the operating system.", OSNAME_ATTRIBUTE + "=MacOS", Processor.join(
Stuart McCulloch4482c702012-06-15 13:27:53 +0000103 Verifier.OSNAMES, ","), Verifier.ANYPATTERN),
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000104 new Syntax(OSVERSION_ATTRIBUTE, "Operating System Version.", OSVERSION_ATTRIBUTE + "=3.1", null,
Stuart McCulloch4482c702012-06-15 13:27:53 +0000105 Verifier.ANYPATTERN),
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000106 new Syntax(LANGUAGE_ATTRIBUTE, "Language ISO 639 code.", LANGUAGE_ATTRIBUTE + "=nl", null, Verifier.ISO639),
107 new Syntax(PROCESSOR_ATTRIBUTE, "Processor name.", PROCESSOR_ATTRIBUTE + "=x86", Processor.join(
Stuart McCulloch4482c702012-06-15 13:27:53 +0000108 Verifier.PROCESSORNAMES, ","), Verifier.ANYPATTERN),
109 new Syntax(
110 SELECTION_FILTER_ATTRIBUTE,
111 "The value of this attribute must be a filter expression that indicates if the native code clause should be selected or not.",
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000112 SELECTION_FILTER_ATTRIBUTE + "=\"(com.acme.windowing=win32)\"", null, Verifier.FILTERPATTERN)),
Stuart McCulloch4482c702012-06-15 13:27:53 +0000113 new Syntax(
114 BUNDLE_REQUIREDEXECUTIONENVIRONMENT,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000115 "The " + BUNDLE_REQUIREDEXECUTIONENVIRONMENT + " contains a comma-separated list of execution environments that must be present on the Service Platform.",
116 BUNDLE_REQUIREDEXECUTIONENVIRONMENT + ": CDC-1.0/Foundation-1.0", Processor.join(Verifier.EES, ","),
Stuart McCulloch4482c702012-06-15 13:27:53 +0000117 Verifier.ANYPATTERN),
Stuart McCullochf3173222012-06-07 21:57:32 +0000118
Stuart McCulloch4482c702012-06-15 13:27:53 +0000119 new Syntax(
120 BUNDLE_SYMBOLICNAME,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000121 "The " + BUNDLE_SYMBOLICNAME + " header specifies a non-localizable name for this bundle. The bundle symbolic name together with a version must identify a unique bundle. The bundle symbolic name should be based on the reverse domain name convention.",
122 BUNDLE_SYMBOLICNAME + ": com.acme.foo.daffy;singleton:=true",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000123 "${p}",
124 Verifier.SYMBOLICNAME,
125 new Syntax(
126 SINGLETON_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000127 "Indicates that the bundle can only have a single version resolved. A value of true indicates that the bundle is a singleton bundle. The default value is false. The Framework must resolve at most one bundle when multiple versions of a singleton bundle with the same symbolic name are installed. Singleton bundles do not affect the resolution of non-singleton bundles with the same symbolic name.",
128 SINGLETON_DIRECTIVE + "=false", "true,false", Verifier.TRUEORFALSEPATTERN),
Stuart McCulloch4482c702012-06-15 13:27:53 +0000129 new Syntax(
130 FRAGMENT_ATTACHMENT_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000131 "Defines how fragments are allowed to be attached, see the fragments in Fragment Bundles on page 73. The following values are valid for this directive:",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000132 "", "always|never|resolve-time", Pattern.compile("always|never|resolve-time")), new Syntax(
133 BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE, "", "", "true,false",
134 Verifier.TRUEORFALSEPATTERN), new Syntax(BLUEPRINT_TIMEOUT_ATTRIBUTE, "", "",
135 "30000,60000,300000", Verifier.NUMBERPATTERN)),
Stuart McCullochf3173222012-06-07 21:57:32 +0000136
Stuart McCulloch4482c702012-06-15 13:27:53 +0000137 new Syntax(
138 BUNDLE_UPDATELOCATION,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000139 "The " + BUNDLE_UPDATELOCATION + " header specifies a URL where an update for this bundle should come from. If the bundle is updated, this location should be used, if present, to retrieve the updated JAR file.",
140 BUNDLE_UPDATELOCATION + ": http://www.acme.com/Firewall/bundle.jar", null, Verifier.URLPATTERN),
Stuart McCullochf3173222012-06-07 21:57:32 +0000141
Stuart McCulloch4482c702012-06-15 13:27:53 +0000142 new Syntax(BUNDLE_VENDOR,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000143 "The " + BUNDLE_VENDOR + " header contains a human-readable description of the bundle vendor.",
144 BUNDLE_VENDOR + ": OSGi Alliance", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000145
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000146 new Syntax(BUNDLE_VERSION, "The " + BUNDLE_VERSION + " header specifies the version of this bundle.",
147 BUNDLE_VERSION + ": 1.23.4.build200903221000", null, Verifier.VERSION),
Stuart McCullochf3173222012-06-07 21:57:32 +0000148
Stuart McCulloch4482c702012-06-15 13:27:53 +0000149 new Syntax(
150 DYNAMICIMPORT_PACKAGE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000151 "The " + DYNAMICIMPORT_PACKAGE + " header contains a comma-separated list of package names that should be dynamically imported when needed.",
152 DYNAMICIMPORT_PACKAGE + ": com.acme.plugin.*", "", Verifier.WILDCARDNAMEPATTERN, version,
Stuart McCulloch4482c702012-06-15 13:27:53 +0000153 bundle_symbolic_name, bundle_version),
Stuart McCullochf3173222012-06-07 21:57:32 +0000154
Stuart McCulloch4482c702012-06-15 13:27:53 +0000155 new Syntax(
156 EXPORT_PACKAGE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000157 "The " + EXPORT_PACKAGE + " header contains a declaration of exported packages.",
158 EXPORT_PACKAGE + ": org.osgi.util.tracker;version=1.3",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000159 "${packages}",
160 null,
161 new Syntax(
162 NO_IMPORT_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000163 "By default, bnd makes all exports also imports. Adding a " + NO_IMPORT_DIRECTIVE + " to an exported package will make it export only.",
164 NO_IMPORT_DIRECTIVE + "=true", "true,false", Verifier.TRUEORFALSEPATTERN),
Stuart McCulloch4482c702012-06-15 13:27:53 +0000165 new Syntax(
166 USES_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000167 "Calculated by bnd: It is a comma-separated list of package names that are used by the exported package.",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000168 "Is calculated by bnd", null, null),
169 new Syntax(
170 MANDATORY_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000171 "A comma-separated list of attribute names. Note that the use of a comma in the value requires it to be enclosed in double quotes. A bundle importing the package must specify the mandatory attributes, with a value that matches, to resolve to the exported package.",
172 MANDATORY_DIRECTIVE + "=\"bar,foo\"", null, null), new Syntax(INCLUDE_DIRECTIVE,
173 "A comma-separated list of class names that must be visible to an importer.",
174 INCLUDE_DIRECTIVE + "=\"Qux*\"", null, null), new Syntax(EXCLUDE_DIRECTIVE,
175 "A comma-separated list of class names that must not be visible to an importer.",
176 EXCLUDE_DIRECTIVE + "=\"QuxImpl*,BarImpl\"", null, Verifier.WILDCARDNAMEPATTERN), new Syntax(
177 IMPORT_DIRECTIVE, "Experimental.", "", null, null)
Stuart McCullochf3173222012-06-07 21:57:32 +0000178
Stuart McCulloch4482c702012-06-15 13:27:53 +0000179 ),
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000180 new Syntax(EXPORT_SERVICE, "Deprecated.", EXPORT_SERVICE + ": org.osgi.service.log.LogService",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000181 "${classes;implementing;*}", null),
182 new Syntax(
183 FRAGMENT_HOST,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000184 "The " + FRAGMENT_HOST + " header defines the host bundle for this fragment.",
185 FRAGMENT_HOST + ": org.eclipse.swt; bundle-version=\"[3.0.0,4.0.0)\"",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000186 null,
187 null,
188 new Syntax(
189 EXTENSION_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000190 "Indicates this extension is a system or boot class path extension. It is only applicable when the Fragment-Host is the System Bundle.",
191 EXTENSION_DIRECTIVE + "=framework", "framework,bootclasspath", Pattern
Stuart McCulloch4482c702012-06-15 13:27:53 +0000192 .compile("framework|bootclasspath")), bundle_version),
193 new Syntax(
194 IMPORT_PACKAGE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000195 "The " + IMPORT_PACKAGE + " header is normally calculated by bnd, however, you can decorate packages or skip packages. The header declares the imported packages for this bundle.",
196 IMPORT_PACKAGE + ": !com.exotic.*, com.acme.foo;vendor=ACME, *",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000197 "${exported_packages}",
198 Verifier.WILDCARDNAMEPATTERN,
199 new Syntax(REMOVE_ATTRIBUTE_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000200 "Remove the given attributes from matching imported packages.", REMOVE_ATTRIBUTE_DIRECTIVE + "=foo.*",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000201 null, Verifier.WILDCARDNAMEPATTERN),
202 new Syntax(
203 RESOLUTION_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000204 "Indicates that the packages must be resolved if the value is mandatory, which is the default. If mandatory packages cannot be resolved, then the bundle must fail to resolve. A value of optional indicates that the packages are optional.",
205 RESOLUTION_DIRECTIVE + "=optional", "mandatory,optional", Pattern.compile("mandatory|optional")
Stuart McCullochf3173222012-06-07 21:57:32 +0000206
Stuart McCulloch4482c702012-06-15 13:27:53 +0000207 ), version, bundle_symbolic_name, bundle_version),
Stuart McCullochf3173222012-06-07 21:57:32 +0000208
Stuart McCulloch4482c702012-06-15 13:27:53 +0000209 new Syntax(
210 REQUIRE_BUNDLE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000211 "The " + REQUIRE_BUNDLE + " header specifies the required exports from another bundle.",
212 REQUIRE_BUNDLE + ": com.acme.chess",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000213 null,
214 Verifier.WILDCARDNAMEPATTERN,
Stuart McCullochf3173222012-06-07 21:57:32 +0000215
Stuart McCulloch4482c702012-06-15 13:27:53 +0000216 new Syntax(
217 VISIBILITY_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000218 "If the value is private (Default), then all visible packages from the required bundles are not re-exported. If the value is reexport then bundles that require this bundle will transitively have access to these required bundle’s exported packages.",
219 VISIBILITY_DIRECTIVE + "=private", "private,reexport", Pattern.compile("private|reexport")),
Stuart McCullochf3173222012-06-07 21:57:32 +0000220
Stuart McCulloch4482c702012-06-15 13:27:53 +0000221 new Syntax(
222 RESOLUTION_DIRECTIVE,
223 "If the value is mandatory (default) then the required bundle must exist for this bundle to resolve. If the value is optional, the bundle will resolve even if the required bundle does not exist.",
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000224 RESOLUTION_DIRECTIVE + "=optional", "mandatory,optional", Pattern.compile("mandatory|optional")),
Stuart McCullochf3173222012-06-07 21:57:32 +0000225
Stuart McCulloch4482c702012-06-15 13:27:53 +0000226 new Syntax(
227 SPLIT_PACKAGE_DIRECTIVE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000228 "Indicates how an imported package should be merged when it is split between different exporters. The default is merge-first with warning.",
229 SPLIT_PACKAGE_DIRECTIVE + "=merge-first", "merge-first,merge-last,error,first", Pattern
Stuart McCulloch4482c702012-06-15 13:27:53 +0000230 .compile("merge-first|merge-last|error|first")), bundle_version
Stuart McCullochf3173222012-06-07 21:57:32 +0000231
Stuart McCulloch4482c702012-06-15 13:27:53 +0000232 ),
233 new Syntax(BUILDPATH,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000234 "Provides the class path for building the jar. The entries are references to the repository.",
235 BUILDPATH + "=osgi;version=4.1", "${repo;bsns}", Verifier.SYMBOLICNAME, path_version),
Stuart McCulloch4482c702012-06-15 13:27:53 +0000236 new Syntax(BUMPPOLICY, "Sets the version bump policy. This is a parameter to the ${version} macro.",
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000237 BUMPPOLICY + "==+0", "==+,=+0,+00", Pattern.compile("[=+-0][=+-0][=+-0]")),
Stuart McCullochf3173222012-06-07 21:57:32 +0000238
Stuart McCulloch4482c702012-06-15 13:27:53 +0000239 new Syntax(CONDUIT,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000240 "Allows a bnd file to point to files which will be returned when the bnd file is build.",
241 CONDUIT + "= jar/osgi.jar", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000242
Stuart McCulloch4482c702012-06-15 13:27:53 +0000243 new Syntax(
244 DEPENDSON,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000245 "List of project names that this project directly depends on. These projects are always build ahead of this project.",
246 DEPENDSON + "=org.acme.cm", "${projects}", null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000247
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000248 new Syntax(DEPLOYREPO, "Specifies to which repo the project should be deployed.", DEPLOYREPO + "=cnf",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000249 "${repos}", null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000250
Stuart McCulloch4482c702012-06-15 13:27:53 +0000251 new Syntax(DONOTCOPY,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000252 "Regular expression for names of files and directories that should not be copied when discovered.",
253 DONOTCOPY + "=(CVS|\\.svn)", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000254
Stuart McCulloch4482c702012-06-15 13:27:53 +0000255 new Syntax(
256 EXPORT_CONTENTS,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000257 "Build the JAR in the normal way but use this header for the " + EXPORT_PACKAGE + " header manifest generation, same format.",
258 EXPORT_CONTENTS + "=!*impl*,*;version=3.0", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000259
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000260 new Syntax(FAIL_OK, "Return with an ok status (0) even if the build generates errors.", FAIL_OK + "=true",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000261 "true,false", Verifier.TRUEORFALSEPATTERN),
Stuart McCullochf3173222012-06-07 21:57:32 +0000262
Stuart McCulloch4482c702012-06-15 13:27:53 +0000263 new Syntax(
264 INCLUDE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000265 "Include files. If an entry starts with '-', it does not have to exist. If it starts with '~', it must not overwrite any existing properties.",
266 INCLUDE + ": -${java.user}/.bnd", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000267
Stuart McCulloch4482c702012-06-15 13:27:53 +0000268 new Syntax(
269 INCLUDERESOURCE,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000270 "Include resources from the file system. You can specify a directory, or file. All files are copied to the root, unless a destination directory is indicated.",
271 INCLUDERESOURCE + ": lib=jar", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000272
Stuart McCulloch4482c702012-06-15 13:27:53 +0000273 new Syntax(
274 MAKE,
275 "Set patterns for make plugins. These patterns are used to find a plugin that can make a resource that can not be found.",
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000276 MAKE + ": (*).jar;type=bnd; recipe=\"bnd/$1.bnd\"", null, null, new Syntax("type",
277 "Type name for plugin.", "type=bnd", "bnd", null), new Syntax("recipe",
278 "Recipe for the plugin, can use back references.", "recipe=\"bnd/$1.bnd\"", "bnd", null)),
Stuart McCullochf3173222012-06-07 21:57:32 +0000279
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000280 new Syntax(MANIFEST, "Directly include a manifest, do not use the calculated manifest.",
281 MANIFEST + "=META-INF/MANIFEST.MF", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000282
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000283 new Syntax(NOEXTRAHEADERS, "Do not generate housekeeping headers.", NOEXTRAHEADERS + "=true", "true,false",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000284 Verifier.TRUEORFALSEPATTERN),
Stuart McCullochf3173222012-06-07 21:57:32 +0000285
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000286 new Syntax(NOUSES, "Do not calculate the " + USES_DIRECTIVE + " directive on exports.", NOUSES + "=true", "true,false",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000287 Verifier.TRUEORFALSEPATTERN),
Stuart McCullochf3173222012-06-07 21:57:32 +0000288
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000289 new Syntax(PEDANTIC, "Warn about things that are not really wrong but still not right.", PEDANTIC + "=true",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000290 "true,false", Verifier.TRUEORFALSEPATTERN),
Stuart McCullochf3173222012-06-07 21:57:32 +0000291
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000292 new Syntax(PLUGIN, "Define the plugins.",
293 PLUGIN + "=aQute.lib.spring.SpringComponent,aQute.lib.deployer.FileRepo;location=${repo}", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000294
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000295 new Syntax(SERVICE_COMPONENT, "The header for Declarative Services.",
296 SERVICE_COMPONENT + "=com.acme.Foo?;activate='start'", null, null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000297
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000298 new Syntax(POM, "Generate a maven pom.", POM + "=true", "true,false", Verifier.TRUEORFALSEPATTERN),
Stuart McCullochf3173222012-06-07 21:57:32 +0000299
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000300 new Syntax(RELEASEREPO, "Specifies to which repo the project should be released.", RELEASEREPO + "=cnf",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000301 "${repos}", null),
Stuart McCullochf3173222012-06-07 21:57:32 +0000302
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000303 new Syntax(REMOVEHEADERS, "Remove all headers that match the regular expressions.",
304 REMOVEHEADERS + "=FOO_.*,Proprietary", null, null),
Stuart McCulloch4482c702012-06-15 13:27:53 +0000305 new Syntax(
306 RESOURCEONLY,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000307 "Normally bnd warns when the JAR does not contain any classes, this option suppresses this warning.",
308 RESOURCEONLY + "=true", "true,false", Verifier.TRUEORFALSEPATTERN),
309 new Syntax(SOURCES, "Include sources in the jar.", SOURCES + "=true", "true,false",
Stuart McCulloch4482c702012-06-15 13:27:53 +0000310 Verifier.TRUEORFALSEPATTERN),
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000311 new Syntax(SOURCEPATH, "List of directory names that used to source sources for " + SOURCES + ".",
312 SOURCEPATH + ":= src, test", null, null),
Stuart McCulloch4482c702012-06-15 13:27:53 +0000313 new Syntax(
314 SUB,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000315 "Build a set of bnd files that use this bnd file as a basis. The list of bnd file can be specified with wildcards.",
316 SUB + "=com.acme.*.bnd", null, null),
317 new Syntax(RUNPROPERTIES, "Properties that are set as system properties before the framework is started.",
318 RUNPROPERTIES + "= foo=3, bar=4", null, null),
319 new Syntax(RUNSYSTEMPACKAGES, "Add additional system packages to a framework run.",
320 RUNSYSTEMPACKAGES + "=com.acme.foo,javax.management", null, null),
Stuart McCulloch4482c702012-06-15 13:27:53 +0000321 new Syntax(
322 RUNBUNDLES,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000323 "Add additional bundles, specified with their bsn and version like in " + BUILDPATH + ", that are started before the project is run.",
324 RUNBUNDLES + "=osgi;version=\"[4.1,4.2)\", junit.junit, com.acme.foo;version=project", null,
Stuart McCulloch4482c702012-06-15 13:27:53 +0000325 Verifier.SYMBOLICNAME, path_version),
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000326 new Syntax(RUNPATH, "Additional JARs for the VM path, should include the framework.",
327 RUNPATH + "=org.eclipse.osgi;version=3.5", null, null, path_version),
Stuart McCulloch4482c702012-06-15 13:27:53 +0000328 new Syntax(
329 RUNVM,
Stuart McCulloch2a0afd62012-09-06 18:28:06 +0000330 "Additional arguments for the VM invokation. Keys that start with a - are added as options, otherwise they are treated as -D properties for the VM.",
331 RUNVM + "=-Xmax=30", null, null)
Stuart McCulloch4482c702012-06-15 13:27:53 +0000332 };
Stuart McCullochf3173222012-06-07 21:57:32 +0000333
Stuart McCulloch4482c702012-06-15 13:27:53 +0000334 public final static Map<String,Syntax> HELP = new HashMap<String,Syntax>();
Stuart McCullochf3173222012-06-07 21:57:32 +0000335
Stuart McCulloch4482c702012-06-15 13:27:53 +0000336 static {
337 for (Syntax s : syntaxes) {
338 HELP.put(s.header, s);
339 }
340 }
Stuart McCullochf3173222012-06-07 21:57:32 +0000341
Stuart McCulloch4482c702012-06-15 13:27:53 +0000342 public Syntax(String header, String lead, String example, String values, Pattern pattern, Syntax... children) {
343 this.header = header;
344 this.children = children;
345 this.lead = lead;
346 this.example = example;
347 this.values = values;
348 this.pattern = pattern;
349 }
Stuart McCullochf3173222012-06-07 21:57:32 +0000350
Stuart McCulloch4482c702012-06-15 13:27:53 +0000351 public String getLead() {
352 return lead;
353 }
Stuart McCullochf3173222012-06-07 21:57:32 +0000354
Stuart McCulloch4482c702012-06-15 13:27:53 +0000355 public String getExample() {
356 return example;
357 }
Stuart McCullochf3173222012-06-07 21:57:32 +0000358
Stuart McCulloch4482c702012-06-15 13:27:53 +0000359 public String getValues() {
360 return values;
361 }
Stuart McCullochf3173222012-06-07 21:57:32 +0000362
Stuart McCulloch4482c702012-06-15 13:27:53 +0000363 public String getPattern() {
364 return lead;
365 }
Stuart McCullochf3173222012-06-07 21:57:32 +0000366
Stuart McCulloch4482c702012-06-15 13:27:53 +0000367 public Syntax[] getChildren() {
368 return children;
369 }
Stuart McCullochf3173222012-06-07 21:57:32 +0000370
Stuart McCulloch4482c702012-06-15 13:27:53 +0000371 public String getHeader() {
372 return header;
373 }
Stuart McCullochf3173222012-06-07 21:57:32 +0000374
375}