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 38306
Collapse All | Expand All

(-)ant/manifest.mf (-1 / +1 lines)
Lines 1-7 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.apache.tools.ant.module/3
2
OpenIDE-Module: org.apache.tools.ant.module/3
3
OpenIDE-Module-Localizing-Bundle: org/apache/tools/ant/module/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/apache/tools/ant/module/Bundle.properties
4
OpenIDE-Module-Specification-Version: 3.4
4
OpenIDE-Module-Specification-Version: 3.6
5
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
5
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
6
OpenIDE-Module-Public-Packages: org.apache.tools.ant.module.api.*, org.apache.tools.ant.module.spi.*
6
OpenIDE-Module-Public-Packages: org.apache.tools.ant.module.api.*, org.apache.tools.ant.module.spi.*
7
OpenIDE-Module-Install: org/apache/tools/ant/module/AntModule.class
7
OpenIDE-Module-Install: org/apache/tools/ant/module/AntModule.class
(-)ant/api/doc/changes/apichanges.xml (+21 lines)
Lines 77-82 Link Here
77
<!-- ACTUAL CHANGES BEGIN HERE: -->
77
<!-- ACTUAL CHANGES BEGIN HERE: -->
78
78
79
  <changes>
79
  <changes>
80
81
        <change id="antlib.xml">
82
            <api name="general"/>
83
            <summary>Format of <code>ant/nblib/*.jar</code> changed to use <code>antlib.xml</code></summary>
84
            <version major="3" minor="6"/>
85
            <date day="XXX" month="XXX" year="XXX"/>
86
            <author login="jglick"/>
87
            <compatibility semantic="incompatible" modification="yes">
88
                Existing modules installing taskdef JARs in this directory must change their format.
89
                The previous format was however introduced after NetBeans 3.5 in the trunk.
90
            </compatibility>
91
            <description>
92
                <code>ant/nblib/*.jar</code> taskdef (or typedef) JARs must now
93
                be named according to the code name base of the module, and must
94
                define their tasks (or types etc.) using the standard
95
                <code>antlib.xml</code> syntax rather than
96
                <code>META-INF/taskdefs.properties</code> and/or
97
                <code>META-INF/typedefs.properties</code>.
98
            </description>
99
            <issue number="38306"/>
100
        </change>
80
  
101
  
81
    <change>
102
    <change>
82
         <api name="general"/>
103
         <api name="general"/>
(-)ant/api/doc/org/apache/tools/ant/module/api/package.html (-10 / +57 lines)
Lines 41-55 Link Here
41
reloading a NetBeans test module, attaching the NetBeans debugger to a running
41
reloading a NetBeans test module, attaching the NetBeans debugger to a running
42
application, etc. You could consider these things IDE scripting using Ant.</p>
42
application, etc. You could consider these things IDE scripting using Ant.</p>
43
43
44
<p>Registration is simple. Create a JAR file containing the task class(es).
44
<p>Registration is simple.
45
To define tasks, create an entry <samp>META-INF/taskdefs.properties</samp>
45
(Assume for sake of illustration that the code name base of the host module is
46
listing the tasks in the usual format: the key is the task name as it appears in
46
<samp>org.netbeans.modules.foo</samp>; in the following text, replace this package
47
the script, and the value is the class name. <samp>META-INF/typedefs.properties</samp>
47
sequence with the actual code name base of your module, using whatever separator
48
may similarly be used to register custom data types.</p>
48
character is indicated.)
49
Create a JAR file containing the task class(es), named
50
<samp>org-netbeans-modules-foo.jar</samp>.
51
Create an entry in that JAR <samp>org/netbeans/modules/foo/antlib.xml</samp>
52
listing tasks (or types, macrodefs, etc.) you wish to define, in the
53
<a href="http://ant.apache.org/manual/CoreTypes/antlib.html">standard Antlib format</a>.
54
For example:</p>
55
56
<pre>
57
&lt;?<span class="keyword">xml</span> <span class="variable-name">version</span>=<span class="string">"1.0"</span> <span class="variable-name">encoding</span>=<span class="string">"UTF-8"</span>?&gt;
58
&lt;<span class="function-name">antlib</span>&gt;
59
    &lt;<span class="function-name">taskdef</span> <span class="variable-name">name</span>=<span class="string">"mytask1"</span> <span class="variable-name">classname</span>=<span class="string">"org.netbeans.modules.foo.MyTask1"</span>/&gt;
60
    &lt;<span class="function-name">taskdef</span> <span class="variable-name">name</span>=<span class="string">"mytask2"</span> <span class="variable-name">classname</span>=<span class="string">"org.netbeans.modules.foo.MyTask2"</span>/&gt;
61
&lt;/<span class="function-name">antlib</span>&gt;
62
</pre>
63
64
<p>(Note that when using Ant 1.5, only <code>&lt;taskdef&gt;</code>
65
and <code>&lt;typedef&gt;</code> elements are supported, and only
66
using the <code>name</code> and <code>classname</code>
67
attributes.)</p>
49
68
50
<p>Place the JAR file in the <samp>ant/nblib/</samp> directory of the NetBeans
69
<p>Place the JAR file in the <samp>ant/nblib/</samp> directory of the NetBeans
51
distribution, i.e. bundle it in your NBM as
70
distribution, i.e. bundle it in your NBM as
52
<samp>netbeans/ant/nblib/<i>something</i>.jar</samp>. NetBeans will
71
<samp>netbeans/ant/nblib/org-netbeans-modules-foo.jar</samp>. NetBeans will
53
automatically load your task/type definitions and make them available to build
72
automatically load your task/type definitions and make them available to build
54
scripts.</p>
73
scripts.</p>
55
74
Lines 58-74 Link Here
58
77
59
<ol>
78
<ol>
60
79
61
<li>the JRE and JDK libraries</li>
80
<li>The JRE and JDK libraries.</li>
62
81
63
<li>any module or module extension enabled in the NetBeans VM, including all of
82
<li>The installed copy of Ant, including any user-configured Ant classpath.</li>
64
the Open APIs and all packages of your module</li>
65
83
66
<li>the installed copy of Ant, including any user-configured Ant classpath</li>
84
<li>Your module, including any extension JARs and anything your module
85
can directly refer to, such as other modules it depends on.</li>
67
86
68
</ol>
87
</ol>
69
88
70
<p>Do <em>not</em> include copies of your task or type definitions in the module
89
<p>Do <em>not</em> include copies of your task or type definitions in the module
71
JAR. They must reside only in <samp>ant/nblib/*.jar</samp>.</p>
90
JAR. They must reside only in <samp>ant/nblib/*.jar</samp>.</p>
91
92
<p>Now whenever your module is enabled, Ant projects run inside
93
NetBeans will have access to the definitions you provided. When running
94
Ant 1.5, the definitions will be
95
available with no namespace qualification, e.g.:</p>
96
97
<pre>
98
&lt;<span class="function-name">project</span> <span class="variable-name">default</span>=<span class="string">"all"</span>&gt;
99
    &lt;<span class="function-name">target</span> <span class="variable-name">name</span>=<span class="string">"all"</span>&gt;
100
        &lt;<span class="function-name">mytask1</span> <span class="variable-name">arg</span>=<span class="string">"val"</span>/&gt;
101
    &lt;/<span class="function-name">target</span>&gt;
102
&lt;/<span class="function-name">project</span>&gt;
103
</pre>
104
105
<p>When running Ant 1.6, the definitions will still be available with no namespace
106
qualification. However it is recommended in 1.6 to namespace-qualify everything; so
107
the antlib is loaded in the namespace you would expect, ensuring that
108
there is no possibility of name clashes with unrelated tasks:</p>
109
110
<pre>
111
&lt;<span class="function-name">project</span> <span class="variable-name">default</span>=<span class="string">"all"</span>
112
         <span class="variable-name">xmlns</span>=<span class="string">"antlib:org.apache.tools.ant"</span>
113
         <span class="variable-name">xmlns:foo</span>=<span class="string">"antlib:org.netbeans.modules.foo"</span>&gt;
114
    &lt;<span class="function-name">target</span> <span class="variable-name">name</span>=<span class="string">"all"</span>&gt;
115
        &lt;<span class="function-name">foo:mytask1</span> <span class="variable-name">arg</span>=<span class="string">"val"</span>/&gt;
116
    &lt;/<span class="function-name">target</span>&gt;
117
&lt;/<span class="function-name">project</span>&gt;
118
</pre>
72
119
73
<p>Complete working example of task registration:
120
<p>Complete working example of task registration:
74
<a href="http://www.netbeans.org/source/browse/ant/browsetask/"><samp>ant/browsetask</samp>
121
<a href="http://www.netbeans.org/source/browse/ant/browsetask/"><samp>ant/browsetask</samp>
(-)ant/browsetask/build.xml (-3 / +3 lines)
Lines 41-55 Link Here
41
            <fileset dir="src">
41
            <fileset dir="src">
42
                <excludesfile name="../../nbbuild/standard-jar-excludes.txt"/>
42
                <excludesfile name="../../nbbuild/standard-jar-excludes.txt"/>
43
                <exclude name="**/*.class"/>
43
                <exclude name="**/*.class"/>
44
                <exclude name="META-INF/*.properties"/>
44
                <exclude name="org/netbeans/modules/ant/browsetask/antlib.xml"/>
45
            </fileset>
45
            </fileset>
46
        </jar>
46
        </jar>
47
        <mkdir dir="netbeans/ant/nblib"/>
47
        <mkdir dir="netbeans/ant/nblib"/>
48
        <jar jarfile="netbeans/ant/nblib/nbbrowse.jar" compress="false">
48
        <jar jarfile="netbeans/ant/nblib/org-netbeans-modules-ant-browsetask.jar" compress="false">
49
            <fileset dir="src">
49
            <fileset dir="src">
50
                <excludesfile name="../../nbbuild/standard-jar-excludes.txt"/>
50
                <excludesfile name="../../nbbuild/standard-jar-excludes.txt"/>
51
                <include name="**/*.class"/>
51
                <include name="**/*.class"/>
52
                <include name="META-INF/*.properties"/>
52
                <include name="org/netbeans/modules/ant/browsetask/antlib.xml"/>
53
            </fileset>
53
            </fileset>
54
        </jar>
54
        </jar>
55
    </target>
55
    </target>
(-)ant/browsetask/manifest.mf (-2 / +2 lines)
Lines 1-8 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.ant.browsetask
2
OpenIDE-Module: org.netbeans.modules.ant.browsetask
3
OpenIDE-Module-Specification-Version: 1.4
3
OpenIDE-Module-Specification-Version: 1.5
4
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
4
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
5
OpenIDE-Module-Module-Dependencies: org.apache.tools.ant.module/3 > 3.1
5
OpenIDE-Module-Module-Dependencies: org.apache.tools.ant.module/3 > 3.6
6
OpenIDE-Module-IDE-Dependencies: IDE/1 > 3.31
6
OpenIDE-Module-IDE-Dependencies: IDE/1 > 3.31
7
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/ant/browsetask/Bundle.properties
7
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/ant/browsetask/Bundle.properties
8
8
(-)ant/browsetask/src/META-INF/taskdefs.properties (-1 lines)
Removed Link Here
1
nbbrowse=org.netbeans.modules.ant.browsetask.NbBrowse
(-)ant/browsetask/src/org/netbeans/modules/ant/browsetask/antlib.xml (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<antlib>
3
    <taskdef name="nbbrowse" classname="org.netbeans.modules.ant.browsetask.NbBrowse"/>
4
</antlib>
(-)ant/src/org/apache/tools/ant/module/api/IntrospectedInfo.java (-1 / +23 lines)
Lines 30-41 Link Here
30
import org.apache.tools.ant.module.bridge.*;
30
import org.apache.tools.ant.module.bridge.*;
31
import org.openide.util.Utilities;
31
import org.openide.util.Utilities;
32
32
33
// XXX in order to support Ant 1.6 interface addition types, need to keep
34
// track of which classes implement a given interface
35
33
/** Represents Ant-style introspection info for a set of classes.
36
/** Represents Ant-style introspection info for a set of classes.
34
 * There should be one instance which is loaded automatically
37
 * There should be one instance which is loaded automatically
35
 * from defaults.properties files, i.e. standard tasks/datatypes.
38
 * from defaults.properties files, i.e. standard tasks/datatypes.
36
 * A second is loaded from settings and represents custom tasks/datatypes.
39
 * A second is loaded from settings and represents custom tasks/datatypes.
37
 * Uses Ant's IntrospectionHelper for the actual work, but manages the results
40
 * Uses Ant's IntrospectionHelper for the actual work, but manages the results
38
 * and makes them safely serializable (stores only classnames, etc.).
41
 * and makes them safely serializable (stores only classnames, etc.).
42
 * <p>
43
 * All task and type names may be namespace-qualified for use
44
 * in Ant 1.6: a name of the form <samp>nsuri:localname</samp> refers to
45
 * an XML element with namespace <samp>nsuri</samp> and local name <samp>localname</samp>.
46
 * Attribute names could also be similarly qualified, but in practice attributes
47
 * used in Ant never have a defined namespace. The prefix <samp>antlib:org.apache.tools.ant:</samp>
48
 * is implied, not expressed, on Ant core element names (for backwards compatibility).
49
 * Subelement names are *not* namespace-qualified here, even though in the script
50
 * they would be - because the namespace used in the script will actually vary
51
 * according to how an antlib is imported and used. An unqualified subelement name
52
 * should be understood to inherit a namespace from its parent element.
53
 * <em>(Namespace support since <code>org.apache.tools.ant.module/3 3.6</code>)</em>
39
 */
54
 */
40
public final class IntrospectedInfo implements Serializable {
55
public final class IntrospectedInfo implements Serializable {
41
    
56
    
Lines 340-346 Link Here
340
    }
355
    }
341
    
356
    
342
    private void loadNetBeansSpecificDefinitions() {
357
    private void loadNetBeansSpecificDefinitions() {
343
        Map defsByKind = AntBridge.getCustomDefs();
358
        loadNetBeansSpecificDefinitions0(AntBridge.getCustomDefsNoNamespace());
359
        if (AntBridge.getInterface().isAnt16()) {
360
            // Define both.
361
            loadNetBeansSpecificDefinitions0(AntBridge.getCustomDefsWithNamespace());
362
        }
363
    }
364
    
365
    private void loadNetBeansSpecificDefinitions0(Map defsByKind) {
344
        Iterator kindIt = defsByKind.entrySet().iterator();
366
        Iterator kindIt = defsByKind.entrySet().iterator();
345
        while (kindIt.hasNext()) {
367
        while (kindIt.hasNext()) {
346
            Map.Entry kindE = (Map.Entry)kindIt.next();
368
            Map.Entry kindE = (Map.Entry)kindIt.next();
(-)ant/src/org/apache/tools/ant/module/bridge/AntBridge.java (-56 / +182 lines)
Lines 30-36 Link Here
30
import org.openide.filesystems.FileObject;
30
import org.openide.filesystems.FileObject;
31
import org.openide.filesystems.FileStateInvalidException;
31
import org.openide.filesystems.FileStateInvalidException;
32
import org.openide.modules.InstalledFileLocator;
32
import org.openide.modules.InstalledFileLocator;
33
import org.openide.modules.ModuleInfo;
33
import org.openide.util.*;
34
import org.openide.util.*;
35
import org.openide.xml.XMLUtil;
36
import org.w3c.dom.Document;
37
import org.w3c.dom.Element;
38
import org.w3c.dom.Node;
39
import org.w3c.dom.NodeList;
40
import org.xml.sax.InputSource;
41
import org.xml.sax.SAXException;
34
42
35
/**
43
/**
36
 * Utility class providing entry points to the bridging functionality.
44
 * Utility class providing entry points to the bridging functionality.
Lines 41-73 Link Here
41
    private AntBridge() {}
49
    private AntBridge() {}
42
    
50
    
43
    private static final String KEY_MAIN_CLASS_LOADER = "mainClassLoader"; // NOI18N
51
    private static final String KEY_MAIN_CLASS_LOADER = "mainClassLoader"; // NOI18N
44
    private static final String KEY_AUX_CLASS_LOADER = "auxClassLoader"; // NOI18N
52
    private static final String KEY_BRIDGE_CLASS_LOADER = "bridgeClassLoader"; // NOI18N
45
    private static final String KEY_BRIDGE = "bridge"; // NOI18N
53
    private static final String KEY_BRIDGE = "bridge"; // NOI18N
46
    private static final String KEY_CUSTOM_DEFS = "customDefs";
54
    private static final String KEY_CUSTOM_DEFS = "customDefs"; // NOI18N
55
    private static final String KEY_CUSTOM_DEF_CLASS_LOADERS = "customDefClassLoaders"; // NOI18N
47
    private static Reference stuff = null; // Reference<Map>
56
    private static Reference stuff = null; // Reference<Map>
48
    
57
    
49
    private static List listeners = new ArrayList(); // List<ChangeListener>
58
    private static List listeners = new ArrayList(); // List<ChangeListener>
50
    
59
    
51
    private static final class MiscListener implements PropertyChangeListener, LookupListener {
60
    private static final class MiscListener implements PropertyChangeListener, LookupListener {
61
        MiscListener() {}
62
        private ModuleInfo[] modules = null;
52
        public void propertyChange(PropertyChangeEvent ev) {
63
        public void propertyChange(PropertyChangeEvent ev) {
53
            String prop = ev.getPropertyName();
64
            String prop = ev.getPropertyName();
54
            if (prop == null ||
65
            if (AntSettings.PROP_ANT_HOME.equals(prop) ||
55
                    AntSettings.PROP_ANT_HOME.equals(prop) ||
56
                    AntSettings.PROP_EXTRA_CLASSPATH.equals(prop)) {
66
                    AntSettings.PROP_EXTRA_CLASSPATH.equals(prop)) {
57
                AntModule.err.log("AntBridge got settings change in " + prop);
67
                AntModule.err.log("AntBridge got settings change in " + prop);
58
                fireChange();
68
                fireChange();
69
            } else if (ModuleInfo.PROP_ENABLED.equals(prop)) {
70
                AntModule.err.log("AntBridge got module enablement change on " + ev.getSource());
71
                fireChange();
59
            }
72
            }
60
        }
73
        }
61
        public void resultChanged(LookupEvent ev) {
74
        public void resultChanged(LookupEvent ev) {
62
            AntModule.err.log("AntModule got ClassLoader change");
75
            AntModule.err.log("AntModule got ModuleInfo change");
76
            synchronized (this) {
77
                if (modules != null) {
78
                    for (int i = 0; i < modules.length; i++) {
79
                        modules[i].removePropertyChangeListener(this);
80
                    }
81
                    modules = null;
82
                }
83
            }
63
            fireChange();
84
            fireChange();
64
        }
85
        }
86
        public synchronized ModuleInfo[] getEnabledModules() {
87
            if (modules == null) {
88
                Collection c = modulesResult.allInstances();
89
                modules = (ModuleInfo[])c.toArray(new ModuleInfo[c.size()]);
90
                for (int i = 0; i < modules.length; i++) {
91
                    modules[i].addPropertyChangeListener(this);
92
                }
93
            }
94
            List/*<ModuleInfo>*/ enabledModules = new ArrayList(modules.length);
95
            for (int i = 0; i < modules.length; i++) {
96
                if (modules[i].isEnabled()) {
97
                    enabledModules.add(modules[i]);
98
                }
99
            }
100
            return (ModuleInfo[])enabledModules.toArray(new ModuleInfo[enabledModules.size()]);
101
        }
65
    }
102
    }
66
    private static MiscListener miscListener = new MiscListener();
103
    private static MiscListener miscListener = new MiscListener();
67
    private static Lookup.Result classpathResult = Lookup.getDefault().lookup(new Lookup.Template(ClassLoader.class));
104
    private static Lookup.Result modulesResult = Lookup.getDefault().lookup(new Lookup.Template(ModuleInfo.class));
68
    static {
105
    static {
69
        AntSettings.getDefault().addPropertyChangeListener(miscListener);
106
        AntSettings.getDefault().addPropertyChangeListener(miscListener);
70
        classpathResult.addLookupListener(miscListener);
107
        modulesResult.addLookupListener(miscListener);
71
    }
108
    }
72
    
109
    
73
    /**
110
    /**
Lines 106-127 Link Here
106
    }
143
    }
107
    
144
    
108
    /**
145
    /**
109
     * Get the loader which contains the bridge code as well as any
146
     * Get the loader which contains the bridge code.
110
     * custom-defined tasks.
111
     */
147
     */
112
    private static ClassLoader getAuxClassLoader() {
148
    private static ClassLoader getBridgeClassLoader() {
113
        return (ClassLoader)getStuff().get(KEY_AUX_CLASS_LOADER);
149
        return (ClassLoader)getStuff().get(KEY_BRIDGE_CLASS_LOADER);
114
    }
150
    }
115
    
151
    
116
    /**
152
    /**
117
     * Get any custom task/type definitions stored in $nbhome/ant/nblib/*.jar.
153
     * Get any custom task/type definitions stored in $nbhome/ant/nblib/*.jar.
118
     * Some of the classes might not be fully resolvable, so beware.
154
     * Some of the classes might not be fully resolvable, so beware.
155
     * The names will include namespace prefixes.
156
     * <p>
157
     * Only minimal antlib syntax is currently interpreted here:
158
     * only <code>&lt;taskdef&gt;</code> and <code>&lt;typedef&gt;</code>,
159
     * and only the <code>name</code> and <code>classname</code> attributes.
119
     */
160
     */
120
    public static Map/*<String,Map<String,Class>>*/ getCustomDefs() {
161
    public static Map/*<String,Map<String,Class>>*/ getCustomDefsWithNamespace() {
121
        return (Map)getStuff().get(KEY_CUSTOM_DEFS);
162
        return (Map)getStuff().get(KEY_CUSTOM_DEFS);
122
    }
163
    }
123
    
164
    
124
    /**
165
    /**
166
     * Same as {@link #getCustomDefsWithNamespace} but without any namespace prefixes.
167
     */
168
    public static Map/*<String,Map<String,Class>>*/ getCustomDefsNoNamespace() {
169
        Map/*<String,Map<String,Class>>*/ m = new HashMap();
170
        Iterator it = getCustomDefsWithNamespace().entrySet().iterator();
171
        while (it.hasNext()) {
172
            Map.Entry entry = (Map.Entry)it.next();
173
            String type = (String)entry.getKey();
174
            Map defs = (Map)entry.getValue();
175
            Map/*Map<String,Class>*/ m2 = new HashMap();
176
            Iterator it2 = defs.entrySet().iterator();
177
            while (it2.hasNext()) {
178
                Map.Entry entry2 = (Map.Entry)it2.next();
179
                String fqn = (String)entry2.getKey();
180
                Class clazz = (Class)entry2.getValue();
181
                String name;
182
                int idx = fqn.lastIndexOf(':');
183
                if (idx != -1) {
184
                    name = fqn.substring(idx + 1);
185
                } else {
186
                    name = fqn;
187
                }
188
                m2.put(name, clazz);
189
            }
190
            m.put(type, m2);
191
        }
192
        return m;
193
    }
194
    
195
    /**
196
     * Get a map from enabled module code name bases to class loaders containing
197
     * JARs from ant/nblib/*.jar.
198
     */
199
    public static Map/*<String,ClassLoader>*/ getCustomDefClassLoaders() throws IOException {
200
        return (Map)getStuff().get(KEY_CUSTOM_DEF_CLASS_LOADERS);
201
    }
202
    
203
    /**
125
     * Return a class loader which can load from Ant JARs as well the user
204
     * Return a class loader which can load from Ant JARs as well the user
126
     * development class path. It is not cached, since user classes can
205
     * development class path. It is not cached, since user classes can
127
     * change quickly. Similar to NbClassLoader.
206
     * change quickly. Similar to NbClassLoader.
Lines 177-188 Link Here
177
            // Ensures that the loader is functional, and that it is at least 1.5.x
256
            // Ensures that the loader is functional, and that it is at least 1.5.x
178
            // so that our classes can link against it successfully:
257
            // so that our classes can link against it successfully:
179
            main.loadClass("org.apache.tools.ant.input.InputHandler"); // NOI18N
258
            main.loadClass("org.apache.tools.ant.input.InputHandler"); // NOI18N
180
            File[] nblibs = getNblibs();
259
            ClassLoader bridgeLoader = createBridgeClassLoader(main);
181
            ClassLoader aux = createAuxClassLoader(nblibs, main);
260
            m.put(KEY_BRIDGE_CLASS_LOADER, bridgeLoader);
182
            m.put(KEY_AUX_CLASS_LOADER, aux);
261
            Class impl = bridgeLoader.loadClass("org.apache.tools.ant.module.bridge.impl.BridgeImpl"); // NOI18N
183
            Class impl = aux.loadClass("org.apache.tools.ant.module.bridge.impl.BridgeImpl"); // NOI18N
184
            m.put(KEY_BRIDGE, (BridgeInterface)impl.newInstance());
262
            m.put(KEY_BRIDGE, (BridgeInterface)impl.newInstance());
185
            m.put(KEY_CUSTOM_DEFS, createCustomDefs(nblibs, aux));
263
            Map cDCLs = createCustomDefClassLoaders(main);
264
            m.put(KEY_CUSTOM_DEF_CLASS_LOADERS, cDCLs);
265
            m.put(KEY_CUSTOM_DEFS, createCustomDefs(cDCLs));
186
        } catch (Exception e) {
266
        } catch (Exception e) {
187
            fallback(m, e);
267
            fallback(m, e);
188
        } catch (LinkageError e) {
268
        } catch (LinkageError e) {
Lines 195-206 Link Here
195
        m.clear();
275
        m.clear();
196
        ClassLoader dummy = ClassLoader.getSystemClassLoader();
276
        ClassLoader dummy = ClassLoader.getSystemClassLoader();
197
        m.put(KEY_MAIN_CLASS_LOADER, dummy);
277
        m.put(KEY_MAIN_CLASS_LOADER, dummy);
198
        m.put(KEY_AUX_CLASS_LOADER, dummy);
278
        m.put(KEY_BRIDGE_CLASS_LOADER, dummy);
199
        m.put(KEY_BRIDGE, new DummyBridgeImpl(e));
279
        m.put(KEY_BRIDGE, new DummyBridgeImpl(e));
200
        Map defs = new HashMap();
280
        Map defs = new HashMap();
201
        defs.put("task", new HashMap()); // NOI18N
281
        defs.put("task", new HashMap()); // NOI18N
202
        defs.put("type", new HashMap()); // NOI18N
282
        defs.put("type", new HashMap()); // NOI18N
203
        m.put(KEY_CUSTOM_DEFS, defs);
283
        m.put(KEY_CUSTOM_DEFS, defs);
284
        m.put(KEY_CUSTOM_DEF_CLASS_LOADERS, Collections.EMPTY_MAP);
204
    }
285
    }
205
    
286
    
206
    private static final class JarFilter implements FilenameFilter {
287
    private static final class JarFilter implements FilenameFilter {
Lines 239-300 Link Here
239
        return new AllPermissionURLClassLoader((URL[])cp.toArray(new URL[cp.size()]), ClassLoader.getSystemClassLoader());
320
        return new AllPermissionURLClassLoader((URL[])cp.toArray(new URL[cp.size()]), ClassLoader.getSystemClassLoader());
240
    }
321
    }
241
    
322
    
242
    private static File[] getNblibs() throws IOException {
323
    private static ClassLoader createBridgeClassLoader(ClassLoader main) throws Exception {
243
        // XXX this will not work for modules installed in the user dir...
324
        File bridgeJar = InstalledFileLocator.getDefault().locate("ant/nblib/bridge.jar", "org.apache.tools.ant.module", false); // NOI18N
244
        // pending stronger semantics from IFL re. directories
325
        if (bridgeJar == null) {
245
        // (cf. #36701)
326
            throw new IllegalStateException("no ant/nblib/bridge.jar found"); // NOI18N
246
        // -> when this is fixed, remove ant/nblib check from org.netbeans.modules.autoupdate.ModuleUpdate
327
        }
247
        File nblibdir = InstalledFileLocator.getDefault().locate("ant/nblib", "org.apache.tools.ant.module", false); // NOI18N
328
        return createAuxClassLoader(bridgeJar, main, AntBridge.class.getClassLoader());
248
        File bridgeJar = new File(nblibdir, "bridge.jar");
249
        if (!bridgeJar.isFile()) throw new IOException("No such Ant bridge JAR: " + bridgeJar); // NOI18N
250
        File[] libs = nblibdir.listFiles(new JarFilter());
251
        if (libs == null) throw new IOException("Listing: " + nblibdir); // NOI18N
252
        return libs;
253
    }
329
    }
254
    
330
    
255
    private static ClassLoader createAuxClassLoader(File[] libs, ClassLoader main) throws Exception {
331
    private static ClassLoader createAuxClassLoader(File lib, ClassLoader main, ClassLoader moduleLoader) throws IOException {
256
        List cp = new ArrayList(); // List<URL>
332
        return new AuxClassLoader(moduleLoader, main, lib.toURI().toURL());
257
        for (int i = 0; i < libs.length; i++) {
333
    }
258
            cp.add(libs[i].toURI().toURL());
334
    
335
    /**
336
     * Get a map from enabled module code name bases to class loaders containing
337
     * JARs from ant/nblib/*.jar.
338
     */
339
    private static Map/*<String,ClassLoader>*/ createCustomDefClassLoaders(ClassLoader main) throws IOException {
340
        Map/*<String,ClassLoader>*/ m = new HashMap();
341
        ModuleInfo[] modules = miscListener.getEnabledModules();
342
        InstalledFileLocator ifl = InstalledFileLocator.getDefault();
343
        for (int i = 0; i < modules.length; i++) {
344
            String cnb = modules[i].getCodeNameBase();
345
            String cnbDashes = cnb.replace('.', '-');
346
            File lib = ifl.locate("ant/nblib/" + cnbDashes + ".jar", cnb, false); // NOI18N
347
            if (lib == null) {
348
                continue;
349
            }
350
            ClassLoader l = createAuxClassLoader(lib, main, modules[i].getClassLoader());
351
            m.put(cnb, l);
259
        }
352
        }
260
        ClassLoader nbLoader = (ClassLoader)Lookup.getDefault().lookup(ClassLoader.class);
353
        return m;
261
        return new AuxClassLoader(nbLoader, main, (URL[])cp.toArray(new URL[cp.size()]));
262
    }
354
    }
263
    
355
    
264
    private static Map/*<String,Map<String,Class>>*/ createCustomDefs(File[] libs, ClassLoader aux) throws IOException {
356
    private static Map/*<String,Map<String,Class>>*/ createCustomDefs(Map cDCLs) throws IOException {
265
        Map m = new HashMap();
357
        Map m = new HashMap();
266
        Map tasks = new HashMap();
358
        Map tasks = new HashMap();
267
        Map types = new HashMap();
359
        Map types = new HashMap();
360
        // XXX #36776: should eventually support <macrodef>s here
268
        m.put("task", tasks); // NOI18N
361
        m.put("task", tasks); // NOI18N
269
        m.put("type", types); // NOI18N
362
        m.put("type", types); // NOI18N
270
        for (int i = 0; i < libs.length; i++) {
363
        Iterator it = cDCLs.entrySet().iterator();
271
            JarFile j = new JarFile(libs[i]);
364
        while (it.hasNext()) {
365
            Map.Entry entry = (Map.Entry)it.next();
366
            String cnb = (String)entry.getKey();
367
            ClassLoader l = (ClassLoader)entry.getValue();
368
            String resource = cnb.replace('.', '/') + "/antlib.xml"; // NOI18N
369
            URL antlib = l.getResource(resource);
370
            if (antlib == null) {
371
                throw new IOException("Could not find " + antlib + " in ant/nblib/" + cnb.replace('.', '-') + ".jar"); // NOI18N
372
            }
373
            Document doc;
272
            try {
374
            try {
273
                JarEntry e = j.getJarEntry("META-INF/taskdefs.properties"); // NOI18N
375
                doc = XMLUtil.parse(new InputSource(antlib.toExternalForm()), false, true, /*XXX needed?*/null, null);
274
                if (e != null) {
376
            } catch (SAXException e) {
275
                    AntModule.err.log("Loading custom taskdefs from " + libs[i]);
377
                throw (IOException)new IOException(e.toString()).initCause(e);
276
                    loadDefs(j.getInputStream(e), tasks, aux);
378
            }
379
            Element docEl = doc.getDocumentElement();
380
            if (!docEl.getLocalName().equals("antlib")) { // NOI18N
381
                throw new IOException("Bad root element for " + antlib + ": " + docEl); // NOI18N
382
            }
383
            NodeList nl = docEl.getChildNodes();
384
            Properties newTaskDefs = new Properties();
385
            Properties newTypeDefs = new Properties();
386
            for (int i = 0; i < nl.getLength(); i++) {
387
                Node n = nl.item(i);
388
                if (n.getNodeType() != Node.ELEMENT_NODE) {
389
                    continue;
277
                }
390
                }
278
                e = j.getJarEntry("META-INF/typedefs.properties"); // NOI18N
391
                Element def = (Element)n;
279
                if (e != null) {
392
                boolean type;
280
                    AntModule.err.log("Loading custom typedefs from " + libs[i]);
393
                if (def.getNodeName().equals("taskdef")) { // NOI18N
281
                    loadDefs(j.getInputStream(e), tasks, aux);
394
                    type = false;
395
                } else if (def.getNodeName().equals("typedef")) { // NOI18N
396
                    type = true;
397
                } else {
398
                    AntModule.err.log(ErrorManager.WARNING, "Warning: unrecognized definition " + def + " in " + antlib);
399
                    continue;
282
                }
400
                }
283
            } finally {
401
                String name = def.getAttribute("name"); // NOI18N
284
                j.close();
402
                if (name == null) {
403
                    // Not a hard error since there might be e.g. <taskdef resource="..."/> here
404
                    // which we do not parse but which is permitted in antlib by Ant.
405
                    AntModule.err.log(ErrorManager.WARNING, "Warning: skipping definition " + def + " with no 'name' in " + antlib);
406
                    continue;
407
                }
408
                String classname = def.getAttribute("classname"); // NOI18N
409
                if (classname == null) {
410
                    // But this is a hard error.
411
                    throw new IOException("No 'classname' attr on def of " + name + " in " + antlib); // NOI18N
412
                }
413
                // XXX would be good to handle at least onerror attr too
414
                (type ? newTypeDefs : newTaskDefs).setProperty(name, classname);
285
            }
415
            }
416
            loadDefs(newTaskDefs, tasks, l);
417
            loadDefs(newTypeDefs, types, l);
286
        }
418
        }
287
        return m;
419
        return m;
288
    }
420
    }
289
    
421
    
290
    private static void loadDefs(InputStream is, Map defs, ClassLoader l) throws IOException {
422
    private static void loadDefs(Properties p, Map defs, ClassLoader l) throws IOException {
291
        // Similar to IntrospectedInfo.load, but just picks up the classes.
423
        // Similar to IntrospectedInfo.load, after having parsed the properties.
292
        Properties p = new Properties();
293
        try {
294
            p.load(is);
295
        } finally {
296
            is.close();
297
        }
298
        Iterator it = p.entrySet().iterator();
424
        Iterator it = p.entrySet().iterator();
299
        while (it.hasNext()) {
425
        while (it.hasNext()) {
300
            Map.Entry entry = (Map.Entry)it.next();
426
            Map.Entry entry = (Map.Entry)it.next();
(-)ant/src/org/apache/tools/ant/module/bridge/AuxClassLoader.java (-5 / +5 lines)
Lines 14-20 Link Here
14
package org.apache.tools.ant.module.bridge;
14
package org.apache.tools.ant.module.bridge;
15
15
16
import java.io.IOException;
16
import java.io.IOException;
17
import java.net.*;
17
import java.net.URL;
18
import java.util.Enumeration;
18
import java.util.Enumeration;
19
import org.openide.util.enum.*;
19
import org.openide.util.enum.*;
20
20
Lines 22-29 Link Here
22
 * Loads classes in the following order:
22
 * Loads classes in the following order:
23
 * 1. JRE
23
 * 1. JRE
24
 * 2. Ant JARs - whatever is in the "main" class loader.
24
 * 2. Ant JARs - whatever is in the "main" class loader.
25
 * 3. NetBeans JARs - modules etc.
25
 * 3. Some NetBeans module class loader.
26
 * 4. Contents of $nbhome/ant/nblib/*.jar, incl. bridge.jar and special tasks.
26
 * 4. Some other JAR from $nbhome/ant/nblib/*.jar.
27
 * Lightly inspired by ProxyClassLoader, but much less complex.
27
 * Lightly inspired by ProxyClassLoader, but much less complex.
28
 * @author Jesse Glick
28
 * @author Jesse Glick
29
 */
29
 */
Lines 31-38 Link Here
31
    
31
    
32
    private final ClassLoader nbLoader;
32
    private final ClassLoader nbLoader;
33
    
33
    
34
    public AuxClassLoader(ClassLoader nbLoader, ClassLoader antLoader, URL[] urls) {
34
    public AuxClassLoader(ClassLoader nbLoader, ClassLoader antLoader, URL extraJar) {
35
        super(urls, antLoader);
35
        super(new URL[] {extraJar}, antLoader);
36
        this.nbLoader = nbLoader;
36
        this.nbLoader = nbLoader;
37
    }
37
    }
38
    
38
    
(-)ant/src/org/apache/tools/ant/module/bridge/BridgeInterface.java (+6 lines)
Lines 39-44 Link Here
39
    String getAntVersion();
39
    String getAntVersion();
40
    
40
    
41
    /**
41
    /**
42
     * Check whether Ant 1.6 is loaded.
43
     * If so, additional abilities may be possible, such as namespace support.
44
     */
45
    boolean isAnt16();
46
    
47
    /**
42
     * Get a proxy for IntrospectionHelper, to introspect task + type structure.
48
     * Get a proxy for IntrospectionHelper, to introspect task + type structure.
43
     */
49
     */
44
    IntrospectionHelperProxy getIntrospectionHelper(Class clazz);
50
    IntrospectionHelperProxy getIntrospectionHelper(Class clazz);
(-)ant/src/org/apache/tools/ant/module/bridge/DummyBridgeImpl.java (+4 lines)
Lines 38-43 Link Here
38
        return NbBundle.getMessage(DummyBridgeImpl.class, "ERR_ant_not_loadable", problem);
38
        return NbBundle.getMessage(DummyBridgeImpl.class, "ERR_ant_not_loadable", problem);
39
    }
39
    }
40
    
40
    
41
    public boolean isAnt16() {
42
        return false;
43
    }
44
    
41
    public IntrospectionHelperProxy getIntrospectionHelper(Class clazz) {
45
    public IntrospectionHelperProxy getIntrospectionHelper(Class clazz) {
42
        return this;
46
        return this;
43
    }
47
    }
(-)ant/src/org/apache/tools/ant/module/resources/mime-resolver.xml (-1 / +10 lines)
Lines 8-14 Link Here
8
http://www.sun.com/
8
http://www.sun.com/
9
9
10
The Original Code is NetBeans. The Initial Developer of the Original
10
The Original Code is NetBeans. The Initial Developer of the Original
11
Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun
11
Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
12
Microsystems, Inc. All Rights Reserved.
12
Microsystems, Inc. All Rights Reserved.
13
-->
13
-->
14
<!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN" "http://www.netbeans.org/dtds/mime-resolver-1_0.dtd">
14
<!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN" "http://www.netbeans.org/dtds/mime-resolver-1_0.dtd">
Lines 25-30 Link Here
25
                <element name="project">
25
                <element name="project">
26
                    <attr name="default"/>
26
                    <attr name="default"/>
27
                </element>
27
                </element>
28
            </xml-rule>
29
        </resolver>
30
    </file>
31
    <!-- Ant 1.6 defines antlib:org.apache.tools.ant as the master namespace: -->
32
    <file>
33
        <ext name="xml"/>
34
        <resolver mime="text/x-ant+xml">
35
            <xml-rule>
36
                <element name="project" ns="antlib:org.apache.tools.ant"/>
28
            </xml-rule>
37
            </xml-rule>
29
        </resolver>
38
        </resolver>
30
    </file>
39
    </file>
(-)ant/src-bridge/org/apache/tools/ant/module/bridge/impl/BridgeImpl.java (-10 / +54 lines)
Lines 16-21 Link Here
16
import java.io.*;
16
import java.io.*;
17
import java.lang.reflect.Field;
17
import java.lang.reflect.Field;
18
import java.lang.reflect.Modifier;
18
import java.lang.reflect.Modifier;
19
import java.net.URL;
19
import java.util.*;
20
import java.util.*;
20
import org.apache.tools.ant.*;
21
import org.apache.tools.ant.*;
21
import org.apache.tools.ant.input.InputHandler;
22
import org.apache.tools.ant.input.InputHandler;
Lines 49-54 Link Here
49
        }
50
        }
50
    }
51
    }
51
    
52
    
53
    public boolean isAnt16() {
54
        try {
55
            Class.forName("org.apache.tools.ant.taskdefs.Antlib"); // NOI18N
56
            return true;
57
        } catch (ClassNotFoundException e) {
58
            // Fine, 1.5
59
            return false;
60
        }
61
    }
62
    
52
    public IntrospectionHelperProxy getIntrospectionHelper(Class clazz) {
63
    public IntrospectionHelperProxy getIntrospectionHelper(Class clazz) {
53
        return new IntrospectionHelperImpl(clazz);
64
        return new IntrospectionHelperImpl(clazz);
54
    }
65
    }
Lines 90-105 Link Here
90
        try {
101
        try {
91
            project = new Project();
102
            project = new Project();
92
            project.init();
103
            project.init();
93
            Map customDefs = AntBridge.getCustomDefs();
104
            try {
94
            Iterator defs = ((Map)customDefs.get("task")).entrySet().iterator(); // NOI18N
105
                addCustomDefs(project);
95
            while (defs.hasNext()) {
106
            } catch (IOException e) {
96
                Map.Entry entry = (Map.Entry)defs.next();
107
                throw new BuildException(e);
97
                project.addTaskDefinition((String)entry.getKey(), (Class)entry.getValue());
98
            }
99
            defs = ((Map)customDefs.get("type")).entrySet().iterator(); // NOI18N
100
            while (defs.hasNext()) {
101
                Map.Entry entry = (Map.Entry)defs.next();
102
                project.addDataTypeDefinition((String)entry.getKey(), (Class)entry.getValue());
103
            }
108
            }
104
            project.setUserProperty("ant.file", buildFile.getAbsolutePath()); // NOI18N
109
            project.setUserProperty("ant.file", buildFile.getAbsolutePath()); // NOI18N
105
            // #14993:
110
            // #14993:
Lines 228-233 Link Here
228
        }
233
        }
229
        
234
        
230
        return ok;
235
        return ok;
236
    }
237
    
238
    private static void addCustomDefs(Project project) throws BuildException, IOException {
239
        long start = System.currentTimeMillis();
240
        if (AntBridge.getInterface().isAnt16()) {
241
            Map/*<String,ClassLoader>*/ antlibLoaders = AntBridge.getCustomDefClassLoaders();
242
            Iterator it = antlibLoaders.entrySet().iterator();
243
            while (it.hasNext()) {
244
                Map.Entry entry = (Map.Entry)it.next();
245
                String cnb = (String)entry.getKey();
246
                ClassLoader l = (ClassLoader)entry.getValue();
247
                String resource = cnb.replace('.', '/') + "/antlib.xml"; // NOI18N
248
                URL antlib = l.getResource(resource);
249
                if (antlib == null) {
250
                    throw new IOException("Could not find " + antlib + " in ant/nblib/" + cnb.replace('.', '-') + ".jar"); // NOI18N
251
                }
252
                // Once with no namespaces.
253
                NbAntlib.process(project, antlib, null, l);
254
                // Once with.
255
                String antlibUri = "antlib:" + cnb; // NOI18N
256
                NbAntlib.process(project, antlib, antlibUri, l);
257
            }
258
        } else {
259
            // For Ant 1.5, just dump in old-style defs in the simplest manner.
260
            Map customDefs = AntBridge.getCustomDefsNoNamespace();
261
            Iterator defs = ((Map)customDefs.get("task")).entrySet().iterator(); // NOI18N
262
            while (defs.hasNext()) {
263
                Map.Entry entry = (Map.Entry)defs.next();
264
                project.addTaskDefinition((String)entry.getKey(), (Class)entry.getValue());
265
            }
266
            defs = ((Map)customDefs.get("type")).entrySet().iterator(); // NOI18N
267
            while (defs.hasNext()) {
268
                Map.Entry entry = (Map.Entry)defs.next();
269
                project.addDataTypeDefinition((String)entry.getKey(), (Class)entry.getValue());
270
            }
271
        }
272
        if (AntModule.err.isLoggable(ErrorManager.INFORMATIONAL)) {
273
            AntModule.err.log("addCustomDefs took " + (System.currentTimeMillis() - start) + "msec");
274
        }
231
    }
275
    }
232
    
276
    
233
    private static boolean doHack36393 = true;
277
    private static boolean doHack36393 = true;
(-)ant/src-bridge/org/apache/tools/ant/module/bridge/impl/NbAntlib.java (+64 lines)
Added Link Here
1
/*
2
 *                 Sun Public License Notice
3
 *
4
 * The contents of this file are subject to the Sun Public License
5
 * Version 1.0 (the "License"). You may not use this file except in
6
 * compliance with the License. A copy of the License is available at
7
 * http://www.sun.com/
8
 *
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
13
14
package org.apache.tools.ant.module.bridge.impl;
15
16
import java.io.IOException;
17
import java.net.URL;
18
import org.apache.tools.ant.BuildException;
19
import org.apache.tools.ant.ComponentHelper;
20
import org.apache.tools.ant.Project;
21
import org.apache.tools.ant.UnknownElement;
22
import org.apache.tools.ant.helper.ProjectHelper2;
23
import org.apache.tools.ant.taskdefs.Antlib;
24
25
/**
26
 * Antlib subclass used to define custom tasks inside NetBeans.
27
 * Needs to be a subclass to access {@link Antlib#setClassLoader}
28
 * and {@link Antlib#setURI}.
29
 * @author Jesse Glick
30
 */
31
public final class NbAntlib extends Antlib {
32
    
33
    /**
34
     * Process antlib.xml definitions.
35
     * @param p a project to add definitions to
36
     * @param antlib location of antlib.xml to load
37
     * @param uri a URI to add definitions in, or null
38
     * @param l a class loader to load defined classes from
39
     */
40
    public static void process(Project p, URL antlib, String uri, ClassLoader l) throws IOException, BuildException {
41
        ComponentHelper helper = ComponentHelper.getComponentHelper(p);
42
        helper.enterAntLib(uri);
43
        Antlib al;
44
        try {
45
            UnknownElement antlibElement = new ProjectHelper2().parseUnknownElement(p, antlib);
46
            al = new NbAntlib(uri, l);
47
            al.setProject(p);
48
            al.setLocation(antlibElement.getLocation());
49
            al.init();
50
            antlibElement.configure(al);
51
        } finally {
52
            helper.exitAntLib();
53
        }
54
        al.execute();
55
    }
56
    
57
    private NbAntlib(String uri, ClassLoader l) {
58
        if (uri != null) {
59
            setURI(uri);
60
        }
61
        setClassLoader(l);
62
    }
63
    
64
}
(-)apisupport/ant/build.xml (-3 / +3 lines)
Lines 44-57 Link Here
44
        <jar jarfile="netbeans/modules/apisupport-ant.jar" manifest="manifest-subst.mf" compress="false">
44
        <jar jarfile="netbeans/modules/apisupport-ant.jar" manifest="manifest-subst.mf" compress="false">
45
            <fileset dir="src" excludesfile="../../nbbuild/standard-jar-excludes.txt">
45
            <fileset dir="src" excludesfile="../../nbbuild/standard-jar-excludes.txt">
46
                <exclude name="**/*.class"/>
46
                <exclude name="**/*.class"/>
47
                <exclude name="META-INF/*.properties"/>
47
                <exclude name="org/netbeans/modules/apisupport/ant/antlib.xml"/>
48
            </fileset>
48
            </fileset>
49
        </jar>
49
        </jar>
50
        <mkdir dir="netbeans/ant/nblib"/>
50
        <mkdir dir="netbeans/ant/nblib"/>
51
        <jar jarfile="netbeans/ant/nblib/nbinstaller.jar" compress="false">
51
        <jar jarfile="netbeans/ant/nblib/org-netbeans-modules-apisupport-ant.jar" compress="false">
52
            <fileset dir="src" excludesfile="../../nbbuild/standard-jar-excludes.txt">
52
            <fileset dir="src" excludesfile="../../nbbuild/standard-jar-excludes.txt">
53
                <include name="**/*.class"/>
53
                <include name="**/*.class"/>
54
                <include name="META-INF/*.properties"/>
54
                <include name="org/netbeans/modules/apisupport/ant/antlib.xml"/>
55
            </fileset>
55
            </fileset>
56
        </jar>
56
        </jar>
57
    </target>
57
    </target>
(-)apisupport/ant/manifest.mf (-2 / +2 lines)
Lines 2-9 Link Here
2
OpenIDE-Module: org.netbeans.modules.apisupport.ant
2
OpenIDE-Module: org.netbeans.modules.apisupport.ant
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/apisupport/ant/TemplateNames.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/apisupport/ant/TemplateNames.properties
4
OpenIDE-Module-Layer: org/netbeans/modules/apisupport/ant/mf-layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/apisupport/ant/mf-layer.xml
5
OpenIDE-Module-Specification-Version: 2.19
5
OpenIDE-Module-Specification-Version: 2.20
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
6
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
7
OpenIDE-Module-Module-Dependencies: org.apache.tools.ant.module/3 > 3.1, org.netbeans.core/1 > 1.1
7
OpenIDE-Module-Module-Dependencies: org.apache.tools.ant.module/3 > 3.6, org.netbeans.core/1 > 1.1
8
OpenIDE-Module-IDE-Dependencies: IDE/1 > 3.17
8
OpenIDE-Module-IDE-Dependencies: IDE/1 > 3.17
9
9
(-)apisupport/ant/src/META-INF/taskdefs.properties (-1 lines)
Removed Link Here
1
nbinstaller=org.netbeans.modules.apisupport.ant.InstallModuleTask
(-)apisupport/ant/src/org/netbeans/modules/apisupport/ant/antlib.xml (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<antlib>
3
    <taskdef name="nbinstaller" classname="org.netbeans.modules.apisupport.ant.InstallModuleTask"/>
4
</antlib>
(-)debuggerjpda/ant/build.xml (-3 / +3 lines)
Lines 45-59 Link Here
45
            <fileset dir="src">
45
            <fileset dir="src">
46
                <excludesfile name="../../nbbuild/standard-jar-excludes.txt"/>
46
                <excludesfile name="../../nbbuild/standard-jar-excludes.txt"/>
47
                <exclude name="**/*.class"/>
47
                <exclude name="**/*.class"/>
48
                <exclude name="META-INF/*.properties"/>
48
                <exclude name="org/netbeans/modules/debugger/jpda/ant/antlib.xml"/>
49
            </fileset>
49
            </fileset>
50
        </jar>
50
        </jar>
51
        <mkdir dir="netbeans/ant/nblib"/>
51
        <mkdir dir="netbeans/ant/nblib"/>
52
        <jar jarfile="netbeans/ant/nblib/nbjpdaconnect.jar" compress="false">
52
        <jar jarfile="netbeans/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar" compress="false">
53
            <fileset dir="src">
53
            <fileset dir="src">
54
                <excludesfile name="../../nbbuild/standard-jar-excludes.txt"/>
54
                <excludesfile name="../../nbbuild/standard-jar-excludes.txt"/>
55
                <include name="**/*.class"/>
55
                <include name="**/*.class"/>
56
                <include name="META-INF/*.properties"/>
56
                <include name="org/netbeans/modules/debugger/jpda/ant/antlib.xml"/>
57
            </fileset>
57
            </fileset>
58
        </jar>
58
        </jar>
59
    </target>
59
    </target>
(-)debuggerjpda/ant/manifest.mf (-2 / +2 lines)
Lines 1-9 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.debugger.jpda.ant
2
OpenIDE-Module: org.netbeans.modules.debugger.jpda.ant
3
OpenIDE-Module-Specification-Version: 1.0.7
3
OpenIDE-Module-Specification-Version: 1.1
4
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
4
OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
5
OpenIDE-Module-Module-Dependencies: 
5
OpenIDE-Module-Module-Dependencies: 
6
  org.apache.tools.ant.module/3 > 3.1,
6
  org.apache.tools.ant.module/3 > 3.6,
7
  org.netbeans.modules.debugger.jpda/1 > 1.16,
7
  org.netbeans.modules.debugger.jpda/1 > 1.16,
8
  org.netbeans.modules.debugger.core/3 > 2.10,
8
  org.netbeans.modules.debugger.core/3 > 2.10,
9
  org.openide.debugger > 1.0
9
  org.openide.debugger > 1.0
(-)debuggerjpda/ant/src/META-INF/taskdefs.properties (-1 lines)
Removed Link Here
1
nbjpdaconnect=org.netbeans.modules.debugger.jpda.ant.JPDAConnect
(-)debuggerjpda/ant/src/org/netbeans/modules/debugger/jpda/ant/antlib.xml (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<antlib>
3
    <taskdef name="nbjpdaconnect" classname="org.netbeans.modules.debugger.jpda.ant.JPDAConnect"/>
4
</antlib>
(-)autoupdate/src/org/netbeans/modules/autoupdate/SignVerifier.java (-2 / +1 lines)
Lines 36-42 Link Here
36
    private static final String ENTRY_SEPARATOR = "/";  // NOI18N
36
    private static final String ENTRY_SEPARATOR = "/";  // NOI18N
37
    private static final String NBM_BIN = "netbeans/bin"; // NOI18N
37
    private static final String NBM_BIN = "netbeans/bin"; // NOI18N
38
    private static final String NBM_LIB = "netbeans/lib"; // NOI18N
38
    private static final String NBM_LIB = "netbeans/lib"; // NOI18N
39
    private static final String NBM_ANT_NBLIB = "netbeans/ant/nblib"; // NOI18N
40
    private static final String NBM_MAIN = "main"; // NOI18N
39
    private static final String NBM_MAIN = "main"; // NOI18N
41
    private static final String NBM_MODULES = "netbeans/modules"; // NOI18N
40
    private static final String NBM_MODULES = "netbeans/modules"; // NOI18N
42
    private static final String NBM_AUTOLOAD = NBM_MODULES + ENTRY_SEPARATOR + SafeModule.PROP_AUTOLOAD; // NOI18N
41
    private static final String NBM_AUTOLOAD = NBM_MODULES + ENTRY_SEPARATOR + SafeModule.PROP_AUTOLOAD; // NOI18N
Lines 239-245 Link Here
239
                JarEntry entry = (JarEntry)entries.nextElement();
238
                JarEntry entry = (JarEntry)entries.nextElement();
240
239
241
                // dangerous modules should be updated into install directory
240
                // dangerous modules should be updated into install directory
242
                if ( entry.getName().startsWith( NBM_LIB ) || entry.getName().startsWith( NBM_BIN ) || entry.getName().startsWith( NBM_ANT_NBLIB ))
241
                if ( entry.getName().startsWith( NBM_LIB ) || entry.getName().startsWith( NBM_BIN ))
243
                    mu.setDepending( true );
242
                    mu.setDepending( true );
244
                
243
                
245
                if ( entry.getName().startsWith( NBM_MAIN ) )
244
                if ( entry.getName().startsWith( NBM_MAIN ) )

Return to bug 38306