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 | |
| 6 | import aQute.lib.osgi.*; |
| 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, |
| 18 | "A version range to select the version of an export definition. The default value is 0.0.0 .", |
| 19 | "version=\"[1.2,3.0)\"", null, |
| 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.", |
| 24 | "bundle-symbolic-name=com.acme.foo.daffy", |
| 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, |
| 29 | "a version range to select the bundle version of the exporting bundle. The default value is 0.0.0.", |
| 30 | "bundle-version=1.3", null, |
| 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, |
| 35 | "Specifies the range in the repository, project, or file", |
| 36 | "version=project", "project,type", Pattern |
| 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 | @SuppressWarnings("deprecation") |
| 42 | static Syntax[] syntaxes = new Syntax[] { |
| 43 | new Syntax( |
| 44 | BUNDLE_ACTIVATIONPOLICY, |
| 45 | "The Bundle-ActivationPolicy specifies how the framework should activate the bundle once started. ", |
| 46 | "Bundle-ActivationPolicy: lazy", "lazy", Pattern.compile("lazy")), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 47 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 48 | new Syntax(BUNDLE_ACTIVATOR, |
| 49 | "The Bundle-Activator header specifies the name of the class used to start and stop the bundle. ", |
| 50 | "Bundle-Activator: com.acme.foo.Activator", |
| 51 | "${classes;implementing;org.osgi.framework.BundleActivator}", Verifier.FQNPATTERN), |
| 52 | new Syntax(BUNDLE_CATEGORY, "The Bundle-Category header holds a comma-separated list of category names", |
| 53 | "Bundle-Category: test", "osgi,test,game,util,eclipse,netbeans,jdk,specification", null), |
| 54 | new Syntax( |
| 55 | BUNDLE_CLASSPATH, |
| 56 | "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.", |
| 57 | "Bundle-Classpath: /lib/libnewgen.so, .", null, Verifier.PATHPATTERN), |
| 58 | new Syntax(BUNDLE_CONTACTADDRESS, |
| 59 | "The Bundle-ContactAddress header provides the contact address of the vendor. ", |
| 60 | "Bundle-ContactAddress: 2400 Oswego Road, Austin, TX 74563", null, null), |
| 61 | new Syntax(BUNDLE_COPYRIGHT, |
| 62 | "The Bundle-Copyright header contains the copyright specification for this bundle. ", |
| 63 | "Bundle-Copyright: OSGi (c) 2002", null, null), |
| 64 | new Syntax(BUNDLE_DESCRIPTION, "The Bundle-Description header defines a short description of this bundle.", |
| 65 | "Bundle-Description: Ceci ce n'est pas une bundle", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 66 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 67 | new Syntax(BUNDLE_DOCURL, |
| 68 | "The Bundle-DocURL headers must contain a URL pointing to documentation about this bundle.", |
| 69 | "Bundle-DocURL: http://www.aQute.biz/Code/Bnd", null, Verifier.URLPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 70 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 71 | new Syntax( |
| 72 | BUNDLE_ICON, |
| 73 | "The optional Bundle-Icon header provides a list of (relative) URLs to icons representing this bundle in different sizes. ", |
| 74 | "Bundle-Icon: /icons/bnd.png;size=64", "/icons/bundle.png", Verifier.URLPATTERN, new Syntax("size", |
| 75 | "Icons size in pixels, e.g. 64", "64", "16,32,48,64,128", Verifier.NUMBERPATTERN)), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 76 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 77 | new Syntax( |
| 78 | BUNDLE_LICENSE, |
| 79 | "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", |
| 80 | "Bundle License: http://www.opensource.org/licenses/jabberpl.php", |
| 81 | "http://www.apache.org/licenses/LICENSE-2.0,<<EXTERNAL>>", Pattern.compile("(" |
| 82 | + Verifier.URLPATTERN + "|<<EXTERNAL>>)"), new Syntax(DESCRIPTION_ATTRIBUTE, |
| 83 | "Human readable description of the license", "description=\"Described the license here\"", |
| 84 | null, Verifier.ANYPATTERN), new Syntax(LINK_ATTRIBUTE, "", "", null, Verifier.URLPATTERN)), |
| 85 | new Syntax( |
| 86 | BUNDLE_LOCALIZATION, |
| 87 | "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.", |
| 88 | "Bundle-Localization: OSGI-INF/l10n/bundle", "OSGI-INF/l10n/bundle", Verifier.URLPATTERN), |
| 89 | new Syntax( |
| 90 | BUNDLE_MANIFESTVERSION, |
| 91 | "This header is set by bnd automatically to 2. The Bundle-ManifestVersion header defines that the bundle follows the rules of this specification. The Bundle-ManifestVersion header determines whether the bundle follows the rules of this specification.", |
| 92 | "# Bundle-ManifestVersion: 2", "2", Verifier.NUMBERPATTERN), |
| 93 | new Syntax( |
| 94 | BUNDLE_NAME, |
| 95 | "This header will be derived from the Bundle-SymbolicName 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.", |
| 96 | "Bundle-Name: My Bundle", null, Verifier.ANYPATTERN), |
| 97 | new Syntax( |
| 98 | BUNDLE_NATIVECODE, |
| 99 | "The Bundle-NativeCode header contains a specification of native code libraries contained in this bundle. ", |
| 100 | "Bundle-NativeCode: /lib/http.DLL; osname = QNX; osversion = 3.1", |
| 101 | null, |
| 102 | Verifier.PATHPATTERN, |
| 103 | new Syntax(OSNAME_ATTRIBUTE, "The name of the operating system", "osname=MacOS", Processor.join( |
| 104 | Verifier.OSNAMES, ","), Verifier.ANYPATTERN), |
| 105 | new Syntax(OSVERSION_ATTRIBUTE, "Operating System Version", "osversion=3.1", null, |
| 106 | Verifier.ANYPATTERN), |
| 107 | new Syntax(LANGUAGE_ATTRIBUTE, "Language ISO 639 code", "language=nl", null, Verifier.ISO639), |
| 108 | new Syntax(PROCESSOR_ATTRIBUTE, "Processor name", "processor=x86", Processor.join( |
| 109 | Verifier.PROCESSORNAMES, ","), Verifier.ANYPATTERN), |
| 110 | new Syntax( |
| 111 | SELECTION_FILTER_ATTRIBUTE, |
| 112 | "The value of this attribute must be a filter expression that indicates if the native code clause should be selected or not.", |
| 113 | "selection-filter=\"(com.acme.windowing=win32)\"", null, Verifier.FILTERPATTERN)), |
| 114 | new Syntax( |
| 115 | BUNDLE_REQUIREDEXECUTIONENVIRONMENT, |
| 116 | "The Bundle-RequiredExecutionEnvironment contains a comma-separated list of execution environments that must be present on the Service Platform.", |
| 117 | "Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0", Processor.join(Verifier.EES, ","), |
| 118 | Verifier.ANYPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 119 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 120 | new Syntax( |
| 121 | BUNDLE_SYMBOLICNAME, |
| 122 | "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", |
| 123 | "Bundle-SymbolicName: com.acme.foo.daffy;singleton:=true", |
| 124 | "${p}", |
| 125 | Verifier.SYMBOLICNAME, |
| 126 | new Syntax( |
| 127 | SINGLETON_DIRECTIVE, |
| 128 | " 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.", |
| 129 | "false", "true,false", Verifier.TRUEORFALSEPATTERN), |
| 130 | new Syntax( |
| 131 | FRAGMENT_ATTACHMENT_DIRECTIVE, |
| 132 | "Defines how fragments are allowed to be attached, see the fragments in Fragment Bundles on page73. The following values are valid for this directive:", |
| 133 | "", "always|never|resolve-time", Pattern.compile("always|never|resolve-time")), new Syntax( |
| 134 | BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE, "", "", "true,false", |
| 135 | Verifier.TRUEORFALSEPATTERN), new Syntax(BLUEPRINT_TIMEOUT_ATTRIBUTE, "", "", |
| 136 | "30000,60000,300000", Verifier.NUMBERPATTERN)), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 137 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 138 | new Syntax( |
| 139 | BUNDLE_UPDATELOCATION, |
| 140 | "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.", |
| 141 | "Bundle-UpdateLocation: http://www.acme.com/Firewall/bundle.jar", null, Verifier.URLPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 142 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 143 | new Syntax(BUNDLE_VENDOR, |
| 144 | "The Bundle-Vendor header contains a human-readable description of the bundle vendor. ", |
| 145 | "Bundle-Vendor: OSGi Alliance ", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 146 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 147 | new Syntax(BUNDLE_VERSION, "The Bundle-Version header specifies the version of this bundle", |
| 148 | "Bundle-Version: 1.23.4.build200903221000", null, Verifier.VERSION), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 149 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 150 | new Syntax( |
| 151 | DYNAMICIMPORT_PACKAGE, |
| 152 | "The DynamicImport-Package header contains a comma-separated list of package names that should be dynamically imported when needed.", |
| 153 | "DynamicImport-Package: com.acme.plugin.*", "", Verifier.WILDCARDNAMEPATTERN, version, |
| 154 | bundle_symbolic_name, bundle_version), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 155 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 156 | new Syntax( |
| 157 | EXPORT_PACKAGE, |
| 158 | "The Export-Package header contains a declaration of exported packages.", |
| 159 | "Export-Package: org.osgi.util.tracker;version=1.3", |
| 160 | "${packages}", |
| 161 | null, |
| 162 | new Syntax( |
| 163 | NO_IMPORT_DIRECTIVE, |
| 164 | "By default, bnd makes all exports also imports. Adding a -noimport to an exported package will make it export only", |
| 165 | "-noimport:=true", "true,false", Verifier.TRUEORFALSEPATTERN), |
| 166 | new Syntax( |
| 167 | USES_DIRECTIVE, |
| 168 | "Calculated by bnd: It is a comma-separated list of package names that are used by the exported package", |
| 169 | "Is calculated by bnd", null, null), |
| 170 | new Syntax( |
| 171 | MANDATORY_DIRECTIVE, |
| 172 | "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", |
| 173 | "mandatory=\"bar,foo\"", null, null), new Syntax(INCLUDE_DIRECTIVE, |
| 174 | "A comma-separated list of class names that must be visible to an importer", |
| 175 | "include:=\"Qux*\"", null, null), new Syntax(EXCLUDE_DIRECTIVE, |
| 176 | "A comma-separated list of class names that must not be visible to an importer", |
| 177 | "exclude:=\"QuxImpl*,BarImpl\"", null, Verifier.WILDCARDNAMEPATTERN), new Syntax( |
| 178 | IMPORT_DIRECTIVE, "Experimental", "", null, null) |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 179 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 180 | ), |
| 181 | new Syntax(EXPORT_SERVICE, "Deprecated", "Export-Service: org.osgi.service.log.LogService ", |
| 182 | "${classes;implementing;*}", null), |
| 183 | new Syntax( |
| 184 | FRAGMENT_HOST, |
| 185 | "The Fragment-Host header defines the host bundle for this fragment.", |
| 186 | "Fragment-Host: org.eclipse.swt; bundle-version=\"[3.0.0,4.0.0)\"", |
| 187 | null, |
| 188 | null, |
| 189 | new Syntax( |
| 190 | EXTENSION_DIRECTIVE, |
| 191 | " Indicates this extension is a system or boot class path extension. It is only applicable when the Fragment-Host is the System Bundle", |
| 192 | "extension:=framework", "framework,bootclasspath", Pattern |
| 193 | .compile("framework|bootclasspath")), bundle_version), |
| 194 | new Syntax( |
| 195 | IMPORT_PACKAGE, |
| 196 | "This header is normally calculated by bnd, however, you can decorate packages or skip packages. The Import-Package header declares the imported packages for this bundle", |
| 197 | "Import-Package: !com.exotic.*, com.acme.foo;vendor=ACME, *", |
| 198 | "${exported_packages}", |
| 199 | Verifier.WILDCARDNAMEPATTERN, |
| 200 | new Syntax(REMOVE_ATTRIBUTE_DIRECTIVE, |
| 201 | "Remove the given attributes from matching imported packages", "-remove-attribute:=foo.*", |
| 202 | null, Verifier.WILDCARDNAMEPATTERN), |
| 203 | new Syntax( |
| 204 | RESOLUTION_DIRECTIVE, |
| 205 | "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", |
| 206 | "resolution:=optional", "mandatory,optional", Pattern.compile("mandatory|optional") |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 207 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 208 | ), version, bundle_symbolic_name, bundle_version), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 209 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 210 | new Syntax( |
| 211 | REQUIRE_BUNDLE, |
| 212 | "The Require-Bundle header specifies the required exports from another bundle.", |
| 213 | "Require-Bundle: com.acme.chess", |
| 214 | null, |
| 215 | Verifier.WILDCARDNAMEPATTERN, |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 216 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 217 | new Syntax( |
| 218 | VISIBILITY_DIRECTIVE, |
| 219 | " 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.", |
| 220 | "visibility:=private", "private,reexport", Pattern.compile("private|reexport")), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 221 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 222 | new Syntax( |
| 223 | RESOLUTION_DIRECTIVE, |
| 224 | "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.", |
| 225 | "resolution:=optional", "mandatory,optional", Pattern.compile("mandatory|optional")), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 226 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 227 | new Syntax( |
| 228 | SPLIT_PACKAGE_DIRECTIVE, |
| 229 | "Indicates how an imported package should be merged when it is split between different exporters. The default is merge-first with warning", |
| 230 | "-split-package:=merge-first", "merge-first,merge-last,error,first", Pattern |
| 231 | .compile("merge-first|merge-last|error|first")), bundle_version |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 232 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 233 | ), |
| 234 | new Syntax(BUILDPATH, |
| 235 | "Provides the class path for building the jar. The entries are references to the repository", |
| 236 | "-buildpath=osgi;version=4.1", "${repo;bsns}", Verifier.SYMBOLICNAME, path_version), |
| 237 | new Syntax(BUMPPOLICY, "Sets the version bump policy. This is a parameter to the ${version} macro.", |
| 238 | "-bumppolicy==+0", "==+,=+0,+00", Pattern.compile("[=+-0][=+-0][=+-0]")), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 239 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 240 | new Syntax(CONDUIT, |
| 241 | "Allows a bnd file to point to files which will be returned when the bnd file is build", |
| 242 | "-conduit= jar/osgi.jar", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 243 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 244 | new Syntax( |
| 245 | DEPENDSON, |
| 246 | "List of project names that this project directly depends on. These projects are always build ahead of this project", |
| 247 | "-dependson=org.acme.cm", "${projects}", null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 248 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 249 | new Syntax(DEPLOYREPO, "Specifies to which repo the project should be deployed.", "-deployrepo=cnf", |
| 250 | "${repos}", null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 251 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 252 | new Syntax(DONOTCOPY, |
| 253 | "Regular expression for names of files and directories that should not be copied when discovered", |
| 254 | "-donotcopy=(CVS|\\.svn)", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 255 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 256 | new Syntax( |
| 257 | EXPORT_CONTENTS, |
| 258 | "Build the JAR in the normal way but use this header for the Export-Package header manifest generation, same format", |
| 259 | "-exportcontents=!*impl*,*;version=3.0", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 260 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 261 | new Syntax(FAIL_OK, "Return with an ok status (0) even if the build generates errors", "-failok=true", |
| 262 | "true,false", Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 263 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 264 | new Syntax( |
| 265 | INCLUDE, |
| 266 | "Include files. If an entry starts with '-', it does not have to exist. If it starts with '~', it must not overwrite any existing properties", |
| 267 | "-include: -${java.user}/.bnd", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 268 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 269 | new Syntax( |
| 270 | INCLUDERESOURCE, |
| 271 | "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", |
| 272 | "-includeresource: lib=jar", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 273 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 274 | new Syntax( |
| 275 | MAKE, |
| 276 | "Set patterns for make plugins. These patterns are used to find a plugin that can make a resource that can not be found.", |
| 277 | "-make: (*).jar;type=bnd; recipe=\"bnd/$1.bnd\"", null, null, new Syntax("type", |
| 278 | "Type name for plugin", "type=bnd", "bnd", null), new Syntax("recipe", |
| 279 | "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] | 280 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 281 | new Syntax(MANIFEST, "Directly include a manifest, do not use the calculated manifest", |
| 282 | "-manifest = META-INF/MANIFEST.MF", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 283 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 284 | new Syntax(NOEXTRAHEADERS, "Do not generate housekeeping headers", "-noextraheaders", "true,false", |
| 285 | Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 286 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 287 | new Syntax(NOUSES, "Do not calculate the uses: directive on exports", "-nouses=true", "true,false", |
| 288 | Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 289 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 290 | new Syntax(NOPE, "Deprecated, use -nobundles. ", "-nope=true", "true,false", Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 291 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 292 | new Syntax(PEDANTIC, "Warn about things that are not really wrong but still not right", "-nope=true", |
| 293 | "true,false", Verifier.TRUEORFALSEPATTERN), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 294 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 295 | new Syntax(PLUGIN, "Define the plugins", |
| 296 | "-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] | 297 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 298 | new Syntax(SERVICE_COMPONENT, "The header for Declarative Services", |
| 299 | "Service-Component=com.acme.Foo?;activate='start'", null, null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 300 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 301 | 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] | 302 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 303 | new Syntax(RELEASEREPO, "Specifies to which repo the project should be released.", "-releaserepo=cnf", |
| 304 | "${repos}", null), |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 305 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 306 | new Syntax(REMOVEHEADERS, "Remove all headers that match the regular expressions", |
| 307 | "-removeheaders=FOO_.*,Proprietary", null, null), |
| 308 | new Syntax( |
| 309 | RESOURCEONLY, |
| 310 | "Normally bnd warns when the JAR does not contain any classes, this option suppresses this warning", |
| 311 | "-resourceonly=true", "true,false", Verifier.TRUEORFALSEPATTERN), |
| 312 | new Syntax(SOURCES, "Include sources in the jar", "-sources=true", "true,false", |
| 313 | Verifier.TRUEORFALSEPATTERN), |
| 314 | new Syntax(SOURCEPATH, "List of directory names that used to source sources for -sources", |
| 315 | "-sourcepath:= src, test", null, null), |
| 316 | new Syntax( |
| 317 | SUB, |
| 318 | "Build a set of bnd files that use this bnd file as a basis. The list of bnd file can be specified with wildcards", |
| 319 | "-sub=com.acme.*.bnd", null, null), |
| 320 | new Syntax(RUNPROPERTIES, "Properties that are set as system properties before the framework is started", |
| 321 | "-runproperties= foo=3, bar=4", null, null), |
| 322 | new Syntax(RUNSYSTEMPACKAGES, "Add additional system packages to a framework run", |
| 323 | "-runsystempackages=com.acme.foo,javax.management", null, null), |
| 324 | new Syntax( |
| 325 | RUNBUNDLES, |
| 326 | "Add additional bundles, specified with their bsn and version like in -buildpath, that are started before the project is run", |
| 327 | "-runbundles=osgi;version=\"[4.1,4.2)\", junit.junit, com.acme.foo;version=project", null, |
| 328 | Verifier.SYMBOLICNAME, path_version), |
| 329 | new Syntax(RUNPATH, "Additional JARs for the VM path, should include the framework", |
| 330 | "-runpath=org.eclipse.osgi;version=3.5", null, null, path_version), |
| 331 | new Syntax( |
| 332 | RUNVM, |
| 333 | "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", |
| 334 | "-runvm=-Xmax=30", null, null), |
| 335 | new Syntax(VERSIONPOLICY, "Provides a version policy to imports that are calculated from exports", |
| 336 | "-versionpolicy = \"[${version;==;${@}},${version;+;${@}})\"", null, null) |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 337 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 338 | }; |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 339 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 340 | public final static Map<String,Syntax> HELP = new HashMap<String,Syntax>(); |
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 | static { |
| 343 | for (Syntax s : syntaxes) { |
| 344 | HELP.put(s.header, s); |
| 345 | } |
| 346 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 347 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 348 | public Syntax(String header, String lead, String example, String values, Pattern pattern, Syntax... children) { |
| 349 | this.header = header; |
| 350 | this.children = children; |
| 351 | this.lead = lead; |
| 352 | this.example = example; |
| 353 | this.values = values; |
| 354 | this.pattern = pattern; |
| 355 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 356 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 357 | public String getLead() { |
| 358 | return lead; |
| 359 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 360 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 361 | public String getExample() { |
| 362 | return example; |
| 363 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 364 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 365 | public String getValues() { |
| 366 | return values; |
| 367 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 368 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 369 | public String getPattern() { |
| 370 | return lead; |
| 371 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 372 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 373 | public Syntax[] getChildren() { |
| 374 | return children; |
| 375 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 376 | |
Stuart McCulloch | 4482c70 | 2012-06-15 13:27:53 +0000 | [diff] [blame^] | 377 | public String getHeader() { |
| 378 | return header; |
| 379 | } |
Stuart McCulloch | f317322 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 380 | |
| 381 | } |