Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 1 | package aQute.bnd.help; |
| 2 | |
| 3 | import java.util.*; |
| 4 | import java.util.regex.*; |
| 5 | |
Stuart McCulloch | 42151ee | 2012-07-16 13:43:38 +0000 | [diff] [blame] | 6 | import aQute.bnd.osgi.*; |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 7 | |
| 8 | public class Syntax implements Constants { |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 9 | final String header; |
| 10 | final String lead; |
| 11 | final String example; |
| 12 | final Pattern pattern; |
| 13 | final String values; |
| 14 | final Syntax[] children; |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 15 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 16 | static Syntax version = new Syntax( |
| 17 | VERSION_ATTRIBUTE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 18 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 20 | 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 McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 24 | BUNDLE_SYMBOLIC_NAME_ATTRIBUTE + "=com.acme.foo.daffy", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 25 | null, Verifier.SYMBOLICNAME); |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 26 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 27 | static Syntax bundle_version = new Syntax( |
| 28 | BUNDLE_VERSION_ATTRIBUTE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 29 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 31 | Verifier.VERSIONRANGE); |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 32 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 33 | static Syntax path_version = new Syntax( |
| 34 | VERSION_ATTRIBUTE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 35 | "Specifies the range in the repository, project or file.", |
| 36 | VERSION_ATTRIBUTE + "=project", "project,type", Pattern |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 37 | .compile("project|type|" |
| 38 | + Verifier.VERSIONRANGE |
| 39 | .toString())); |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 40 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 41 | static Syntax[] syntaxes = new Syntax[] { |
| 42 | new Syntax( |
| 43 | BUNDLE_ACTIVATIONPOLICY, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 44 | "The " + BUNDLE_ACTIVATIONPOLICY + " header specifies how the framework should activate the bundle once started.", |
| 45 | BUNDLE_ACTIVATIONPOLICY + ": lazy", "lazy", Pattern.compile("lazy")), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 46 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 47 | new Syntax(BUNDLE_ACTIVATOR, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 48 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 50 | "${classes;implementing;org.osgi.framework.BundleActivator}", Verifier.FQNPATTERN), |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 51 | 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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 53 | new Syntax( |
| 54 | BUNDLE_CLASSPATH, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 55 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 57 | new Syntax(BUNDLE_CONTACTADDRESS, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 58 | "The " + BUNDLE_CONTACTADDRESS + " header provides the contact address of the vendor.", |
| 59 | BUNDLE_CONTACTADDRESS + ": 2400 Oswego Road, Austin, TX 74563", null, null), |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 60 | new Syntax(BUNDLE_COPYRIGHT, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 61 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 65 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 66 | new Syntax(BUNDLE_DOCURL, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 67 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 69 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 70 | new Syntax( |
| 71 | BUNDLE_ICON, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 72 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 75 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 76 | new Syntax( |
| 77 | BUNDLE_LICENSE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 78 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 80 | "http://www.apache.org/licenses/LICENSE-2.0,<<EXTERNAL>>", Pattern.compile("(" |
| 81 | + Verifier.URLPATTERN + "|<<EXTERNAL>>)"), new Syntax(DESCRIPTION_ATTRIBUTE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 82 | "Human readable description of the license.", DESCRIPTION_ATTRIBUTE + "=\"Describe the license here\"", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 83 | null, Verifier.ANYPATTERN), new Syntax(LINK_ATTRIBUTE, "", "", null, Verifier.URLPATTERN)), |
| 84 | new Syntax( |
| 85 | BUNDLE_LOCALIZATION, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 86 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 88 | new Syntax( |
| 89 | BUNDLE_MANIFESTVERSION, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 90 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 92 | new Syntax( |
| 93 | BUNDLE_NAME, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 94 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 96 | new Syntax( |
| 97 | BUNDLE_NATIVECODE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 98 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 100 | null, |
| 101 | Verifier.PATHPATTERN, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 102 | new Syntax(OSNAME_ATTRIBUTE, "The name of the operating system.", OSNAME_ATTRIBUTE + "=MacOS", Processor.join( |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 103 | Verifier.OSNAMES, ","), Verifier.ANYPATTERN), |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 104 | new Syntax(OSVERSION_ATTRIBUTE, "Operating System Version.", OSVERSION_ATTRIBUTE + "=3.1", null, |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 105 | Verifier.ANYPATTERN), |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 106 | 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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 108 | 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 McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 112 | SELECTION_FILTER_ATTRIBUTE + "=\"(com.acme.windowing=win32)\"", null, Verifier.FILTERPATTERN)), |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 113 | new Syntax( |
| 114 | BUNDLE_REQUIREDEXECUTIONENVIRONMENT, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 115 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 117 | Verifier.ANYPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 118 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 119 | new Syntax( |
| 120 | BUNDLE_SYMBOLICNAME, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 121 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 123 | "${p}", |
| 124 | Verifier.SYMBOLICNAME, |
| 125 | new Syntax( |
| 126 | SINGLETON_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 127 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 129 | new Syntax( |
| 130 | FRAGMENT_ATTACHMENT_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 131 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 132 | "", "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 136 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 137 | new Syntax( |
| 138 | BUNDLE_UPDATELOCATION, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 139 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 141 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 142 | new Syntax(BUNDLE_VENDOR, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 143 | "The " + BUNDLE_VENDOR + " header contains a human-readable description of the bundle vendor.", |
| 144 | BUNDLE_VENDOR + ": OSGi Alliance", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 145 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 146 | 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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 148 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 149 | new Syntax( |
| 150 | DYNAMICIMPORT_PACKAGE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 151 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 153 | bundle_symbolic_name, bundle_version), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 154 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 155 | new Syntax( |
| 156 | EXPORT_PACKAGE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 157 | "The " + EXPORT_PACKAGE + " header contains a declaration of exported packages.", |
| 158 | EXPORT_PACKAGE + ": org.osgi.util.tracker;version=1.3", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 159 | "${packages}", |
| 160 | null, |
| 161 | new Syntax( |
| 162 | NO_IMPORT_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 163 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 165 | new Syntax( |
| 166 | USES_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 167 | "Calculated by bnd: It is a comma-separated list of package names that are used by the exported package.", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 168 | "Is calculated by bnd", null, null), |
| 169 | new Syntax( |
| 170 | MANDATORY_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 171 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 178 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 179 | ), |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 180 | new Syntax(EXPORT_SERVICE, "Deprecated.", EXPORT_SERVICE + ": org.osgi.service.log.LogService", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 181 | "${classes;implementing;*}", null), |
| 182 | new Syntax( |
| 183 | FRAGMENT_HOST, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 184 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 186 | null, |
| 187 | null, |
| 188 | new Syntax( |
| 189 | EXTENSION_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 190 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 192 | .compile("framework|bootclasspath")), bundle_version), |
| 193 | new Syntax( |
| 194 | IMPORT_PACKAGE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 195 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 197 | "${exported_packages}", |
| 198 | Verifier.WILDCARDNAMEPATTERN, |
| 199 | new Syntax(REMOVE_ATTRIBUTE_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 200 | "Remove the given attributes from matching imported packages.", REMOVE_ATTRIBUTE_DIRECTIVE + "=foo.*", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 201 | null, Verifier.WILDCARDNAMEPATTERN), |
| 202 | new Syntax( |
| 203 | RESOLUTION_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 204 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 206 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 207 | ), version, bundle_symbolic_name, bundle_version), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 208 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 209 | new Syntax( |
| 210 | REQUIRE_BUNDLE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 211 | "The " + REQUIRE_BUNDLE + " header specifies the required exports from another bundle.", |
| 212 | REQUIRE_BUNDLE + ": com.acme.chess", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 213 | null, |
| 214 | Verifier.WILDCARDNAMEPATTERN, |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 215 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 216 | new Syntax( |
| 217 | VISIBILITY_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 218 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 220 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 221 | 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 McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 224 | RESOLUTION_DIRECTIVE + "=optional", "mandatory,optional", Pattern.compile("mandatory|optional")), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 225 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 226 | new Syntax( |
| 227 | SPLIT_PACKAGE_DIRECTIVE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 228 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 230 | .compile("merge-first|merge-last|error|first")), bundle_version |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 231 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 232 | ), |
| 233 | new Syntax(BUILDPATH, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 234 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 236 | new Syntax(BUMPPOLICY, "Sets the version bump policy. This is a parameter to the ${version} macro.", |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 237 | BUMPPOLICY + "==+0", "==+,=+0,+00", Pattern.compile("[=+-0][=+-0][=+-0]")), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 238 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 239 | new Syntax(CONDUIT, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 240 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 242 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 243 | new Syntax( |
| 244 | DEPENDSON, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 245 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 247 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 248 | new Syntax(DEPLOYREPO, "Specifies to which repo the project should be deployed.", DEPLOYREPO + "=cnf", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 249 | "${repos}", null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 250 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 251 | new Syntax(DONOTCOPY, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 252 | "Regular expression for names of files and directories that should not be copied when discovered.", |
| 253 | DONOTCOPY + "=(CVS|\\.svn)", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 254 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 255 | new Syntax( |
| 256 | EXPORT_CONTENTS, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 257 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 259 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 260 | new Syntax(FAIL_OK, "Return with an ok status (0) even if the build generates errors.", FAIL_OK + "=true", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 261 | "true,false", Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 262 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 263 | new Syntax( |
| 264 | INCLUDE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 265 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 267 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 268 | new Syntax( |
| 269 | INCLUDERESOURCE, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 270 | "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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 272 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 273 | 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 McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 276 | 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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 279 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 280 | new Syntax(MANIFEST, "Directly include a manifest, do not use the calculated manifest.", |
| 281 | MANIFEST + "=META-INF/MANIFEST.MF", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 282 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 283 | new Syntax(NOEXTRAHEADERS, "Do not generate housekeeping headers.", NOEXTRAHEADERS + "=true", "true,false", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 284 | Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 285 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 286 | new Syntax(NOUSES, "Do not calculate the " + USES_DIRECTIVE + " directive on exports.", NOUSES + "=true", "true,false", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 287 | Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 288 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 289 | new Syntax(PEDANTIC, "Warn about things that are not really wrong but still not right.", PEDANTIC + "=true", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 290 | "true,false", Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 291 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 292 | new Syntax(PLUGIN, "Define the plugins.", |
| 293 | PLUGIN + "=aQute.lib.spring.SpringComponent,aQute.lib.deployer.FileRepo;location=${repo}", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 294 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 295 | new Syntax(SERVICE_COMPONENT, "The header for Declarative Services.", |
| 296 | SERVICE_COMPONENT + "=com.acme.Foo?;activate='start'", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 297 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 298 | new Syntax(POM, "Generate a maven pom.", POM + "=true", "true,false", Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 299 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 300 | new Syntax(RELEASEREPO, "Specifies to which repo the project should be released.", RELEASEREPO + "=cnf", |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 301 | "${repos}", null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 302 | |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 303 | new Syntax(REMOVEHEADERS, "Remove all headers that match the regular expressions.", |
| 304 | REMOVEHEADERS + "=FOO_.*,Proprietary", null, null), |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 305 | new Syntax( |
| 306 | RESOURCEONLY, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 307 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 310 | Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 311 | new Syntax(SOURCEPATH, "List of directory names that used to source sources for " + SOURCES + ".", |
| 312 | SOURCEPATH + ":= src, test", null, null), |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 313 | new Syntax( |
| 314 | SUB, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 315 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 321 | new Syntax( |
| 322 | RUNBUNDLES, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 323 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 325 | Verifier.SYMBOLICNAME, path_version), |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 326 | 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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 328 | new Syntax( |
| 329 | RUNVM, |
Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame^] | 330 | "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 McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 332 | }; |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 333 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 334 | public final static Map<String,Syntax> HELP = new HashMap<String,Syntax>(); |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 335 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 336 | static { |
| 337 | for (Syntax s : syntaxes) { |
| 338 | HELP.put(s.header, s); |
| 339 | } |
| 340 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 341 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 342 | 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 McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 350 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 351 | public String getLead() { |
| 352 | return lead; |
| 353 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 354 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 355 | public String getExample() { |
| 356 | return example; |
| 357 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 358 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 359 | public String getValues() { |
| 360 | return values; |
| 361 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 362 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 363 | public String getPattern() { |
| 364 | return lead; |
| 365 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 366 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 367 | public Syntax[] getChildren() { |
| 368 | return children; |
| 369 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 370 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 371 | public String getHeader() { |
| 372 | return header; |
| 373 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 374 | |
| 375 | } |