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 929-937
Link Here
|
929 |
* Whether whether a given dir is root of netbeans.org sources. |
983 |
* Whether whether a given dir is root of netbeans.org sources. |
930 |
*/ |
984 |
*/ |
931 |
public static boolean isNetBeansOrg(File dir) { |
985 |
public static boolean isNetBeansOrg(File dir) { |
932 |
return new File(dir, "nbbuild").isDirectory() && // NOI18N |
986 |
return new File(dir, "nbbuild").isDirectory(); // NOI18N |
933 |
// Check for both pre- and post-Hg layouts. |
|
|
934 |
(new File(dir, "core").isDirectory() || new File(dir, "openide.util").isDirectory()); // NOI18N |
935 |
} |
987 |
} |
936 |
|
988 |
|
937 |
/** |
989 |
/** |
Lines 951-957
Link Here
|
951 |
} else { |
1003 |
} else { |
952 |
continue; |
1004 |
continue; |
953 |
} |
1005 |
} |
954 |
if (new File(mainrepo, "nbbuild").isDirectory() && new File(mainrepo, "openide.util").isDirectory()) { // NOI18N |
1006 |
if (new File(mainrepo, "nbbuild").isDirectory()) { // NOI18N |
955 |
return mainrepo; |
1007 |
return mainrepo; |
956 |
} |
1008 |
} |
957 |
} |
1009 |
} |
Lines 1059-1065
Link Here
|
1059 |
private void maybeRescanNetBeansOrgSources() { |
1111 |
private void maybeRescanNetBeansOrgSources() { |
1060 |
if (lazyNetBeansOrgList) { |
1112 |
if (lazyNetBeansOrgList) { |
1061 |
lazyNetBeansOrgList = false; |
1113 |
lazyNetBeansOrgList = false; |
1062 |
File nbdestdir = new File(home, DEST_DIR_IN_NETBEANS_ORG); |
1114 |
File nbdestdir = findNetBeansOrgDestDir(home); |
1063 |
Map<String,ModuleEntry> _entries = new HashMap<String,ModuleEntry>(entries); // #68513: possible race condition |
1115 |
Map<String,ModuleEntry> _entries = new HashMap<String,ModuleEntry>(entries); // #68513: possible race condition |
1064 |
if (new File(home, "openide.util").isDirectory()) { // NOI18N |
1116 |
if (new File(home, "openide.util").isDirectory()) { // NOI18N |
1065 |
// Post-Hg layout. |
1117 |
// Post-Hg layout. |
Lines 1085-1091
Link Here
|
1085 |
return e; |
1137 |
return e; |
1086 |
} |
1138 |
} |
1087 |
if (isNetBeansOrg(home)) { |
1139 |
if (isNetBeansOrg(home)) { |
1088 |
File nbdestdir = new File(home, DEST_DIR_IN_NETBEANS_ORG); |
1140 |
File nbdestdir = findNetBeansOrgDestDir(home); |
1089 |
for (String tree : FOREST) { |
1141 |
for (String tree : FOREST) { |
1090 |
String name = abbreviate(codeNameBase); |
1142 |
String name = abbreviate(codeNameBase); |
1091 |
File basedir = new File(tree == null ? home : new File(home, tree), name); |
1143 |
File basedir = new File(tree == null ? home : new File(home, tree), name); |