diff --git a/apisupport.harness/build.xml b/apisupport.harness/build.xml
--- a/apisupport.harness/build.xml
+++ b/apisupport.harness/build.xml
@@ -44,7 +44,7 @@
-
+
@@ -55,10 +55,22 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apisupport.harness/nbproject/project.properties b/apisupport.harness/nbproject/project.properties
--- a/apisupport.harness/nbproject/project.properties
+++ b/apisupport.harness/nbproject/project.properties
@@ -49,7 +49,7 @@
common.xml,\
jdk.xml,\
tasks.jar,\
- jsearch-2.0_05.jar
+ antlib/*.jar
# Just to keep it from being enabled (it does nothing as a module, and the cluster
# is not even loaded, but just in case):
@@ -68,6 +68,7 @@
org/netbeans/nbbuild/Arch-api-questions.xml,\
org/netbeans/nbbuild/Branding*.class,\
org/netbeans/nbbuild/CreateModuleXML*.class,\
+ org/netbeans/nbbuild/CustomJavac*.class,\
org/netbeans/nbbuild/FixDependencies*.class,\
org/netbeans/nbbuild/FixTestDependencies*.class,\
org/netbeans/nbbuild/JHIndexer*.class,\
diff --git a/apisupport.harness/release/build.xml b/apisupport.harness/release/build.xml
--- a/apisupport.harness/release/build.xml
+++ b/apisupport.harness/release/build.xml
@@ -70,7 +70,7 @@
-
+
@@ -134,13 +134,12 @@
-
-
-
-
+
+
+
@@ -167,7 +166,7 @@
-
+
You must set 'jhall.jar' (e.g. in private.properties) to the location of jsearch.jar from a JavaHelp distribution
diff --git a/apisupport.harness/taskdefs.properties b/apisupport.harness/taskdefs.properties
--- a/apisupport.harness/taskdefs.properties
+++ b/apisupport.harness/taskdefs.properties
@@ -52,4 +52,5 @@
makeupdatedesc=org.netbeans.nbbuild.MakeUpdateDesc
verifyclasslinkage=org.netbeans.nbbuild.VerifyClassLinkage
fixtestdeps=org.netbeans.nbbuild.FixTestDependencies
-shorterpaths=org.netbeans.nbbuild.ShorterPaths
\ No newline at end of file
+shorterpaths=org.netbeans.nbbuild.ShorterPaths
+custom-javac=org.netbeans.nbbuild.CustomJavac
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java b/nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java
new file mode 100644
--- /dev/null
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java
@@ -0,0 +1,139 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2008 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.nbbuild;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Javac;
+import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
+import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * Runs javac in-process from a local implementation, e.g. so as to ensure JSR 269 is supported.
+ * Works just like using the default modern
compiler, except loaded from the specified place.
+ */
+public class CustomJavac extends Javac {
+
+ public CustomJavac() {}
+
+ private Path javacClasspath;
+ public void addJavacClasspath(Path cp) {
+ javacClasspath = cp;
+ }
+
+ private Path processorPath;
+ public void addProcessorPath(Path cp) {
+ processorPath = cp;
+ }
+
+ @Override
+ protected void compile() {
+ String specifiedCompiler = getProject().getProperty("build.compiler");
+ if (specifiedCompiler != null) {
+ log("Warning: build.compiler=" + specifiedCompiler + " so disabling JSR 269 annotation processing", Project.MSG_WARN);
+ super.compile();
+ return;
+ }
+ if (processorPath != null) {
+ createCompilerArg().setValue("-processorpath");
+ createCompilerArg().setPath(processorPath);
+ }
+ if (compileList.length > 0) {
+ log("Compiling " + compileList.length + " source file" +
+ (compileList.length == 1 ? "" : "s") +
+ (getDestdir() != null ? " to " + getDestdir() : ""));
+ if (listFiles) {
+ for (File f : compileList) {
+ log(f.getAbsolutePath());
+ }
+ }
+ CompilerAdapter adapter = new CustomAdapter();
+ adapter.setJavac(this);
+ if (adapter.execute()) {
+ // XXX updateDirList
+ } else {
+ // other modes not supported, see below
+ throw new BuildException("Compile failed; see the compiler error output for details.", getLocation());
+ }
+ }
+ }
+
+ @Override
+ public void setErrorProperty(String errorProperty) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setUpdatedProperty(String updatedProperty) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setFailonerror(boolean fail) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ private static class CustomAdapter extends DefaultCompilerAdapter {
+
+ public boolean execute() throws BuildException {
+ // adapted from Javac13
+ Commandline cmd = setupModernJavacCommand();
+ try {
+ Path cp = ((CustomJavac) getJavac()).javacClasspath;
+ ClassLoader cl = new AntClassLoader(getJavac().getProject(), cp);
+ Class c = Class.forName("com.sun.tools.javac.Main", true, cl);
+ getJavac().log("Running javac from " + c.getProtectionDomain().getCodeSource().getLocation(), Project.MSG_VERBOSE);
+ Method compile = c.getMethod("compile", String[].class);
+ int result = (Integer) compile.invoke(null, (Object) cmd.getArguments());
+ return result == 0;
+ } catch (Exception ex) {
+ throw new BuildException("Error starting compiler: " + ex, ex, location);
+ }
+ }
+
+ }
+
+}
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java b/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java
--- a/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/ParseProjectXml.java
@@ -839,10 +839,8 @@
throw new BuildException("The module " + depJar + " has no public packages and so cannot be compiled against", getLocation());
} else if (pubpkgs != null && !runtime && publicPackageJarDir != null) {
File splitJar = createPublicPackageJar(additions, pubpkgs, publicPackageJarDir, cnb);
- if (splitJar != null) {
- additions.clear();
- additions.add(splitJar);
- }
+ additions.clear();
+ additions.add(splitJar);
}
}
@@ -1254,16 +1252,6 @@
ZipEntry inEntry;
while ((inEntry = zis.getNextEntry()) != null) {
String path = inEntry.getName();
- if (path.matches("META-INF/services/(com\\.sun\\.mirror\\.apt\\.AnnotationProcessorFactory|javax\\.annotation\\.processing\\.Processor)")) {
- // An annotation processor is called by the compiler,
- // so needs to be present in the classpath of the module depending on it.
- // Not just the registration but the implementation need to be available;
- // and any classes that the impl depends on as well.
- // Since this all would be hard to compute, best to just leave the classpath untouched.
- os.close();
- ppjar.delete();
- return null;
- }
if (!addedPaths.add(path)) {
continue;
}
diff --git a/nbbuild/jdk.xml b/nbbuild/jdk.xml
--- a/nbbuild/jdk.xml
+++ b/nbbuild/jdk.xml
@@ -102,7 +102,12 @@
-
+
+
+
+
+
+
diff --git a/nbbuild/templates/common.xml b/nbbuild/templates/common.xml
--- a/nbbuild/templates/common.xml
+++ b/nbbuild/templates/common.xml
@@ -72,6 +72,7 @@
+
@@ -101,6 +102,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -122,11 +142,11 @@
-
-
+
@@ -158,12 +178,12 @@
-
-
+
@@ -424,12 +444,12 @@
-
-
+
@@ -488,12 +508,12 @@
-
-
+
diff --git a/nbbuild/templates/projectized.xml b/nbbuild/templates/projectized.xml
--- a/nbbuild/templates/projectized.xml
+++ b/nbbuild/templates/projectized.xml
@@ -46,7 +46,7 @@
-
+
@@ -145,10 +145,6 @@
-
-
-
-
@@ -161,6 +157,13 @@
+
+
+
+
+
+
+
@@ -458,7 +461,6 @@
-
@@ -580,7 +582,6 @@
-
@@ -650,7 +651,6 @@
-