Apply latest bnd code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1349301 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java b/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java
index b196a1c..8df703f 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java
@@ -62,7 +62,7 @@
BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SYMBOLICNAME, BUNDLE_VERSION,
FRAGMENT_HOST, PRIVATE_PACKAGE, IGNORE_PACKAGE, INCLUDE_RESOURCE, REQUIRE_BUNDLE,
IMPORT_SERVICE, EXPORT_SERVICE, CONDITIONAL_PACKAGE, BND_LASTMODIFIED, TESTCASES,
- SIGNATURE_TEST, REQUIRE_CAPABILITY, PROVIDE_CAPABILITY };
+ SIGNATURE_TEST, REQUIRE_CAPABILITY, PROVIDE_CAPABILITY };
String BUILDPATH = "-buildpath";
String BUILDPACKAGES = "-buildpackages";
@@ -73,7 +73,8 @@
String DEPENDSON = "-dependson";
String DEPLOY = "-deploy";
String DEPLOYREPO = "-deployrepo";
- String DIGESTS = "-digests";
+ String DIGESTS = "-digests";
+ String DSANNOTATIONS = "-dsannotations";
String DONOTCOPY = "-donotcopy";
String DEBUG = "-debug";
String EXPORT_CONTENTS = "-exportcontents";
@@ -89,7 +90,8 @@
String NOEXTRAHEADERS = "-noextraheaders";
String NOMANIFEST = "-nomanifest";
String NOUSES = "-nouses";
- @Deprecated String NOPE = "-nope";
+ @Deprecated
+ String NOPE = "-nope";
String NOBUNDLES = "-nobundles";
String PEDANTIC = "-pedantic";
String PLUGIN = "-plugin";
@@ -124,11 +126,14 @@
String TESTCONTINUOUS = "-testcontinuous";
String UNDERTEST = "-undertest";
String VERBOSE = "-verbose";
- @Deprecated String VERSIONPOLICY_IMPL = "-versionpolicy-impl";
- @Deprecated String VERSIONPOLICY_USES = "-versionpolicy-uses";
+ @Deprecated
+ String VERSIONPOLICY_IMPL = "-versionpolicy-impl";
+ @Deprecated
+ String VERSIONPOLICY_USES = "-versionpolicy-uses";
String PROVIDER_POLICY = "-provider-policy";
String CONSUMER_POLICY = "-consumer-policy";
- @Deprecated String VERSIONPOLICY = "-versionpolicy";
+ @Deprecated
+ String VERSIONPOLICY = "-versionpolicy";
String WAB = "-wab";
String WABLIB = "-wablib";
String REQUIRE_BND = "-require-bnd";
@@ -137,14 +142,14 @@
String CLASSPATH = "-classpath";
String OUTPUT = "-output";
- String options[] = { BUILDPATH,
+ String options[] = {BUILDPATH,
BUMPPOLICY, CONDUIT, CLASSPATH, CONSUMER_POLICY, DEPENDSON, DONOTCOPY, EXPORT_CONTENTS,
FAIL_OK, INCLUDE, INCLUDERESOURCE, MAKE, MANIFEST, NOEXTRAHEADERS, NOUSES, NOBUNDLES,
PEDANTIC, PLUGIN, POM, PROVIDER_POLICY, REMOVEHEADERS, RESOURCEONLY, SOURCES,
SOURCEPATH, SOURCES, SOURCEPATH, SUB, RUNBUNDLES, RUNPATH, RUNSYSTEMPACKAGES,
RUNPROPERTIES, REPORTNEWER, UNDERTEST, TESTPATH, TESTPACKAGES, TESTREPORT, VERBOSE,
NOMANIFEST, DEPLOYREPO, RELEASEREPO, SAVEMANIFEST, RUNVM, WAB, WABLIB, RUNFRAMEWORK,
- RUNTRACE, TESTCONTINUOUS, SNAPSHOT, NAMESECTION, DIGESTS };
+ RUNTRACE, TESTCONTINUOUS, SNAPSHOT, NAMESECTION, DIGESTS, DSANNOTATIONS };
// Ignore bundle specific headers. These bundles do not make
// a lot of sense to inherit
@@ -152,7 +157,7 @@
INCLUDE_RESOURCE, BUNDLE_ACTIVATOR, BUNDLE_CLASSPATH, BUNDLE_NAME, BUNDLE_NATIVECODE,
BUNDLE_SYMBOLICNAME, IMPORT_PACKAGE, EXPORT_PACKAGE, DYNAMICIMPORT_PACKAGE,
FRAGMENT_HOST, REQUIRE_BUNDLE, PRIVATE_PACKAGE, EXPORT_CONTENTS, TESTCASES, NOMANIFEST,
- SIGNATURE_TEST, WAB, WABLIB, REQUIRE_CAPABILITY, PROVIDE_CAPABILITY };
+ SIGNATURE_TEST, WAB, WABLIB, REQUIRE_CAPABILITY, PROVIDE_CAPABILITY, DSANNOTATIONS, SERVICE_COMPONENT };
char DUPLICATE_MARKER = '~';
String SPECIFICATION_VERSION = "specification-version";
@@ -223,7 +228,7 @@
String DEFAULT_JAR_EXTENSION = ".jar";
String DEFAULT_BAR_EXTENSION = ".bar";
String DEFAULT_BNDRUN_EXTENSION = ".bndrun";
- String[] METAPACKAGES = { "META-INF",
+ String[] METAPACKAGES = {"META-INF",
"OSGI-INF", "OSGI-OPT" };
String CURRENT_VERSION = "@";
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java b/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java
index 4b81607..9263e3c 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java
@@ -4,24 +4,27 @@
import java.util.regex.*;
public class Instruction {
-
+
public static class Filter implements FileFilter {
- private Instruction instruction;
- private boolean recursive;
- private Pattern doNotCopy;
-
- public Filter (Instruction instruction, boolean recursive, Pattern doNotCopy) {
+ private Instruction instruction;
+ private boolean recursive;
+ private Pattern doNotCopy;
+
+ public Filter(Instruction instruction, boolean recursive, Pattern doNotCopy) {
this.instruction = instruction;
this.recursive = recursive;
this.doNotCopy = doNotCopy;
}
- public Filter (Instruction instruction, boolean recursive) {
+
+ public Filter(Instruction instruction, boolean recursive) {
this(instruction, recursive, Pattern.compile(Constants.DEFAULT_DO_NOT_COPY));
}
+
public boolean isRecursive() {
return recursive;
}
+
public boolean accept(File pathname) {
if (doNotCopy != null && doNotCopy.matcher(pathname.getName()).matches()) {
return false;
@@ -30,7 +33,7 @@
if (pathname.isDirectory() && isRecursive()) {
return true;
}
-
+
if (instruction == null) {
return true;
}
@@ -47,87 +50,89 @@
final boolean duplicate;
final boolean literal;
final boolean any;
-
+
public Instruction(String input) {
this.input = input;
-
+
String s = Processor.removeDuplicateMarker(input);
duplicate = !s.equals(input);
-
+
if (s.startsWith("!")) {
negated = true;
s = s.substring(1);
- } else
+ }
+ else
negated = false;
- if ( input.equals("*")) {
+ if (input.equals("*")) {
any = true;
- literal= false;
- match= null;
+ literal = false;
+ match = null;
return;
}
-
+
any = false;
if (s.startsWith("=")) {
match = s.substring(1);
literal = true;
- } else {
+ }
+ else {
boolean wildcards = false;
-
+
StringBuilder sb = new StringBuilder();
loop: for (int c = 0; c < s.length(); c++) {
switch (s.charAt(c)) {
- case '.':
- // If we end in a wildcard .* then we need to
- // also include the last full package. I.e.
- // com.foo.* includes com.foo (unlike OSGi)
- if ( c == s.length()-2 && '*'==s.charAt(c+1)) {
- sb.append("(\\..*)?");
- wildcards=true;
- break loop;
- }
- else
- sb.append("\\.");
-
- break;
- case '*':
- sb.append(".*");
- wildcards=true;
- break;
- case '$':
- sb.append("\\$");
- break;
- case '?':
- sb.append(".?");
- wildcards=true;
- break;
- case '|':
- sb.append('|');
- wildcards=true;
- break;
- default:
- sb.append(s.charAt(c));
- break;
+ case '.' :
+ // If we end in a wildcard .* then we need to
+ // also include the last full package. I.e.
+ // com.foo.* includes com.foo (unlike OSGi)
+ if (c == s.length() - 2 && '*' == s.charAt(c + 1)) {
+ sb.append("(\\..*)?");
+ wildcards = true;
+ break loop;
+ }
+ else
+ sb.append("\\.");
+
+ break;
+ case '*' :
+ sb.append(".*");
+ wildcards = true;
+ break;
+ case '$' :
+ sb.append("\\$");
+ break;
+ case '?' :
+ sb.append(".?");
+ wildcards = true;
+ break;
+ case '|' :
+ sb.append('|');
+ wildcards = true;
+ break;
+ default :
+ sb.append(s.charAt(c));
+ break;
}
}
-
- if ( !wildcards ) {
+
+ if (!wildcards) {
literal = true;
match = s;
- } else {
+ }
+ else {
literal = false;
match = sb.toString();
}
}
-
}
public boolean matches(String value) {
if (any)
return true;
-
- if (literal )
+
+ if (literal)
return match.equals(value);
else
return getMatcher(value).matches();
@@ -164,7 +169,6 @@
return optional;
}
-
public boolean isLiteral() {
return literal;
}