This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 147393
Collapse All | Expand All

(-)a/apisupport.harness/build.xml (-3 / +15 lines)
Lines 44-50 Link Here
44
44
45
    <import file="../nbbuild/templates/projectized.xml"/>
45
    <import file="../nbbuild/templates/projectized.xml"/>
46
46
47
    <target name="nbantext" depends="init">
47
    <target name="nbantext" depends="build-init">
48
        <jar jarfile="${cluster}/tasks.jar" compress="${build.package.compress}" index="${build.package.index}">
48
        <jar jarfile="${cluster}/tasks.jar" compress="${build.package.compress}" index="${build.package.index}">
49
            <manifest>
49
            <manifest>
50
                <attribute name="NetBeans-Own-Library" value="true"/>
50
                <attribute name="NetBeans-Own-Library" value="true"/>
Lines 55-64 Link Here
55
        </jar>
55
        </jar>
56
    </target>
56
    </target>
57
57
58
    <target name="netbeans-extra" depends="init,nbantext,jar-jnlp-launcher">
58
    <target name="netbeans-extra" depends="nbantext,jar-jnlp-launcher">
59
        <copy file="${nb_all}/nbbuild/templates/common.xml" tofile="${cluster}/common.xml"/>
59
        <copy file="${nb_all}/nbbuild/templates/common.xml" tofile="${cluster}/common.xml"/>
60
        <copy file="${nb_all}/nbbuild/jdk.xml" tofile="${cluster}/jdk.xml"/>
60
        <copy file="${nb_all}/nbbuild/jdk.xml" tofile="${cluster}/jdk.xml"/>
61
        <copy file="external/jsearch-2.0_05.jar" todir="${cluster}"/>
61
        <downloadbinaries cache="${binaries.cache}" server="${binaries.server}">
62
            <manifest dir="..">
63
                <include name="libs.javacapi/external/binaries-list"/>
64
                <include name="libs.javacimpl/external/binaries-list"/>
65
            </manifest>
66
        </downloadbinaries>
67
        <copy todir="${cluster}/antlib">
68
            <fileset dir="..">
69
                <include name="apisupport.harness/external/jsearch*.jar"/>
70
                <include name="libs.javacapi/external/javac*.jar"/>
71
                <include name="libs.javacimpl/external/javac*.jar"/>
72
            </fileset>
73
        </copy>
62
    </target>
74
    </target>
63
 
75
 
64
    <target name="compile-jnlp-launcher" depends="init,compile">
76
    <target name="compile-jnlp-launcher" depends="init,compile">
(-)a/apisupport.harness/nbproject/project.properties (-1 / +2 lines)
Lines 49-55 Link Here
49
    common.xml,\
49
    common.xml,\
50
    jdk.xml,\
50
    jdk.xml,\
51
    tasks.jar,\
51
    tasks.jar,\
52
    jsearch-2.0_05.jar
52
    antlib/*.jar
53
53
54
# Just to keep it from being enabled (it does nothing as a module, and the cluster
54
# Just to keep it from being enabled (it does nothing as a module, and the cluster
55
# is not even loaded, but just in case):
55
# is not even loaded, but just in case):
Lines 68-73 Link Here
68
    org/netbeans/nbbuild/Arch-api-questions.xml,\
68
    org/netbeans/nbbuild/Arch-api-questions.xml,\
69
    org/netbeans/nbbuild/Branding*.class,\
69
    org/netbeans/nbbuild/Branding*.class,\
70
    org/netbeans/nbbuild/CreateModuleXML*.class,\
70
    org/netbeans/nbbuild/CreateModuleXML*.class,\
71
    org/netbeans/nbbuild/CustomJavac*.class,\
71
    org/netbeans/nbbuild/FixDependencies*.class,\
72
    org/netbeans/nbbuild/FixDependencies*.class,\
72
    org/netbeans/nbbuild/FixTestDependencies*.class,\
73
    org/netbeans/nbbuild/FixTestDependencies*.class,\
73
    org/netbeans/nbbuild/JHIndexer*.class,\
74
    org/netbeans/nbbuild/JHIndexer*.class,\
(-)a/apisupport.harness/release/build.xml (-1 / +4 lines)
Lines 141-146 Link Here
141
        <property name="build.javahelp.dir" location="build/javahelp"/>
141
        <property name="build.javahelp.dir" location="build/javahelp"/>
142
        <property name="javahelp.base" value="${code.name.base.slashes}/docs"/>
142
        <property name="javahelp.base" value="${code.name.base.slashes}/docs"/>
143
        <property name="javahelp.search" value="JavaHelpSearch"/>
143
        <property name="javahelp.search" value="JavaHelpSearch"/>
144
        <path id="javacimpl">
145
            <fileset dir="${harness.dir}/antlib" includes="javac*.jar"/>
146
        </path>
144
    </target>
147
    </target>
145
148
146
    <target name="test-lib-init" depends="init,-delete-suite-masks">
149
    <target name="test-lib-init" depends="init,-delete-suite-masks">
Lines 167-173 Link Here
167
170
168
    <target name="javahelp" depends="init" if="has.javahelp">
171
    <target name="javahelp" depends="init" if="has.javahelp">
169
        <!-- Similar to projectized.xml but does not fiddle with usersguide/.../ide.css, and finds jhall.jar differently: -->
172
        <!-- Similar to projectized.xml but does not fiddle with usersguide/.../ide.css, and finds jhall.jar differently: -->
170
        <property name="jhall.jar" location="${harness.dir}/jsearch-2.0_05.jar"/>
173
        <property name="jhall.jar" location="${harness.dir}/antlib/jsearch-2.0_05.jar"/>
171
        <available property="jhall.jar.exists" file="${jhall.jar}"/>
174
        <available property="jhall.jar.exists" file="${jhall.jar}"/>
172
        <fail unless="jhall.jar.exists">You must set 'jhall.jar' (e.g. in private.properties) to the location of jsearch.jar from a JavaHelp distribution</fail>
175
        <fail unless="jhall.jar.exists">You must set 'jhall.jar' (e.g. in private.properties) to the location of jsearch.jar from a JavaHelp distribution</fail>
173
        <mkdir dir="${build.javahelp.dir}/${javahelp.base}/${javahelp.search}"/>
176
        <mkdir dir="${build.javahelp.dir}/${javahelp.base}/${javahelp.search}"/>
(-)a/apisupport.harness/taskdefs.properties (-1 / +2 lines)
Lines 52-55 Link Here
52
makeupdatedesc=org.netbeans.nbbuild.MakeUpdateDesc
52
makeupdatedesc=org.netbeans.nbbuild.MakeUpdateDesc
53
verifyclasslinkage=org.netbeans.nbbuild.VerifyClassLinkage
53
verifyclasslinkage=org.netbeans.nbbuild.VerifyClassLinkage
54
fixtestdeps=org.netbeans.nbbuild.FixTestDependencies
54
fixtestdeps=org.netbeans.nbbuild.FixTestDependencies
55
shorterpaths=org.netbeans.nbbuild.ShorterPaths
55
shorterpaths=org.netbeans.nbbuild.ShorterPaths
56
custom-javac=org.netbeans.nbbuild.CustomJavac
(-)a/nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java (+124 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.nbbuild;
41
42
import java.io.File;
43
import java.lang.reflect.Method;
44
import org.apache.tools.ant.AntClassLoader;
45
import org.apache.tools.ant.BuildException;
46
import org.apache.tools.ant.Project;
47
import org.apache.tools.ant.taskdefs.Javac;
48
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
49
import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
50
import org.apache.tools.ant.types.Commandline;
51
import org.apache.tools.ant.types.Path;
52
53
/**
54
 * Runs javac in-process from a local implementation, e.g. so as to ensure JSR 269 is supported.
55
 * Works just like using the default <code>modern</code> compiler, except loaded from the specified place.
56
 */
57
public class CustomJavac extends Javac {
58
59
    public CustomJavac() {}
60
61
    private Path javacClasspath;
62
    public void addJavacClasspath(Path cp) {
63
        javacClasspath = cp;
64
    }
65
66
    @Override
67
    protected void compile() {
68
        if (compileList.length > 0) {
69
            log("Compiling " + compileList.length + " source file" +
70
                    (compileList.length == 1 ? "" : "s") +
71
                    (getDestdir() != null ? " to " + getDestdir() : ""));
72
            if (listFiles) {
73
                for (File f : compileList) {
74
                    log(f.getAbsolutePath());
75
                }
76
            }
77
            CompilerAdapter adapter = new CustomAdapter();
78
            adapter.setJavac(this);
79
            if (adapter.execute()) {
80
                // XXX updateDirList
81
            } else {
82
                // other modes not supported, see below
83
                throw new BuildException("Compile failed; see the compiler error output for details.", getLocation());
84
            }
85
        }
86
    }
87
88
    @Override
89
    public void setErrorProperty(String errorProperty) {
90
        throw new UnsupportedOperationException();
91
    }
92
93
    @Override
94
    public void setUpdatedProperty(String updatedProperty) {
95
        throw new UnsupportedOperationException();
96
    }
97
98
    @Override
99
    public void setFailonerror(boolean fail) {
100
        throw new UnsupportedOperationException();
101
    }
102
103
104
    private static class CustomAdapter extends DefaultCompilerAdapter {
105
106
        public boolean execute() throws BuildException {
107
            // adapted from Javac13
108
            Commandline cmd = setupModernJavacCommand();
109
            try {
110
                Path cp = ((CustomJavac) getJavac()).javacClasspath;
111
                ClassLoader cl = new AntClassLoader(getJavac().getProject(), cp);
112
                Class c = Class.forName("com.sun.tools.javac.Main", true, cl);
113
                getJavac().log("Running javac from " + c.getProtectionDomain().getCodeSource().getLocation(), Project.MSG_VERBOSE);
114
                Method compile = c.getMethod("compile", String[].class);
115
                int result = (Integer) compile.invoke(null, (Object) cmd.getArguments());
116
                return result == 0;
117
            } catch (Exception ex) {
118
                throw new BuildException("Error starting compiler: " + ex, ex, location);
119
            }
120
        }
121
122
    }
123
124
}
(-)a/nbbuild/templates/common.xml (-8 / +16 lines)
Lines 122-132 Link Here
122
        <depend srcdir="${src.dir}" destdir="${build.classes.dir}" cache="build/depcache">
122
        <depend srcdir="${src.dir}" destdir="${build.classes.dir}" cache="build/depcache">
123
            <classpath refid="cp"/>
123
            <classpath refid="cp"/>
124
        </depend>
124
        </depend>
125
        <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="${build.compiler.debug}" debuglevel="${build.compiler.debuglevel}" encoding="UTF-8"
125
        <custom-javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="${build.compiler.debug}" debuglevel="${build.compiler.debuglevel}" encoding="UTF-8"
126
                deprecation="${build.compiler.deprecation}" optimize="${build.compiler.optimize}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
126
                deprecation="${build.compiler.deprecation}" optimize="${build.compiler.optimize}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
127
            <bootclasspath path="${nbjdk.bootclasspath}"/>
127
            <classpath refid="cp"/>
128
            <classpath refid="cp"/>
128
            <compilerarg line="${javac.compilerargs}"/>
129
            <compilerarg line="${javac.compilerargs}"/>
129
        </javac>
130
            <javacclasspath refid="javacimpl"/>
131
        </custom-javac>
130
        <!-- Sanity check: -->
132
        <!-- Sanity check: -->
131
        <pathconvert pathsep=":" property="class.files.in.src">
133
        <pathconvert pathsep=":" property="class.files.in.src">
132
            <path>
134
            <path>
Lines 158-169 Link Here
158
        <depend srcdir="${src.dir}" destdir="${build.classes.dir}" cache="build/depcache">
160
        <depend srcdir="${src.dir}" destdir="${build.classes.dir}" cache="build/depcache">
159
            <classpath refid="cp"/>
161
            <classpath refid="cp"/>
160
        </depend>
162
        </depend>
161
        <javac srcdir="${src.dir}" destdir="${build.classes.dir}"
163
        <custom-javac srcdir="${src.dir}" destdir="${build.classes.dir}"
162
               debug="${build.compiler.debug}" deprecation="${build.compiler.deprecation}" encoding="UTF-8"
164
               debug="${build.compiler.debug}" deprecation="${build.compiler.deprecation}" encoding="UTF-8"
163
               source="${javac.source}" target="${javac.target}" includes="${javac.includes}" optimize="${build.compiler.optimize}" includeantruntime="false">
165
               source="${javac.source}" target="${javac.target}" includes="${javac.includes}" optimize="${build.compiler.optimize}" includeantruntime="false">
166
            <bootclasspath path="${nbjdk.bootclasspath}"/>
164
            <classpath refid="cp"/>
167
            <classpath refid="cp"/>
165
            <compilerarg line="${javac.compilerargs}"/>
168
            <compilerarg line="${javac.compilerargs}"/>
166
        </javac>
169
            <javacclasspath refid="javacimpl"/>
170
        </custom-javac>
167
    </target>
171
    </target>
168
172
169
    <target name="jar-prep" depends="init">
173
    <target name="jar-prep" depends="init">
Lines 430-441 Link Here
430
                <classpath refid="test.@{test.type}.cp"/>
434
                <classpath refid="test.@{test.type}.cp"/>
431
            </depend>
435
            </depend>
432
            <property name="test.excludes" value=""/> <!-- # 113770 -->
436
            <property name="test.excludes" value=""/> <!-- # 113770 -->
433
            <javac srcdir="${test.@{test.type}.src.dir}" destdir="${build.test.@{test.type}.classes.dir}" excludes="${test.excludes}"
437
            <custom-javac srcdir="${test.@{test.type}.src.dir}" destdir="${build.test.@{test.type}.classes.dir}" excludes="${test.excludes}"
434
                   debug="true" deprecation="${build.compiler.deprecation}" encoding="UTF-8"
438
                   debug="true" deprecation="${build.compiler.deprecation}" encoding="UTF-8"
435
                   source="${javac.source}" target="${javac.target}" optimize="${build.compiler.optimize}" includeantruntime="false">
439
                   source="${javac.source}" target="${javac.target}" optimize="${build.compiler.optimize}" includeantruntime="false">
440
                <bootclasspath path="${nbjdk.bootclasspath}"/>
436
                <classpath refid="test.@{test.type}.cp"/>
441
                <classpath refid="test.@{test.type}.cp"/>
437
                <compilerarg line="${javac.compilerargs}"/>
442
                <compilerarg line="${javac.compilerargs}"/>
438
            </javac>
443
                <javacclasspath refid="javacimpl"/>
444
            </custom-javac>
439
            <copy todir="${build.test.@{test.type}.classes.dir}">
445
            <copy todir="${build.test.@{test.type}.classes.dir}">
440
                <fileset dir="${test.@{test.type}.src.dir}">
446
                <fileset dir="${test.@{test.type}.src.dir}">
441
                    <exclude name="**/*.java"/>
447
                    <exclude name="**/*.java"/>
Lines 494-505 Link Here
494
                <depend srcdir="${test.@{test.type}.src.dir}" destdir="${build.test.@{test.type}.classes.dir}" cache="${build.test.@{test.type}.dir}/depcache">
500
                <depend srcdir="${test.@{test.type}.src.dir}" destdir="${build.test.@{test.type}.classes.dir}" cache="${build.test.@{test.type}.dir}/depcache">
495
                    <classpath refid="test.@{test.type}.cp"/>
501
                    <classpath refid="test.@{test.type}.cp"/>
496
                </depend>
502
                </depend>
497
                <javac srcdir="${test.@{test.type}.src.dir}" destdir="${build.test.@{test.type}.classes.dir}"
503
                <custom-javac srcdir="${test.@{test.type}.src.dir}" destdir="${build.test.@{test.type}.classes.dir}"
498
                       debug="true" deprecation="${build.compiler.deprecation}" encoding="UTF-8"
504
                       debug="true" deprecation="${build.compiler.deprecation}" encoding="UTF-8"
499
                       source="${javac.source}" target="${javac.target}" includeantruntime="false" optimize="${build.compiler.optimize}" includes="${javac.includes}">
505
                       source="${javac.source}" target="${javac.target}" includeantruntime="false" optimize="${build.compiler.optimize}" includes="${javac.includes}">
506
                    <bootclasspath path="${nbjdk.bootclasspath}"/>
500
                    <classpath refid="test.@{test.type}.cp"/>
507
                    <classpath refid="test.@{test.type}.cp"/>
501
                    <compilerarg line="${javac.compilerargs}"/>
508
                    <compilerarg line="${javac.compilerargs}"/>
502
                </javac>
509
                    <javacclasspath refid="javacimpl"/>
510
                </custom-javac>
503
                <copy todir="${build.test.@{test.type}.classes.dir}">
511
                <copy todir="${build.test.@{test.type}.classes.dir}">
504
                    <fileset dir="${test.@{test.type}.src.dir}">
512
                    <fileset dir="${test.@{test.type}.src.dir}">
505
                        <exclude name="**/*.java"/>
513
                        <exclude name="**/*.java"/>
(-)a/nbbuild/templates/projectized.xml (+7 lines)
Lines 161-166 Link Here
161
        <property name="locjhindexer.locales" value="${locales}"/>
161
        <property name="locjhindexer.locales" value="${locales}"/>
162
        <property name="locmakenbm.locales" value="${locales}"/>
162
        <property name="locmakenbm.locales" value="${locales}"/>
163
        <property name="locmakenbm.brands" value="${brandings}"/>
163
        <property name="locmakenbm.brands" value="${brandings}"/>
164
        <path id="javacimpl">
165
            <fileset dir="${nb_all}">
166
                <include name="libs.javacapi/external/javac*.jar"/>
167
                <include name="libs.javacimpl/external/javac*.jar"/>
168
            </fileset>
169
        </path>
170
        <taskdef name="custom-javac" classname="org.netbeans.nbbuild.CustomJavac" classpath="${nb_all}/nbbuild/nbantext.jar"/>
164
    </target>
171
    </target>
165
172
166
    <!-- See: http://wiki.netbeans.org/wiki/view/DevFaqExternalLibrariesUpdated -->
173
    <!-- See: http://wiki.netbeans.org/wiki/view/DevFaqExternalLibrariesUpdated -->

Return to bug 147393