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

(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/Evaluator.java (-1 / +1 lines)
Lines 287-293 Link Here
287
            assert nbroot != null : "netbeans.org-type module not in a complete netbeans.org source root " + dir;
287
            assert nbroot != null : "netbeans.org-type module not in a complete netbeans.org source root " + dir;
288
            stock.put("nb_all", nbroot.getAbsolutePath()); // NOI18N
288
            stock.put("nb_all", nbroot.getAbsolutePath()); // NOI18N
289
            // Only needed for netbeans.org modules, since for external modules suite.properties suffices.
289
            // Only needed for netbeans.org modules, since for external modules suite.properties suffices.
290
            stock.put("netbeans.dest.dir", new File(nbroot, ModuleList.DEST_DIR_IN_NETBEANS_ORG).getAbsolutePath()); // NOI18N
290
            stock.put("netbeans.dest.dir", ModuleList.findNetBeansOrgDestDir(nbroot).getAbsolutePath()); // NOI18N
291
        } else {
291
        } else {
292
            nbroot = null;
292
            nbroot = null;
293
        }
293
        }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/NbModuleProject.java (-1 / +1 lines)
Lines 158-164 Link Here
158
        typeProvider = new NbModuleProviderImpl();
158
        typeProvider = new NbModuleProviderImpl();
159
        if (typeProvider.getModuleType() == NbModuleProvider.NETBEANS_ORG && ModuleList.findNetBeansOrg(getProjectDirectoryFile()) == null) {
159
        if (typeProvider.getModuleType() == NbModuleProvider.NETBEANS_ORG && ModuleList.findNetBeansOrg(getProjectDirectoryFile()) == null) {
160
            // #69097: preferable to throwing an assertion error later...
160
            // #69097: preferable to throwing an assertion error later...
161
            throw new IOException("netbeans.org-type module not in a complete netbeans.org source root: " + this); // NOI18N
161
            throw new IOException("netbeans.org-type module requires at least nbbuild: " + FileUtil.getFileDisplayName(helper.getProjectDirectory())); // NOI18N
162
        }
162
        }
163
        eval = new Evaluator(this, typeProvider);
163
        eval = new Evaluator(this, typeProvider);
164
        // XXX could add globs for other package roots too
164
        // XXX could add globs for other package roots too
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/queries/SubprojectProviderImpl.java (-1 / +1 lines)
Lines 110-116 Link Here
110
            }
110
            }
111
            File moduleProjectDirF = module.getSourceLocation();
111
            File moduleProjectDirF = module.getSourceLocation();
112
            if (moduleProjectDirF == null) {
112
            if (moduleProjectDirF == null) {
113
                Util.err.log(ErrorManager.WARNING, "Warning - could not find sources for dependent module " + cnb + " for " + project);
113
                // Do not log, this is pretty normal.
114
                continue;
114
                continue;
115
            }
115
            }
116
            FileObject moduleProjectDir = FileUtil.toFileObject(moduleProjectDirF);
116
            FileObject moduleProjectDir = FileUtil.toFileObject(moduleProjectDirF);
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/universe/ModuleList.java (-11 / +65 lines)
Lines 95-103 Link Here
95
    static int xmlFilesParsed;
95
    static int xmlFilesParsed;
96
    static int directoriesChecked;
96
    static int directoriesChecked;
97
    static int jarsOpened;
97
    static int jarsOpened;
98
    
98
99
    public static final String DEST_DIR_IN_NETBEANS_ORG = "nbbuild" + File.separatorChar + "netbeans"; // NOI18N
100
    
101
    /** Synch with org.netbeans.nbbuild.ModuleListParser.FOREST: */
99
    /** Synch with org.netbeans.nbbuild.ModuleListParser.FOREST: */
102
    private static final String[] FOREST = {
100
    private static final String[] FOREST = {
103
        /*root*/null,
101
        /*root*/null,
Lines 237-251 Link Here
237
    static ModuleList findOrCreateModuleListFromNetBeansOrgSources(File root) throws IOException {
235
    static ModuleList findOrCreateModuleListFromNetBeansOrgSources(File root) throws IOException {
238
        ModuleList list = sourceLists.get(root);
236
        ModuleList list = sourceLists.get(root);
239
        if (list == null) {
237
        if (list == null) {
240
            list = createModuleListFromNetBeansOrgSources(root);
238
            File nbdestdir = findNetBeansOrgDestDir(root);
239
            if (nbdestdir.equals(new File(new File(root, "nbbuild"), "netbeans"))) { // NOI18N
240
                list = createModuleListFromNetBeansOrgSources(root, nbdestdir);
241
            } else {
242
                // #143236: have a customized dest dir, perhaps referenced from orphan modules.
243
                Map<String, ModuleEntry> entries = new HashMap<String, ModuleEntry>();
244
                doScanNetBeansOrgSources(entries, root, 1, root, nbdestdir, null, false);
245
                ModuleList sources = new ModuleList(entries, root, false);
246
                ModuleList binaries = createModuleListFromBinaries(nbdestdir);
247
                list = merge(new ModuleList[] {sources, binaries}, root);
248
            }
241
            sourceLists.put(root, list);
249
            sourceLists.put(root, list);
242
        }
250
        }
243
        return list;
251
        return list;
244
    }
252
    }
245
    
253
246
    private static ModuleList createModuleListFromNetBeansOrgSources(File root) throws IOException {
254
    /**
255
     * Gets the platform build directory associated with a netbeans.org source root.
256
     * Normally nbbuild/netbeans/ but can be overridden.
257
     * @param nb_all the (possibly partial) netbeans.org source root
258
     */
259
    public static File findNetBeansOrgDestDir(File nb_all) {
260
        synchronized (netbeansOrgDestDirs) {
261
            File d = netbeansOrgDestDirs.get(nb_all);
262
            if (d == null) {
263
                File nbbuild = new File(nb_all, "nbbuild"); // NOI18N
264
                d = checkForNetBeansOrgDestDir(new File(nbbuild, "user.build.properties")); // NOI18N
265
                if (d == null) {
266
                    d = checkForNetBeansOrgDestDir(new File(nbbuild, "site.build.properties")); // NOI18N
267
                    if (d == null) {
268
                        d = checkForNetBeansOrgDestDir(new File(System.getProperty("user.home"), ".nbbuild.properties")); // NOI18N
269
                        if (d == null) {
270
                            d = new File(nbbuild, "netbeans"); // NOI18N
271
                        }
272
                    }
273
                }
274
                netbeansOrgDestDirs.put(nb_all, d);
275
            }
276
            return d;
277
        }
278
    }
279
    private static final Map<File,File> netbeansOrgDestDirs = new HashMap<File,File>();
280
    private static File checkForNetBeansOrgDestDir(File properties) {
281
        if (properties.isFile()) {
282
            try {
283
                InputStream is = new FileInputStream(properties);
284
                try {
285
                    Properties p = new Properties();
286
                    p.load(is);
287
                    String d = p.getProperty("netbeans.dest.dir"); // NOI18N
288
                    if (d != null) {
289
                        return new File(d);
290
                    }
291
                } finally {
292
                    is.close();
293
                }
294
            } catch (IOException x) {
295
                LOG.log(Level.INFO, "Could not read " + properties, x);
296
            }
297
        }
298
        return null;
299
    }
300
301
    private static ModuleList createModuleListFromNetBeansOrgSources(File root, File nbdestdir) throws IOException {
247
        Util.err.log("ModuleList.createModuleListFromSources: " + root);
302
        Util.err.log("ModuleList.createModuleListFromSources: " + root);
248
        File nbdestdir = new File(root, DEST_DIR_IN_NETBEANS_ORG);
249
        try {
303
        try {
250
            return loadNetBeansOrgCachedModuleList(root, nbdestdir);
304
            return loadNetBeansOrgCachedModuleList(root, nbdestdir);
251
        } catch (IOException x) {
305
        } catch (IOException x) {
Lines 870-876 Link Here
870
        boolean isNetBeansOrg = !suiteComponent && !standalone;
924
        boolean isNetBeansOrg = !suiteComponent && !standalone;
871
        if (isNetBeansOrg) {
925
        if (isNetBeansOrg) {
872
            defaults.put("nb_all", root.getAbsolutePath()); // NOI18N
926
            defaults.put("nb_all", root.getAbsolutePath()); // NOI18N
873
            defaults.put("netbeans.dest.dir", new File(root, DEST_DIR_IN_NETBEANS_ORG).getAbsolutePath()); // NOI18N
927
            defaults.put("netbeans.dest.dir", findNetBeansOrgDestDir(root).getAbsolutePath()); // NOI18N
874
        }
928
        }
875
        defaults.put("code.name.base.dashes", cnb.replace('.', '-')); // NOI18N
929
        defaults.put("code.name.base.dashes", cnb.replace('.', '-')); // NOI18N
876
        defaults.put("module.jar.dir", "modules"); // NOI18N
930
        defaults.put("module.jar.dir", "modules"); // NOI18N
Lines 951-957 Link Here
951
                } else {
1005
                } else {
952
                    continue;
1006
                    continue;
953
                }
1007
                }
954
                if (new File(mainrepo, "nbbuild").isDirectory() && new File(mainrepo, "openide.util").isDirectory()) { // NOI18N
1008
                if (new File(mainrepo, "nbbuild").isDirectory()) { // NOI18N
955
                    return mainrepo;
1009
                    return mainrepo;
956
                }
1010
                }
957
            }
1011
            }
Lines 1059-1065 Link Here
1059
    private void maybeRescanNetBeansOrgSources() {
1113
    private void maybeRescanNetBeansOrgSources() {
1060
        if (lazyNetBeansOrgList) {
1114
        if (lazyNetBeansOrgList) {
1061
            lazyNetBeansOrgList = false;
1115
            lazyNetBeansOrgList = false;
1062
            File nbdestdir = new File(home, DEST_DIR_IN_NETBEANS_ORG);
1116
            File nbdestdir = findNetBeansOrgDestDir(home);
1063
            Map<String,ModuleEntry> _entries = new HashMap<String,ModuleEntry>(entries); // #68513: possible race condition
1117
            Map<String,ModuleEntry> _entries = new HashMap<String,ModuleEntry>(entries); // #68513: possible race condition
1064
            if (new File(home, "openide.util").isDirectory()) { // NOI18N
1118
            if (new File(home, "openide.util").isDirectory()) { // NOI18N
1065
                // Post-Hg layout.
1119
                // Post-Hg layout.
Lines 1085-1091 Link Here
1085
            return e;
1139
            return e;
1086
        }
1140
        }
1087
        if (isNetBeansOrg(home)) {
1141
        if (isNetBeansOrg(home)) {
1088
            File nbdestdir = new File(home, DEST_DIR_IN_NETBEANS_ORG);
1142
            File nbdestdir = findNetBeansOrgDestDir(home);
1089
            for (String tree : FOREST) {
1143
            for (String tree : FOREST) {
1090
                String name = abbreviate(codeNameBase);
1144
                String name = abbreviate(codeNameBase);
1091
                File basedir = new File(tree == null ? home : new File(home, tree), name);
1145
                File basedir = new File(tree == null ? home : new File(home, tree), name);
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/universe/NetBeansOrgEntry.java (-1 / +1 lines)
Lines 90-96 Link Here
90
    }
90
    }
91
    
91
    
92
    public File getDestDir() {
92
    public File getDestDir() {
93
        return new File(nball, ModuleList.DEST_DIR_IN_NETBEANS_ORG);
93
        return ModuleList.findNetBeansOrgDestDir(nball);
94
    }
94
    }
95
    
95
    
96
    public String getCodeNameBase() {
96
    public String getCodeNameBase() {

Return to bug 143236