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

(-)ide/applemenu/manifest.mf (+1 lines)
Lines 4-9 Link Here
4
OpenIDE-Module-Install: org/netbeans/modules/applemenu/Install.class
4
OpenIDE-Module-Install: org/netbeans/modules/applemenu/Install.class
5
OpenIDE-Module-Layer: org/netbeans/modules/applemenu/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/applemenu/layer.xml
6
OpenIDE-Module-Specification-Version: 1.1
6
OpenIDE-Module-Specification-Version: 1.1
7
OpenIDE-Module-Requires: org.openide.modules.os.MacOSX
7
8
8
9
9
10
(-)ide/applemenu/nbproject/project.properties (+1 lines)
Lines 11-13 Link Here
11
11
12
nbm.needs.restart=true
12
nbm.needs.restart=true
13
cp.extra=eawtstub/dist/eawtstub.jar
13
cp.extra=eawtstub/dist/eawtstub.jar
14
is.eager=true
(-)core/src/org/netbeans/core/modules/Module.java (+12 lines)
Lines 438-443 Link Here
438
                    throw new IllegalArgumentException("Duplicate entries in OpenIDE-Module-Provides: " + providesS); // NOI18N
438
                    throw new IllegalArgumentException("Duplicate entries in OpenIDE-Module-Provides: " + providesS); // NOI18N
439
                }
439
                }
440
            }
440
            }
441
            String[] additionalProvides = mgr.refineProvides (this);
442
            if (additionalProvides != null) {
443
                if (provides == null) {
444
                    provides = additionalProvides;
445
                } else {
446
                    ArrayList l = new ArrayList ();
447
                    l.addAll (Arrays.asList (provides));
448
                    l.addAll (Arrays.asList (additionalProvides));
449
                    provides = (String[])l.toArray (provides);
450
                }
451
            }
452
            
441
            // Exports
453
            // Exports
442
            String exportsS = attr.getValue("OpenIDE-Module-Public-Packages"); // NOI18N
454
            String exportsS = attr.getValue("OpenIDE-Module-Public-Packages"); // NOI18N
443
            if (exportsS != null) {
455
            if (exportsS != null) {
(-)core/src/org/netbeans/core/modules/ModuleInstaller.java (+8 lines)
Lines 156-161 Link Here
156
    public void refineClassLoader(Module m, List parents) {
156
    public void refineClassLoader(Module m, List parents) {
157
        // do nothing
157
        // do nothing
158
    }
158
    }
159
160
    /** Optionally adds additional token for the module.
161
     * @param m the module to add token to 
162
     * @return null or list of tokens this module provides
163
     */
164
    public String[] refineProvides (Module m) {
165
        return null;
166
    }
159
    
167
    
160
    /** Is this package special in that the package domain cache should be disabled for it?
168
    /** Is this package special in that the package domain cache should be disabled for it?
161
     * The result must never change between subsequent calls for the same argument.
169
     * The result must never change between subsequent calls for the same argument.
(-)core/src/org/netbeans/core/modules/ModuleManager.java (+5 lines)
Lines 500-505 Link Here
500
    void refineDependencies(Module m, Set dependencies) {
500
    void refineDependencies(Module m, Set dependencies) {
501
        installer.refineDependencies(m, dependencies);
501
        installer.refineDependencies(m, dependencies);
502
    }
502
    }
503
    /** Allows the installer to add provides (used to provide name of platform we run on)
504
     */
505
    String[] refineProvides (Module m) {
506
        return installer.refineProvides (m);
507
    }
503
    /** Used by Module to communicate with the ModuleInstaller re. classloader. */
508
    /** Used by Module to communicate with the ModuleInstaller re. classloader. */
504
    void refineClassLoader(Module m, List parents) {
509
    void refineClassLoader(Module m, List parents) {
505
        // #27853:
510
        // #27853:
(-)core/src/org/netbeans/core/modules/NbInstaller.java (+15 lines)
Lines 721-726 Link Here
721
        }
721
        }
722
    }
722
    }
723
    
723
    
724
    public String[] refineProvides (Module m) {
725
        String token = null;
726
        if (m.getCodeNameBase ().equals ("org.openide")) { // NOI18N
727
            if (org.openide.util.Utilities.isUnix ()) {
728
                token = "org.openide.modules.os.Unix"; // NOI18N
729
            } else if (org.openide.util.Utilities.isWindows ()) {
730
                token = "org.openide.modules.os.Windows"; // NOI18N
731
            } else if ((org.openide.util.Utilities.getOperatingSystem () & org.openide.util.Utilities.OS_MAC) != 0) {
732
                token = "org.openide.modules.os.MacOSX"; // NOI18N
733
            }
734
        }
735
        return token == null ? null : new String[] { token };
736
    }
737
    
738
    
724
    private void addLoadersRecursively(List parents, Dependency[] deps, Set parentModules, Module master, Set addedParentNames) {
739
    private void addLoadersRecursively(List parents, Dependency[] deps, Set parentModules, Module master, Set addedParentNames) {
725
        for (int i = 0; i < deps.length; i++) {
740
        for (int i = 0; i < deps.length; i++) {
726
            if (deps[i].getType() != Dependency.TYPE_MODULE) {
741
            if (deps[i].getType() != Dependency.TYPE_MODULE) {
(-)core/test/unit/src/org/netbeans/core/modules/PlatformDependencySatisfied.java (+88 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.netbeans.core.modules;
15
16
import java.io.*;
17
import java.io.File;
18
import java.util.Collections;
19
import java.util.Locale;
20
import java.util.jar.*;
21
import org.netbeans.junit.*;
22
import junit.textui.TestRunner;
23
import org.openide.filesystems.Repository;
24
import org.netbeans.core.NbTopManager;
25
26
/** Checks whether a module with generated
27
 * @author Jaroslav Tulach
28
 */
29
public class PlatformDependencySatisfied extends SetupHid {
30
    private File moduleJarFile;
31
    
32
    public PlatformDependencySatisfied(String name) {
33
        super(name);
34
    }
35
    
36
    public static void main(String[] args) {
37
        TestRunner.run(new NbTestSuite(PlatformDependencySatisfied.class));
38
    }
39
    
40
    protected void setUp() throws Exception {
41
        super.setUp();
42
        System.setProperty("org.netbeans.core.modules.NbInstaller.noAutoDeps", "true");
43
        
44
        File tmp = File.createTempFile ("PlatformDependencySatisfiedModule", ".jar");
45
        moduleJarFile = tmp;
46
        
47
        Manifest man = new Manifest ();
48
        man.getMainAttributes ().putValue ("Manifest-Version", "1.0");
49
        man.getMainAttributes ().putValue ("OpenIDE-Module", "org.test.PlatformDependency/1");
50
        
51
        String req = null;
52
        if (org.openide.util.Utilities.isWindows ()) {
53
            req = "org.openide.modules.os.Windows";
54
        } else if (org.openide.util.Utilities.isUnix ()) {
55
            req = "org.openide.modules.os.Unix";
56
        } else if ((org.openide.util.Utilities.getOperatingSystem () & org.openide.util.Utilities.OS_MAC) != 0) {
57
            req = "org.openide.modules.os.MacOSX";
58
        }
59
        assertNotNull ("This test is supposed to run on windows, unix and macosx, fail otherwise on this line", req);
60
        
61
        man.getMainAttributes ().putValue ("OpenIDE-Module-Requires", req);
62
        
63
        JarOutputStream os = new JarOutputStream (new FileOutputStream (tmp), man);
64
        os.putNextEntry (new JarEntry ("empty/test.txt"));
65
        os.close ();
66
    }
67
    
68
    /**  */
69
    public void testTryToInstallTheModuleWhichRequiresTheOS () throws Exception {
70
        NbTopManager.get(); // init module system
71
        final FakeEvents ev = new FakeEvents();
72
        NbInstaller installer = new NbInstaller(ev);
73
        ModuleManager mgr = new ModuleManager(installer, ev);
74
        installer.registerManager(mgr);
75
        mgr.mutexPrivileged().enterWriteAccess();
76
        try {
77
            addOpenide(mgr);
78
            Module m1 = mgr.create(moduleJarFile, null, false, false, false);
79
            assertEquals(Collections.EMPTY_SET, m1.getProblems());
80
            mgr.enable(m1);
81
            mgr.disable(m1);
82
            mgr.delete(m1);
83
        } finally {
84
            mgr.mutexPrivileged().exitWriteAccess();
85
        }
86
    }
87
88
}

Return to bug 46833