[hg] main-silver: #246771: Replace reference to jfxrt.jar when c...

  • From: Jaroslav Tulach < >
  • To: , ,
  • Subject: [hg] main-silver: #246771: Replace reference to jfxrt.jar when c...
  • Date: Fri, 29 Aug 2014 16:44:26 +0000

changeset eec4dc845f03 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/eec4dc845f03
description:
        #246771: Replace reference to jfxrt.jar when computing classpath 
extensions

diffstat:

 apisupport.ant/test/unit/data/example-external-projects/javafx/build.xml     
                      |    8 +
 apisupport.ant/test/unit/data/example-external-projects/javafx/manifest.mf   
                      |    5 +
 
apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/build-impl.xml
            |   42 ++++
 
apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/genfiles.properties
       |    8 +
 
apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/platform.properties
       |   23 ++
 
apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/project.properties
        |    2 +
 
apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/project.xml
               |  102 ++++++++++
 
apisupport.ant/test/unit/data/example-external-projects/javafx/src/org/netbeans/test/fx/UseFx.java
 |   52 +++++
 
apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/UseFxTest.java
                |   99 +++++++++
 nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java                    
                      |   39 ++-
 10 files changed, 363 insertions(+), 17 deletions(-)

diffs (451 lines):

diff --git 
a/apisupport.ant/test/unit/data/example-external-projects/javafx/build.xml 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/build.xml
new file mode 100644
--- /dev/null
+++ b/apisupport.ant/test/unit/data/example-external-projects/javafx/build.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See harness/README in the NetBeans 
platform -->
+<!-- for some information on what you could do (e.g. targets to override). 
-->
+<!-- If you delete this file and reopen the project it will be recreated. -->
+<project name="com.controlsjs.netbeans.formeditor" default="netbeans" 
basedir=".">
+    <description>Builds, tests, and runs the project 
com.controlsjs.netbeans.formeditor.</description>
+    <import file="nbproject/build-impl.xml"/>
+</project>
diff --git 
a/apisupport.ant/test/unit/data/example-external-projects/javafx/manifest.mf 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/manifest.mf
new file mode 100644
--- /dev/null
+++ 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/manifest.mf
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+OpenIDE-Module: com.controlsjs.netbeans.formeditor
+OpenIDE-Module-Localizing-Bundle: 
com/controlsjs/netbeans/formeditor/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git 
a/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/build-impl.xml
 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/build-impl.xml
new file mode 100644
--- /dev/null
+++ 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/build-impl.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT  ***
+***         EDIT ../build.xml INSTEAD         ***
+-->
+<project name="com.controlsjs.netbeans.formeditor-impl" basedir="..">
+    <fail message="Please build using Ant 1.7.1 or higher.">
+        <condition>
+            <not>
+                <antversion atleast="1.7.1"/>
+            </not>
+        </condition>
+    </fail>
+    <property file="nbproject/private/platform-private.properties"/>
+    <property file="nbproject/platform.properties"/>
+    <macrodef name="property" 
uri="http://www.netbeans.org/ns/nb-module-project/2";>
+        <attribute name="name"/>
+        <attribute name="value"/>
+        <sequential>
+            <property name="@{name}" value="${@{value}}"/>
+        </sequential>
+    </macrodef>
+    <macrodef name="evalprops" 
uri="http://www.netbeans.org/ns/nb-module-project/2";>
+        <attribute name="property"/>
+        <attribute name="value"/>
+        <sequential>
+            <property name="@{property}" value="@{value}"/>
+        </sequential>
+    </macrodef>
+    <property file="${user.properties.file}"/>
+    <nbmproject2:property name="harness.dir" 
value="nbplatform.${nbplatform.active}.harness.dir" 
xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <nbmproject2:property name="nbplatform.active.dir" 
value="nbplatform.${nbplatform.active}.netbeans.dest.dir" 
xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <nbmproject2:evalprops property="cluster.path.evaluated" 
value="${cluster.path}" 
xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <fail message="Path to 'platform' cluster missing in $${cluster.path} 
property or using corrupt Netbeans Platform (missing harness).">
+        <condition>
+            <not>
+                <contains string="${cluster.path.evaluated}" 
substring="platform"/>
+            </not>
+        </condition>
+    </fail>
+    <import file="${harness.dir}/build.xml"/>
+</project>
diff --git 
a/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/genfiles.properties
 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/genfiles.properties
new file mode 100644
--- /dev/null
+++ 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=a86751fd
+build.xml.script.CRC32=929f7de6
+build.xml.stylesheet.CRC32=a56c6a5b@2.66.1
+# This file is used by a NetBeans-based IDE to track changes in generated 
files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never 
regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=a86751fd
+nbproject/build-impl.xml.script.CRC32=ed781f5b
+nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.66.1
diff --git 
a/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/platform.properties
 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/platform.properties
new file mode 100644
--- /dev/null
+++ 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/platform.properties
@@ -0,0 +1,23 @@
+cluster.path=\
+    ${nbplatform.active.dir}/apisupport:\
+    ${nbplatform.active.dir}/cnd:\
+    ${nbplatform.active.dir}/dlight:\
+    ${nbplatform.active.dir}/enterprise:\
+    ${nbplatform.active.dir}/ergonomics:\
+    ${nbplatform.active.dir}/extide:\
+    ${nbplatform.active.dir}/extra:\
+    ${nbplatform.active.dir}/groovy:\
+    ${nbplatform.active.dir}/harness:\
+    ${nbplatform.active.dir}/ide:\
+    ${nbplatform.active.dir}/java:\
+    ${nbplatform.active.dir}/javacard:\
+    ${nbplatform.active.dir}/javafx:\
+    ${nbplatform.active.dir}/mobility:\
+    ${nbplatform.active.dir}/nb:\
+    ${nbplatform.active.dir}/php:\
+    ${nbplatform.active.dir}/platform:\
+    ${nbplatform.active.dir}/profiler:\
+    ${nbplatform.active.dir}/webcommon:\
+    ${nbplatform.active.dir}/websvccommon
+nbjdk.active=default
+nbplatform.active=default
diff --git 
a/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/project.properties
 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/project.properties
new file mode 100644
--- /dev/null
+++ 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/project.properties
@@ -0,0 +1,2 @@
+javac.source=1.6
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git 
a/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/project.xml
 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/project.xml
new file mode 100644
--- /dev/null
+++ 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/nbproject/project.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>com.controlsjs.netbeans.formeditor</code-name-base>
+            <standalone/>
+            <module-dependencies>
+                <dependency>
+                    
<code-name-base>org.netbeans.core.multiview</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>1</release-version>
+                        <specification-version>1.39.2</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.netbeans.libs.javafx</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>2.3.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.awt</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.61.2</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.dialogs</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.36.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.filesystems</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>8.10.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.loaders</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.56.2</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.nodes</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.38.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.61.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.util</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>8.37.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.24.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.windows</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>6.70.1</specification-version>
+                    </run-dependency>
+                </dependency>
+            </module-dependencies>
+            <public-packages/>
+        </data>
+    </configuration>
+</project>
diff --git 
a/apisupport.ant/test/unit/data/example-external-projects/javafx/src/org/netbeans/test/fx/UseFx.java
 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/src/org/netbeans/test/fx/UseFx.java
new file mode 100644
--- /dev/null
+++ 
b/apisupport.ant/test/unit/data/example-external-projects/javafx/src/org/netbeans/test/fx/UseFx.java
@@ -0,0 +1,52 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2014 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 2014 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.test.fx;
+
+import javafx.application.Platform;
+
+public class UseFx {
+
+    public static void main(String[] args) {
+        Platform.setImplicitExit(true);
+    }
+}
diff --git 
a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/UseFxTest.java
 
b/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/UseFxTest.java
new file mode 100644
--- /dev/null
+++ 
b/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/UseFxTest.java
@@ -0,0 +1,99 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2014 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 2014 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.apisupport.project;
+
+import java.io.File;
+import static junit.framework.Assert.assertNotNull;
+import org.apache.tools.ant.module.api.support.ActionUtils;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.openide.DialogDescriptor;
+import org.openide.DialogDisplayer;
+import org.openide.execution.ExecutorTask;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author Jaroslav Tulach 
< >
+ */
+public class UseFxTest extends TestBase {
+    static {
+        System.setProperty("org.netbeans.core.startup.ModuleSystem.CULPRIT", 
"true");
+    }
+
+    private FileObject dir;
+    public UseFxTest(String name) {
+        super(name);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        clearWorkDir();
+        super.setUp();
+        System.setProperty("sync.project.execution", "true");
+//        MockLookup.setLayersAndInstances(cgpi);
+        InstalledFileLocatorImpl.registerDestDir(destDirF);
+        ((DialogDisplayerImpl) 
Lookup.getDefault().lookup(DialogDisplayer.class)).reset();
+        DialogDisplayerImpl.returnFromNotify(DialogDescriptor.NO_OPTION);
+        File prjDir = new File(new File(getDataDir(), 
"example-external-projects"), "javafx");
+        FileObject prj = FileUtil.toFileObject(prjDir);
+        FileObject wrk = FileUtil.toFileObject(getWorkDir());
+        dir = prj.copy(wrk, "javafx", null);
+    }
+    
+    
+    
+    public void testCompileTheProject() throws Exception {
+        Project prj = ProjectManager.getDefault().findProject(dir);
+        assertNotNull("Project found for " + dir, prj);
+        assertTrue("It is our project", prj instanceof NbModuleProject);
+        ((NbModuleProject)prj).open();
+        FileObject buildXML = dir.getFileObject("build.xml");
+        assertNotNull("Ant script found", buildXML);
+        final ExecutorTask task = ActionUtils.runTarget(buildXML, new 
String[]{"compile"}, null);
+        task.waitFinished();
+        assertEquals("Executed successfully", 0, task.result());
+        assertNotNull("project was build", dir.getFileObject("build"));
+    }
+}
\ No newline at end of file
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java 
b/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java
--- a/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/ModuleListParser.java
@@ -460,23 +460,9 @@
                 }
                 String reltext = XMLUtil.findText(runtimeRelativePath);
                 // No need to evaluate property refs in it - it is *not* 
substitutable-text in the schema.
+                String nball = (String) properties.get("nb_all");
                 resultBin = new File(jar.getParentFile(), 
reltext.replace('/', File.separatorChar));
-                if (!resultBin.exists() && 
reltext.contains("${java.home}/lib/ext/jfxrt.jar")) {
-                    String jhm = System.getProperty("java.home");
-                    resultBin = new File(new File(new File(new File(jhm), 
"lib"), "ext"), "jfxrt.jar");
-                    if (!resultBin.exists()) {
-                        File jdk7 = new File(new File(new File(jhm), "lib"), 
"jfxrt.jar");
-                        if (jdk7.exists()) {
-                            resultBin = jdk7;
-                        } else {
-                            String nball = (String) properties.get("nb_all");
-                            File external = new File(new File(new File(new 
File(nball), "libs.javafx"), "external"), "jfxrt.jar");
-                            if (external.exists()) {
-                                resultBin = external;
-                            }
-                        }
-                    }
-                }
+                resultBin = fixFxRtJar(resultBin, nball);
             }
 
             if (origBin != null) {
@@ -540,6 +526,25 @@
         }
         return true;
     }
+
+    private static File fixFxRtJar(File resultBin, String nball) {
+        if (!resultBin.exists() && 
resultBin.getPath().contains("${java.home}/lib/ext/jfxrt.jar")) {
+            String jhm = System.getProperty("java.home");
+            resultBin = new File(new File(new File(new File(jhm), "lib"), 
"ext"), "jfxrt.jar");
+            if (!resultBin.exists()) {
+                File jdk7 = new File(new File(new File(jhm), "lib"), 
"jfxrt.jar");
+                if (jdk7.exists()) {
+                    resultBin = jdk7;
+                } else if (nball != null) {
+                    File external = new File(new File(new File(new 
File(nball), "libs.javafx"), "external"), "jfxrt.jar");
+                    if (external.exists()) {
+                        resultBin = external;
+                    }
+                }
+            }
+        }
+        return resultBin;
+    }
     static String abbreviate(String cnb) {
         return cnb.replaceFirst("^org\\.netbeans\\.modules\\.", ""). // 
NOI18N
                    
replaceFirst("^org\\.netbeans\\.(libs|lib|api|spi|core)\\.", "$1."). // NOI18N
@@ -904,7 +909,7 @@
                 String[] pieces = cp.split(" +");
                 exts = new File[pieces.length];
                 for (int l = 0; l < pieces.length; l++) {
-                    exts[l] = new File(dir, pieces[l].replace('/', 
File.separatorChar));
+                    exts[l] = fixFxRtJar(new File(dir, 
pieces[l].replace('/', File.separatorChar)), null);
                 }
             }
             String moduleDependencies = 
attr.getValue("OpenIDE-Module-Module-Dependencies");

[hg] main-silver: #246771: Replace reference to jfxrt.jar when c...

Jaroslav Tulach 08/29/2014

Project Features

About this Project

APIsupport was started in November 2009, is owned by Antonin Nebuzelsky, and has 64 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20150626.29986a4). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close