You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by po...@apache.org on 2017/09/03 17:33:39 UTC
[46/51] [partial] incubator-netbeans-jackpot30 git commit:
INFRA-15006 Import for http://bits.netbeans.org/download/apache-donation
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/nbproject/project.xml
----------------------------------------------------------------------
diff --git a/cmdline/lib/nbproject/project.xml b/cmdline/lib/nbproject/project.xml
new file mode 100644
index 0000000..fdc7ce5
--- /dev/null
+++ b/cmdline/lib/nbproject/project.xml
@@ -0,0 +1,306 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
+
+Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+Other names may be trademarks of their respective owners.
+
+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. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle 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]"
+
+Contributor(s):
+
+The Original Software is NetBeans. The Initial Developer of the Original
+Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
+Microsystems, Inc. All Rights Reserved.
+
+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.
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.jackpot30.cmdline.lib</code-name-base>
+ <suite-component/>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.netbeans.api.annotations.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.4</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.java.classpath</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.20</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.libs.javacapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>0.9.0.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.libs.javacimpl</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.diff</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.editor.document</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.4.0.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.12</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.editor.tools.storage</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.6</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.jackpot30.remoting.api</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.hints</code-name-base>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.64.0.13.9.1.20.6.1.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.6</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.source</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.lexer</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>1.31.0.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.parsing.indexing</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.8.1.7.2</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.spi.java.hints</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.25.0.1.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.text</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.24</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.lookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.1</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <test-dependencies>
+ <test-type>
+ <name>unit</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.bootstrap</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.core.startup</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.insane</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.junit4</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.classfile</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.editor.mimelookup.impl</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.jackpot30.common</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
+ <recursive/>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.java.hints</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.masterfs</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.parsing.nb</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.projectui</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ </test-type>
+ </test-dependencies>
+ <public-packages/>
+ </data>
+ </configuration>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/nbproject/suite.properties
----------------------------------------------------------------------
diff --git a/cmdline/lib/nbproject/suite.properties b/cmdline/lib/nbproject/suite.properties
new file mode 100644
index 0000000..942e12b
--- /dev/null
+++ b/cmdline/lib/nbproject/suite.properties
@@ -0,0 +1,42 @@
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 2009-2017 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle 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]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original
+# Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
+# Microsystems, Inc. All Rights Reserved.
+#
+# 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.
+suite.dir=${basedir}/..
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/Bundle.properties
----------------------------------------------------------------------
diff --git a/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/Bundle.properties b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/Bundle.properties
new file mode 100644
index 0000000..e64e581
--- /dev/null
+++ b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/Bundle.properties
@@ -0,0 +1,39 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 2009-2010 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 2009-2010 Sun Microsystems, Inc.
+#
+OpenIDE-Module-Name=Jackpot 3.0 Command Line Lib
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/DumpHints.java
----------------------------------------------------------------------
diff --git a/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/DumpHints.java b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/DumpHints.java
new file mode 100644
index 0000000..ba2a6b9
--- /dev/null
+++ b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/DumpHints.java
@@ -0,0 +1,77 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2010 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 2010 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.jackpot30.cmdline.lib;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import org.codeviation.pojson.Pojson;
+import org.netbeans.modules.java.hints.providers.spi.HintMetadata;
+import org.netbeans.modules.java.hints.spiimpl.RulesManager;
+
+/**
+ *
+ * @author lahvac
+ */
+public class DumpHints {
+
+ public static String dumpHints() {
+ List<Map<String, String>> data = new LinkedList<Map<String, String>>();
+
+ for (HintMetadata hm : RulesManager.getInstance().readHints(null, null, null).keySet()) {
+ Map<String, String> hintData = new HashMap<String, String>();
+
+ hintData.put("id", hm.id);
+ hintData.put("category", hm.category);
+ hintData.put("displayName", hm.displayName);
+ hintData.put("description", hm.description);
+ hintData.put("enabled", Boolean.toString(hm.enabled));
+
+ data.add(hintData);
+ }
+
+ return Pojson.save(data);
+ }
+
+ public static void main(String[] args) {
+ System.out.println(dumpHints());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/NonNBComputer.java
----------------------------------------------------------------------
diff --git a/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/NonNBComputer.java b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/NonNBComputer.java
new file mode 100644
index 0000000..c3f478e
--- /dev/null
+++ b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/NonNBComputer.java
@@ -0,0 +1,132 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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 2010 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.modules.jackpot30.cmdline.lib;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.netbeans.api.java.classpath.ClassPath;
+import org.netbeans.api.java.source.ClasspathInfo;
+import org.netbeans.api.java.source.CompilationController;
+import org.netbeans.api.java.source.JavaSource;
+import org.netbeans.api.java.source.Task;
+import org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker;
+import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings;
+import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
+import org.netbeans.spi.editor.hints.ErrorDescription;
+import org.netbeans.spi.java.classpath.support.ClassPathSupport;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.URLMapper;
+
+/**
+ *
+ * @author lahvac
+ */
+public class NonNBComputer {
+
+ public static Map<URL, List<List<Object>>> compute(List<URL> bootCPList, List<URL> compileCPList, List<URL> sourceCPList, List<URL> sourceFilesList, final AtomicBoolean cancel) throws IOException {
+ ClassPath bootCP = ClassPathSupport.createClassPath(bootCPList.toArray(new URL[0]));
+ ClassPath compileCP = ClassPathSupport.createClassPath(compileCPList.toArray(new URL[0]));
+ ClassPath sourceCP = ClassPathSupport.createClassPath(sourceCPList.toArray(new URL[0]));
+
+ List<FileObject> sourceFiles = new LinkedList<FileObject>();
+
+ for (URL sf : sourceFilesList) {
+ sourceFiles.add(URLMapper.findFileObject(sf));
+ }
+
+ ClasspathInfo cpInfo = ClasspathInfo.create(bootCP, compileCP, sourceCP);
+ final Map<URL, List<List<Object>>> result = new HashMap<URL, List<List<Object>>>();
+
+ JavaSource.create(cpInfo, sourceFiles).runUserActionTask(new Task<CompilationController>() {
+
+ @Override
+ public void run(CompilationController parameter) throws Exception {
+ if (parameter.toPhase(JavaSource.Phase.RESOLVED).compareTo(JavaSource.Phase.RESOLVED) < 0) {
+ return;
+ }
+
+ List<ErrorDescription> eds = new HintsInvoker(HintsSettings.getSettingsFor(parameter.getFileObject()), cancel).computeHints(parameter);
+ List<List<Object>> currentResult = new LinkedList<List<Object>>();
+
+ if (eds != null) {
+ for (ErrorDescription ed : eds) {
+ currentResult.add(Arrays.<Object>asList(ed.getDescription(), ed.getRange().getBegin().getOffset(), ed.getRange().getEnd().getOffset()));
+ }
+ }
+
+ result.put(parameter.getFileObject().getURL(), currentResult);
+ }
+ }, true);
+
+ return result;
+ }
+
+ static {
+ try {
+ File tmp = File.createTempFile("jackpot30", null);
+
+ tmp.delete();
+ tmp.mkdirs();
+ tmp.deleteOnExit();
+
+ tmp = FileUtil.normalizeFile(tmp);
+ FileUtil.refreshFor(tmp.getParentFile());
+
+ org.openide.filesystems.FileObject tmpFO = FileUtil.toFileObject(tmp);
+
+ if (tmpFO != null) {
+ CacheFolder.setCacheFolder(tmpFO);
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/StandaloneTools.java
----------------------------------------------------------------------
diff --git a/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/StandaloneTools.java b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/StandaloneTools.java
new file mode 100644
index 0000000..d49b398
--- /dev/null
+++ b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/StandaloneTools.java
@@ -0,0 +1,378 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009-2010 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 2009-2010 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.jackpot30.cmdline.lib;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.prefs.AbstractPreferences;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+import java.util.prefs.PreferencesFactory;
+import javax.swing.event.ChangeListener;
+import javax.swing.text.Document;
+import org.netbeans.api.editor.mimelookup.MimePath;
+import org.netbeans.api.java.classpath.ClassPath;
+import org.netbeans.api.java.queries.SourceForBinaryQuery;
+import org.netbeans.api.java.source.ClasspathInfo;
+import org.netbeans.modules.java.hints.spiimpl.Utilities.SPI;
+import org.netbeans.modules.java.hints.spiimpl.options.HintsSettings.GlobalSettingsProvider;
+import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
+import org.netbeans.modules.java.source.parsing.JavacParser;
+import org.netbeans.modules.java.source.parsing.JavacParserFactory;
+import org.netbeans.modules.parsing.impl.indexing.implspi.ActiveDocumentProvider;
+import org.netbeans.spi.editor.document.EditorMimeTypesImplementation;
+import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
+import org.netbeans.spi.java.classpath.support.ClassPathSupport;
+import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation;
+import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation2;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.MIMEResolver;
+import org.openide.filesystems.MultiFileSystem;
+import org.openide.filesystems.Repository;
+import org.openide.filesystems.XMLFileSystem;
+import org.openide.util.Lookup;
+import org.openide.util.NbPreferences;
+import org.openide.util.NbPreferences.Provider;
+import org.openide.util.lookup.Lookups;
+import org.openide.util.lookup.ServiceProvider;
+
+/**XXX: should not include JavaCustomIndexer for tools that do not strictly require it
+ *
+ * @author lahvac
+ */
+public class StandaloneTools {
+
+ @ServiceProvider(service=MimeDataProvider.class)
+ public static final class StandaloneMimeDataProviderImpl implements MimeDataProvider {
+
+ private static final Lookup L = Lookups.fixed(NbPreferences.forModule(StandaloneTools.class), new JavacParserFactory(), new JavaCustomIndexer.Factory(), new GlobalSettingsProvider());
+
+ public Lookup getLookup(MimePath mimePath) {
+ if ("text/x-java".equals(mimePath.getPath()))
+ return L;
+ return null;
+ }
+
+ }
+
+ @ServiceProvider(service=SourceForBinaryQueryImplementation.class, position=0)
+ public static final class EmptySourceForBinaryQueryImpl implements SourceForBinaryQueryImplementation2 {
+ public Result findSourceRoots2(URL binaryRoot) {
+ return INSTANCE;
+ }
+ public SourceForBinaryQuery.Result findSourceRoots(URL binaryRoot) {
+ return findSourceRoots2(binaryRoot);
+ }
+ private static final Result INSTANCE = new Result() {
+ public boolean preferSources() {
+ return false;
+ }
+ public org.openide.filesystems.FileObject[] getRoots() {
+ return new org.openide.filesystems.FileObject[0];
+ }
+ public void addChangeListener(ChangeListener l) {}
+ public void removeChangeListener(ChangeListener l) {}
+ };
+ }
+
+ @ServiceProvider(service=Provider.class, position=0)
+ public static class PreferencesProvider implements Provider {
+
+ private final MemoryPreferencesFactory f;
+
+ public PreferencesProvider() {
+ this.f = new MemoryPreferencesFactory();
+ }
+
+ @Override
+ public Preferences preferencesForModule(Class cls) {
+ return f.userRoot().node(cls.getPackage().getName());
+ }
+
+ @Override
+ public Preferences preferencesRoot() {
+ return f.userRoot();
+ }
+
+ }
+ //copied from NB junit:
+ public static class MemoryPreferencesFactory implements PreferencesFactory {
+ /** Creates a new instance */
+ public MemoryPreferencesFactory() {}
+
+ public Preferences userRoot() {
+ return NbPreferences.userRootImpl();
+ }
+
+ public Preferences systemRoot() {
+ return NbPreferences.systemRootImpl();
+ }
+
+ private static class NbPreferences extends AbstractPreferences {
+ private static Preferences USER_ROOT;
+ private static Preferences SYSTEM_ROOT;
+
+ /*private*/Properties properties;
+
+ static Preferences userRootImpl() {
+ if (USER_ROOT == null) {
+ USER_ROOT = new NbPreferences();
+ }
+ return USER_ROOT;
+ }
+
+ static Preferences systemRootImpl() {
+ if (SYSTEM_ROOT == null) {
+ SYSTEM_ROOT = new NbPreferences();
+ }
+ return SYSTEM_ROOT;
+ }
+
+
+ private NbPreferences() {
+ super(null, "");
+ }
+
+ /** Creates a new instance of PreferencesImpl */
+ private NbPreferences(NbPreferences parent, String name) {
+ super(parent, name);
+ newNode = true;
+ }
+
+ protected final String getSpi(String key) {
+ return properties().getProperty(key);
+ }
+
+ protected final String[] childrenNamesSpi() throws BackingStoreException {
+ return new String[0];
+ }
+
+ protected final String[] keysSpi() throws BackingStoreException {
+ return properties().keySet().toArray(new String[0]);
+ }
+
+ protected final void putSpi(String key, String value) {
+ properties().put(key,value);
+ }
+
+ protected final void removeSpi(String key) {
+ properties().remove(key);
+ }
+
+ protected final void removeNodeSpi() throws BackingStoreException {}
+ protected void flushSpi() throws BackingStoreException {}
+ protected void syncSpi() throws BackingStoreException {
+ properties().clear();
+ }
+
+ @Override
+ public void put(String key, String value) {
+ try {
+ super.put(key, value);
+ } catch (IllegalArgumentException iae) {
+ if (iae.getMessage().contains("too long")) {
+ // Not for us!
+ putSpi(key, value);
+ } else {
+ throw iae;
+ }
+ }
+ }
+
+ Properties properties() {
+ if (properties == null) {
+ properties = new Properties();
+ }
+ return properties;
+ }
+
+ protected AbstractPreferences childSpi(String name) {
+ return new NbPreferences(this, name);
+ }
+ }
+
+ }
+
+ @ServiceProvider(service=Repository.class)
+ public static class RepositoryImpl extends Repository {
+
+ public RepositoryImpl() {
+ super(createDefaultFS());
+ }
+
+ private static FileSystem createDefaultFS() {
+ try {
+ List<URL> layers = new LinkedList<URL>();
+ boolean found = false;
+
+ for (Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources("META-INF/generated-layer.xml"); en.hasMoreElements();) {
+ found = true;
+ layers.add(en.nextElement());
+ }
+
+ assert found;
+
+ System.err.println("layers=" + layers);
+
+ XMLFileSystem xmlFS = new XMLFileSystem();
+
+ xmlFS.setXmlUrls(layers.toArray(new URL[0]));
+
+ return new MultiFileSystem(new FileSystem[]{FileUtil.createMemoryFileSystem(), xmlFS});
+ } catch (PropertyVetoException ex) {
+ throw new IllegalStateException(ex);
+ } catch (IOException ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+ }
+
+ @ServiceProvider(service=SPI.class, position=0)
+ public static class UtilitiesSPIImpl implements SPI {
+
+ @Override
+ public ClasspathInfo createUniversalCPInfo() {
+ return ClasspathInfo.create(sysProp2CP("sun.boot.class.path"), ClassPath.EMPTY, ClassPath.EMPTY);
+ }
+
+ }
+
+ //Copied from FallbackDefaultJavaPlatform:
+ private static ClassPath sysProp2CP(String propname) {
+ String sbcp = System.getProperty(propname);
+ if (sbcp == null) {
+ return null;
+ }
+ List<URL> roots = new ArrayList<URL>();
+ StringTokenizer tok = new StringTokenizer(sbcp, File.pathSeparator);
+ while (tok.hasMoreTokens()) {
+ File f = new File(tok.nextToken());
+ if (!f.exists()) {
+ continue;
+ }
+ f = FileUtil.normalizeFile(f);
+ URL u;
+ try {
+ u = f.toURI().toURL();
+ } catch (MalformedURLException x) {
+ throw new AssertionError(x);
+ }
+ if (FileUtil.isArchiveFile(u)) {
+ u = FileUtil.getArchiveRoot(u);
+ }
+ roots.add(u);
+ }
+ return ClassPathSupport.createClassPath(roots.toArray(new URL[roots.size()]));
+ }
+
+ @ServiceProvider(service=MIMEResolver.class)
+ public static final class JavaMimeResolver extends MIMEResolver {
+
+ public JavaMimeResolver() {
+ super(JavacParser.MIME_TYPE);
+ }
+
+ @Override
+ public String findMIMEType(FileObject fo) {
+ if ("java".equals(fo.getExt())) {
+ return JavacParser.MIME_TYPE;
+ }
+
+ return null;
+ }
+
+ }
+
+ @ServiceProvider(service=ActiveDocumentProvider.class)
+ public static final class ActiveDocumentProviderImpl implements ActiveDocumentProvider {
+
+ @Override
+ public Document getActiveDocument() {
+ return null;
+ }
+
+ @Override
+ public Set<? extends Document> getActiveDocuments() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public void addActiveDocumentListener(ActiveDocumentListener listener) {
+ }
+
+ @Override
+ public void removeActiveDocumentListener(ActiveDocumentListener listener) {
+ }
+
+ }
+
+ @ServiceProvider(service=EditorMimeTypesImplementation.class)
+ public static final class EditorMimeTypesImplementationImpl implements EditorMimeTypesImplementation {
+
+ private static final Set<String> MIME_TYPES = Collections.singleton("text/x-java");
+
+ @Override
+ public Set<String> getSupportedMimeTypes() {
+ return MIME_TYPES;
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/Utils.java
----------------------------------------------------------------------
diff --git a/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/Utils.java b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/Utils.java
new file mode 100644
index 0000000..fa98d15
--- /dev/null
+++ b/cmdline/lib/src/org/netbeans/modules/jackpot30/cmdline/lib/Utils.java
@@ -0,0 +1,94 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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 2015 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.jackpot30.cmdline.lib;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.netbeans.modules.java.hints.providers.spi.HintDescription;
+
+/**
+ *
+ * @author lahvac
+ */
+public class Utils {
+
+ public static Map<String, String> computeId2DisplayName(Iterable<? extends HintDescription> descs) {
+ final Map<String, String> id2DisplayName = new HashMap<>();
+
+ for (HintDescription hd : descs) {
+ if (hd.getMetadata() != null) {
+ id2DisplayName.put(hd.getMetadata().id, hd.getMetadata().displayName);
+ }
+ }
+
+ return id2DisplayName;
+ }
+
+ public static String categoryName(String id, Map<String, String> id2DisplayName) {
+ if (id != null && id.startsWith("text/x-java:")) {
+ id = id.substring("text/x-java:".length());
+ }
+
+ String idDisplayName = id2DisplayName.get(id);
+
+ if (idDisplayName == null) {
+ idDisplayName = "unknown";
+ }
+
+ for (Entry<String, String> remap : toIdRemap.entrySet()) {
+ idDisplayName = idDisplayName.replace(remap.getKey(), remap.getValue());
+ }
+
+ idDisplayName = idDisplayName.replaceAll("[^A-Za-z0-9]", "_").replaceAll("_+", "_");
+
+ idDisplayName = "[" + idDisplayName + "] ";
+
+ return idDisplayName;
+ }
+
+ private static final Map<String, String> toIdRemap = new HashMap<String, String>() {{
+ put("==", "equals");
+ put("!=", "not_equals");
+ }};
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateAPLibJar.java
----------------------------------------------------------------------
diff --git a/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateAPLibJar.java b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateAPLibJar.java
new file mode 100644
index 0000000..e600151
--- /dev/null
+++ b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateAPLibJar.java
@@ -0,0 +1,62 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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 2010 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.modules.jackpot30.cmdline.lib;
+
+import org.netbeans.modules.editor.tools.storage.api.ToolPreferences;
+
+/**
+ *
+ * @author lahvac
+ */
+public class CreateAPLibJar extends CreateStandaloneLibJarNoEscape {
+
+ public CreateAPLibJar(String name) {
+ super(name, "jackpot-ap-lib");
+ }
+
+ @Override
+ protected Info computeInfo() {
+ return super.computeInfo().addAdditionalRoots(ToolPreferences.class.getName()).setEscapeJavaxLang();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java
----------------------------------------------------------------------
diff --git a/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java
new file mode 100644
index 0000000..461b9ec
--- /dev/null
+++ b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java
@@ -0,0 +1,579 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009-2010 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 2009-2010 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.jackpot30.cmdline.lib;
+
+import com.sun.source.tree.Tree;
+import com.sun.tools.javac.api.JavacTool;
+import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
+import org.apache.lucene.analysis.tokenattributes.OffsetAttributeImpl;
+import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttributeImpl;
+import org.apache.lucene.analysis.tokenattributes.TermAttributeImpl;
+import org.netbeans.api.java.source.JavaSource;
+import org.netbeans.junit.NbTestCase;
+import org.netbeans.modules.classfile.ClassFile;
+import org.netbeans.modules.classfile.ClassName;
+import org.netbeans.modules.editor.mimelookup.MimeLookupCacheSPI;
+import org.netbeans.modules.editor.mimelookup.SharedMimeLookupCache;
+import org.netbeans.modules.jackpot30.cmdline.lib.StandaloneTools.ActiveDocumentProviderImpl;
+import org.netbeans.modules.jackpot30.cmdline.lib.StandaloneTools.EditorMimeTypesImplementationImpl;
+import org.netbeans.modules.jackpot30.cmdline.lib.StandaloneTools.JavaMimeResolver;
+import org.netbeans.modules.jackpot30.cmdline.lib.StandaloneTools.RepositoryImpl;
+import org.netbeans.modules.jackpot30.common.api.IndexAccess;
+import org.netbeans.modules.java.classpath.DefaultGlobalPathRegistryImplementation;
+import org.netbeans.modules.java.hints.StandardJavacWarnings.CompilerSettingsImpl;
+import org.netbeans.modules.java.hints.declarative.DeclarativeHintRegistry;
+import org.netbeans.modules.java.hints.providers.code.CodeHintProviderImpl;
+import org.netbeans.modules.java.hints.providers.code.FSWrapper;
+import org.netbeans.modules.java.hints.providers.code.FSWrapper.MethodWrapper;
+import org.netbeans.modules.java.hints.providers.spi.ClassPathBasedHintProvider;
+import org.netbeans.modules.java.hints.providers.spi.HintProvider;
+import org.netbeans.modules.java.hints.spiimpl.RulesManager;
+import org.netbeans.modules.java.hints.spiimpl.RulesManagerImpl;
+import org.netbeans.modules.java.hints.spiimpl.Utilities.SPI;
+import org.netbeans.modules.java.source.DefaultPositionRefProvider;
+import org.netbeans.modules.java.source.PositionRefProvider;
+import org.netbeans.modules.java.source.tasklist.CompilerSettings;
+import org.netbeans.modules.openide.util.DefaultMutexImplementation;
+import org.netbeans.modules.openide.util.NbMutexEventProvider;
+import org.netbeans.modules.parsing.impl.IndexerBridge;
+import org.netbeans.modules.parsing.impl.indexing.IndexerControl;
+import org.netbeans.modules.parsing.impl.indexing.implspi.ActiveDocumentProvider;
+import org.netbeans.modules.parsing.implspi.EnvironmentFactory;
+import org.netbeans.modules.parsing.nb.DataObjectEnvFactory;
+import org.netbeans.modules.projectapi.nb.NbProjectManager;
+import org.netbeans.spi.editor.document.EditorMimeTypesImplementation;
+import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
+import org.netbeans.spi.java.classpath.GlobalPathRegistryImplementation;
+import org.netbeans.spi.java.hints.Hint;
+import org.netbeans.spi.project.ProjectManagerImplementation;
+import org.openide.filesystems.MIMEResolver;
+import org.openide.util.NbCollections;
+import org.openide.util.NbPreferences.Provider;
+import org.openide.util.spi.MutexEventProvider;
+import org.openide.util.spi.MutexImplementation;
+import org.openide.xml.EntityCatalog;
+import org.openide.xml.XMLUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author lahvac
+ */
+public abstract class CreateStandaloneJar extends NbTestCase {
+ private final String toolName;
+
+ public CreateStandaloneJar(String name, String toolName) {
+ super(name);
+ this.toolName = toolName;
+ }
+
+ public void testDumpImportantHack() throws Exception {
+ String targetDir = System.getProperty("outputDir", System.getProperty("java.io.tmpdir"));
+ String targetName = System.getProperty("targetName", toolName + ".jar");
+
+ createCompiler(new File(targetDir, targetName), new File(targetDir, "hints"));
+ }
+
+ protected abstract Info computeInfo();
+
+ public void createCompiler(File targetCompilerFile, File targetHintsFile) throws Exception {
+ Map<String, byte[]> out = new TreeMap<>();
+ List<String> toProcess = new LinkedList<String>(INCLUDE);
+
+ for (FSWrapper.ClassWrapper cw : FSWrapper.listClasses()) {
+ toProcess.add(cw.getName());
+
+ //XXX: CodeHintProviderImpl currently resolves customizer providers eagerly,
+ //so need to copy them as well, even though these won't be normally used:
+ Hint ch = cw.getAnnotation(Hint.class);
+
+ if (ch != null) {
+ toProcess.add(ch.customizerProvider().getName());
+ }
+
+ for (MethodWrapper mw : cw.getMethods()) {
+ Hint mh = mw.getAnnotation(Hint.class);
+
+ if (mh != null) {
+ toProcess.add(mh.customizerProvider().getName());
+ }
+ }
+ }
+
+ Info info = computeInfo();
+
+ toProcess.addAll(info.additionalRoots);
+
+ Set<String> done = new HashSet<String>();
+ Set<String> bundlesToCopy = new HashSet<String>();
+
+ OUTER: while (!toProcess.isEmpty()) {
+ String fqn = toProcess.remove(0);
+
+ if (!done.add(fqn)) {
+ continue;
+ }
+
+ for (Pattern p : info.exclude) {
+ if (p.matcher(fqn).matches()) continue OUTER;
+ }
+
+// System.err.println("processing: " + fqn);
+
+ String fileName = fqn.replace('.', '/') + ".class";
+ URL url = this.getClass().getClassLoader().getResource(fileName);
+
+ if (url == null) {
+ //probably array:
+ continue;
+ }
+
+ Class<?> clazz = Class.forName(fqn, false, this.getClass().getClassLoader());
+
+ if ( clazz.getProtectionDomain().getCodeSource() == null
+ && !clazz.getName().startsWith("com.sun.source")
+ && !clazz.getName().startsWith("com.sun.javadoc")
+ && !clazz.getName().startsWith("com.sun.tools")
+ && !clazz.getName().startsWith("javax.tools")
+ && !clazz.getName().startsWith("javax.annotation.processing")
+ && !clazz.getName().startsWith("javax.lang.model")) {
+ //probably platform class:
+ continue;
+ }
+
+ byte[] bytes = readFile(url);
+
+ ClassFile cf = new ClassFile(new ByteArrayInputStream(bytes));
+
+ for (ClassName classFromCP : cf.getConstantPool().getAllClassNames()) {
+ toProcess.add(classFromCP.getInternalName().replace('/', '.'));
+ }
+
+ out.put(escapeJavaxLang(info, fileName), escapeJavaxLang(info, bytes));
+
+ if (COPY_REGISTRATION.contains(fqn) || info.copyMetaInfRegistration.contains(fqn)) {
+ String serviceName = "META-INF/services/" + fqn;
+ Enumeration<URL> resources = this.getClass().getClassLoader().getResources(serviceName);
+
+ if (resources.hasMoreElements()) {
+ try (ByteArrayOutputStream buffer = new ByteArrayOutputStream()) {
+ while (resources.hasMoreElements()) {
+ URL res = resources.nextElement();
+
+ buffer.write(readFile(res));
+ }
+
+ out.put(escapeJavaxLang(info, serviceName), buffer.toByteArray());
+ }
+
+ }
+ }
+
+ int lastSlash = fileName.lastIndexOf('/');
+
+ if (lastSlash > 0) {
+ bundlesToCopy.add(fileName.substring(0, lastSlash + 1) + "Bundle.properties");
+ }
+ }
+
+ bundlesToCopy.addAll(RESOURCES);
+ bundlesToCopy.addAll(info.additionalResources);
+ copyResources(out, info, bundlesToCopy);
+
+ //generated-layer.xml:
+ List<URL> layers2Merge = new ArrayList<URL>();
+ List<String> layerNames = new ArrayList<String>();
+
+ layerNames.add("META-INF/generated-layer.xml");
+ layerNames.addAll(info.additionalLayers);
+
+ for (String layerName : layerNames) {
+ for (URL layerURL : NbCollections.iterable(this.getClass().getClassLoader().getResources(layerName))) {
+ layers2Merge.add(layerURL);
+ }
+ }
+
+ Document main = null;
+
+ for (URL res : layers2Merge) {
+ Document current = XMLUtil.parse(new InputSource(res.openStream()), false, false, null, new EntityCatalog() {
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+ return new InputSource(CreateStandaloneJar.class.getResourceAsStream("/org/openide/filesystems/filesystem1_2.dtd"));
+ }
+ });
+
+ if (main == null) {
+ main = current;
+ } else {
+ NodeList children = current.getDocumentElement().getChildNodes();
+
+ for (int i = 0; i < children.getLength(); i++) {
+ main.getDocumentElement().appendChild(main.importNode(children.item(i), true));
+ }
+ }
+ }
+
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ XMLUtil.write(main, bytes, "UTF-8");
+ bytes.close();
+ out.put(escapeJavaxLang(info, "META-INF/generated-layer.xml"), escapeJavaxLang(info, bytes.toByteArray()));
+
+ List<MetaInfRegistration> registrations = new ArrayList<MetaInfRegistration>();
+
+ registrations.add(new MetaInfRegistration("java.lang.SecurityManager", "org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager"));
+ registrations.add(new MetaInfRegistration("org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation", StandaloneTools.EmptySourceForBinaryQueryImpl.class.getName(), 0));
+ registrations.add(new MetaInfRegistration(Provider.class.getName(), StandaloneTools.PreferencesProvider.class.getName(), 0));
+ registrations.add(new MetaInfRegistration(MimeDataProvider.class.getName(), StandaloneTools.StandaloneMimeDataProviderImpl.class.getName()));
+ registrations.add(new MetaInfRegistration(SPI.class.getName(), StandaloneTools.UtilitiesSPIImpl.class.getName()));
+ registrations.add(new MetaInfRegistration(MIMEResolver.class.getName(), JavaMimeResolver.class.getName()));
+ registrations.add(new MetaInfRegistration(ActiveDocumentProvider.class.getName(), ActiveDocumentProviderImpl.class.getName()));
+ registrations.add(new MetaInfRegistration(EditorMimeTypesImplementation.class.getName(), EditorMimeTypesImplementationImpl.class.getName()));
+ registrations.add(new MetaInfRegistration(PositionRefProvider.Factory.class.getName(), DefaultPositionRefProvider.FactoryImpl.class.getName()));
+ registrations.add(new MetaInfRegistration(CompilerSettings.class.getName(), CompilerSettingsImpl.class.getName()));
+ registrations.add(new MetaInfRegistration(MutexImplementation.class.getName(), DefaultMutexImplementation.class.getName()));
+ registrations.add(new MetaInfRegistration(MutexEventProvider.class.getName(), NbMutexEventProvider.class.getName()));
+ registrations.addAll(info.metaInf);
+
+ Map<String, Collection<MetaInfRegistration>> api2Registrations = new HashMap<String, Collection<MetaInfRegistration>>();
+
+ for (MetaInfRegistration r : registrations) {
+ Collection<MetaInfRegistration> regs = api2Registrations.get(r.apiClassName);
+
+ if (regs == null) {
+ api2Registrations.put(r.apiClassName, regs = new ArrayList<MetaInfRegistration>());
+ }
+
+ regs.add(r);
+ }
+
+ for (Entry<String, Collection<MetaInfRegistration>> e : api2Registrations.entrySet()) {
+ addMETA_INFRegistration(out, info, e.getValue());
+ }
+
+ try (JarOutputStream outStream = new JarOutputStream(new FileOutputStream(targetCompilerFile))) {
+ Set<String> seenDirs = new HashSet<>();
+ for (Entry<String, byte[]> e : out.entrySet()) {
+ String[] parts = e.getKey().split("/");
+ StringBuilder dir = new StringBuilder();
+ for (int i = 0; i < parts.length - 1; i++) {
+ dir.append(parts[i]);
+ dir.append("/");
+ if (seenDirs.add(dir.toString()))
+ outStream.putNextEntry(new ZipEntry(dir.toString()));
+ }
+ outStream.putNextEntry(new ZipEntry(e.getKey()));
+ outStream.write(e.getValue());
+ }
+ }
+
+ Writer hints = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetHintsFile), "UTF-8"));
+
+// hints.write(DumpHints.dumpHints());
+
+ hints.close();
+ }
+
+ public static final class Info {
+ private final Set<String> additionalRoots = new HashSet<String>();
+ private final Set<String> additionalResources = new HashSet<String>();
+ private final Set<String> additionalLayers = new HashSet<String>();
+ private final List<MetaInfRegistration> metaInf = new LinkedList<MetaInfRegistration>();
+ private final Set<String> copyMetaInfRegistration = new HashSet<String>();
+ private boolean escapeJavaxLang;
+ private final List<Pattern> exclude = new LinkedList<Pattern>();
+ public Info() {}
+ public Info addAdditionalRoots(String... fqns) {
+ additionalRoots.addAll(Arrays.asList(fqns));
+ return this;
+ }
+ public Info addAdditionalResources(String... paths) {
+ additionalResources.addAll(Arrays.asList(paths));
+ return this;
+ }
+ public Info addAdditionalLayers(String... paths) {
+ additionalLayers.addAll(Arrays.asList(paths));
+ return this;
+ }
+ public Info addMetaInfRegistrations(MetaInfRegistration... registrations) {
+ metaInf.addAll(Arrays.asList(registrations));
+ return this;
+ }
+ public Info addMetaInfRegistrationToCopy(String... registrationsToCopy) {
+ copyMetaInfRegistration.addAll(Arrays.asList(registrationsToCopy));
+ return this;
+ }
+ public Info addExcludePattern(Pattern... pattern) {
+ exclude.addAll(Arrays.asList(pattern));
+ return this;
+ }
+ public Info setEscapeJavaxLang() {
+ this.escapeJavaxLang = true;
+ return this;
+ }
+ }
+
+ public static final class MetaInfRegistration {
+ private final String apiClassName;
+ private final String implClassName;
+ private final Integer pos;
+
+ public MetaInfRegistration(String apiClassName, String implClassName) {
+ this(apiClassName, implClassName, null);
+ }
+
+ public MetaInfRegistration(Class<?> apiClass, Class<?> implClass) {
+ this(apiClass.getName(), implClass.getName(), null);
+ }
+
+ public MetaInfRegistration(String apiClassName, String implClassName, Integer pos) {
+ this.apiClassName = apiClassName;
+ this.implClassName = implClassName;
+ this.pos = pos;
+ }
+
+ }
+
+ private void copyResources(Map<String, byte[]> out, Info info, Set<String> res) throws IOException {
+ for (String resource : res) {
+ URL url = this.getClass().getClassLoader().getResource(resource);
+
+ if (url == null) {
+ continue;
+ }
+
+ out.put(escapeJavaxLang(info, resource), readFile(url));
+ }
+ }
+
+ private static byte[] readFile(URL url) throws IOException {
+ InputStream ins = url.openStream();
+ ByteArrayOutputStream data = new ByteArrayOutputStream();
+
+ try {
+ int read;
+
+ while ((read = ins.read()) != (-1)) {
+ data.write(read);
+ }
+ } finally {
+ ins.close();
+ data.close();
+ }
+
+ return data.toByteArray();
+ }
+
+ private static void addMETA_INFRegistration(Map<String, byte[]> out, Info info, Iterable<MetaInfRegistration> registrations) throws IOException {
+ String apiClassName = registrations.iterator().next().apiClassName;
+
+ try (ByteArrayOutputStream buffer = new ByteArrayOutputStream()) {
+ for (MetaInfRegistration r : registrations) {
+ assert apiClassName.equals(r.apiClassName);
+ buffer.write(r.implClassName.getBytes("UTF-8"));
+ buffer.write("\n".getBytes("UTF-8"));
+ if (r.pos != null) {
+ buffer.write(("#position=" + r.pos.toString() + "\n").getBytes("UTF-8"));
+ }
+ }
+
+ out.put(escapeJavaxLang(info, "META-INF/services/" + apiClassName), buffer.toByteArray());
+ }
+ }
+
+ private static final Map<String, String> replaceWhat2With = new LinkedHashMap<String, String>();
+
+ static {
+ replaceWhat2With.put("javax/annotation/processing/", "jpt30/annotation/processing/");
+ replaceWhat2With.put("javax/lang/", "jpt30/lang/");
+ replaceWhat2With.put("javax/tools/", "jpt30/tools/");
+ replaceWhat2With.put("com/sun/tools/", "jpt/sun/tools/");
+ replaceWhat2With.put("com/sun/source/", "jpt/sun/source/");
+
+ for (String originalKey : new HashSet<>(replaceWhat2With.keySet())) {
+ replaceWhat2With.put(originalKey.replace('/', '.'), replaceWhat2With.get(originalKey).replace('/', '.'));
+ }
+ }
+
+
+ private static byte[] escapeJavaxLang(Info info, byte[] source) throws UnsupportedEncodingException {
+ if (!info.escapeJavaxLang) return source;
+
+ for (Entry<String, String> e : replaceWhat2With.entrySet()) {
+ byte[] replaceSource = e.getKey().getBytes("UTF-8");
+ byte[] replaceTarget = e.getValue().getBytes("UTF-8");
+
+ OUTER:
+ for (int i = 0; i < source.length - replaceSource.length; i++) {
+ for (int j = 0; j < replaceSource.length; j++) {
+ if (source[i + j] != replaceSource[j]) {
+ continue OUTER;
+ }
+ }
+
+ for (int j = 0; j < replaceTarget.length; j++) {
+ source[i + j] = replaceTarget[j];
+ }
+
+ i += replaceTarget.length - 1;
+ }
+ }
+
+ return source;
+ }
+
+ private static String escapeJavaxLang(Info info, String fileName) throws UnsupportedEncodingException {
+ if (!info.escapeJavaxLang) return fileName;
+
+ for (Entry<String, String> e : replaceWhat2With.entrySet()) {
+ fileName = fileName.replace(e.getKey(), e.getValue());
+ }
+
+ return fileName;
+ }
+
+
+
+ private static final Set<String> INCLUDE = new HashSet<String>(Arrays.asList(
+ StandaloneTools.class.getName(),
+ StandaloneTools.EmptySourceForBinaryQueryImpl.class.getName(),
+ StandaloneTools.PreferencesProvider.class.getName(),
+ StandaloneTools.StandaloneMimeDataProviderImpl.class.getName(),
+ CodeHintProviderImpl.class.getName(),
+ JavaSource.class.getName(),
+ DumpHints.class.getName(),
+ RepositoryImpl.class.getName(),
+ "org.netbeans.core.startup.layers.ArchiveURLMapper",
+ DeclarativeHintRegistry.class.getName(),
+ "org.netbeans.core.startup.layers.NbinstURLMapper",
+ "org.netbeans.modules.masterfs.MasterURLMapper",
+ "org.netbeans.core.NbLoaderPool",
+ "org.netbeans.core.startup.preferences.PreferencesProviderImpl",
+ "org.netbeans.modules.java.platform.DefaultJavaPlatformProvider",
+ IndexAccess.class.getName(),
+ RulesManagerImpl.class.getName(),
+
+ "com.sun.tools.javac.resources.compiler",
+ "com.sun.tools.javac.resources.javac",
+ TermAttributeImpl.class.getName(),
+ OffsetAttributeImpl.class.getName(),
+ PositionIncrementAttributeImpl.class.getName()
+
+
+ , "org.netbeans.modules.java.hints.legacy.spi.RulesManager$HintProviderImpl"
+ , Tree.class.getName()
+ ,JavacTool.class.getName()
+ ,JavaMimeResolver.class.getName()
+ , "org.netbeans.api.java.source.support.OpenedEditors",
+ SharedMimeLookupCache.class.getName(),
+ DataObjectEnvFactory.class.getName(),
+ NbProjectManager.class.getName(),
+ DefaultGlobalPathRegistryImplementation.class.getName(),
+ DefaultPositionRefProvider.FactoryImpl.class.getName(),
+ CompilerSettingsImpl.class.getName(),
+ NbMutexEventProvider.class.getName(),
+ DefaultMutexImplementation.class.getName(),
+ Utils.class.getName(),
+ IndexerControl.class.getName()
+ ));
+
+ private static final Set<String> COPY_REGISTRATION = new HashSet<String>(Arrays.<String>asList(
+ HintProvider.class.getName(),
+ "org.openide.filesystems.URLMapper",
+ "org.openide.util.Lookup",
+ "org.netbeans.modules.openide.util.PreferencesProvider",
+ ClassPathBasedHintProvider.class.getName(),
+ IndexAccess.class.getName(),
+ RulesManager.class.getName(),
+ MimeLookupCacheSPI.class.getName(),
+ EnvironmentFactory.class.getName(),
+ ProjectManagerImplementation.class.getName(),
+ GlobalPathRegistryImplementation.class.getName(),
+ IndexerBridge.class.getName()
+ ));
+
+ private static final Set<String> RESOURCES = new HashSet<String>(Arrays.asList(
+ "com/sun/tools/javac/resources/javac_zh_CN.properties",
+ "com/sun/tools/javac/resources/compiler_ja.properties",
+ "com/sun/tools/javac/resources/compiler_zh_CN.properties",
+ "com/sun/tools/javac/resources/legacy.properties",
+ "com/sun/tools/javac/resources/compiler.properties",
+ "com/sun/tools/javac/resources/javac_ja.properties",
+ "com/sun/tools/javac/resources/javac.properties",
+ "com/sun/tools/javadoc/resources/javadoc.properties",
+ "com/sun/tools/javadoc/resources/javadoc_ja.properties",
+ "com/sun/tools/javadoc/resources/javadoc_zh_CN.properties",
+ "org/netbeans/modules/java/source/resources/icons/error-badge.gif",
+ "org/netbeans/modules/java/source/resources/layer.xml",
+ "org/netbeans/modules/java/j2seproject/ui/resources/brokenProjectBadge.gif",
+ "org/netbeans/modules/java/j2seproject/ui/resources/compileOnSaveDisabledBadge.gif",
+ "org/netbeans/modules/parsing/impl/resources/error-badge.gif"
+ ));
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJar.java
----------------------------------------------------------------------
diff --git a/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJar.java b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJar.java
new file mode 100644
index 0000000..a364a77
--- /dev/null
+++ b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJar.java
@@ -0,0 +1,60 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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 2010 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.modules.jackpot30.cmdline.lib;
+
+/**
+ *
+ * @author lahvac
+ */
+public class CreateStandaloneLibJar extends CreateStandaloneLibJarNoEscape {
+
+ public CreateStandaloneLibJar(String name) {
+ super(name, "jackpot-lib");
+ }
+
+ @Override
+ protected Info computeInfo() {
+ return super.computeInfo().setEscapeJavaxLang();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-jackpot30/blob/9ed0a377/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJarNoEscape.java
----------------------------------------------------------------------
diff --git a/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJarNoEscape.java b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJarNoEscape.java
new file mode 100644
index 0000000..6fa24d7
--- /dev/null
+++ b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneLibJarNoEscape.java
@@ -0,0 +1,67 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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 2010 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.modules.jackpot30.cmdline.lib;
+
+import org.netbeans.modules.java.hints.declarative.PatternConvertorImpl;
+import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
+
+/**
+ *
+ * @author lahvac
+ */
+public class CreateStandaloneLibJarNoEscape extends CreateStandaloneJar {
+
+ public CreateStandaloneLibJarNoEscape(String name) {
+ this(name, "jackpot-lib-noescape");
+ }
+
+ protected CreateStandaloneLibJarNoEscape(String name, String libName) {
+ super(name, libName);
+ }
+
+ @Override
+ protected Info computeInfo() {
+ return new Info().addAdditionalRoots(NonNBComputer.class.getName(), PatternConvertorImpl.class.getName()).addMetaInfRegistrationToCopy(PatternConvertor.class.getName());
+ }
+
+}