src/share/classes/com/sun/tools/sjavac/BuildState.java

changeset 2039
0cfd5baa7154
parent 1504
22e417cdddee
child 2525
2eb010b6cb22
equal deleted inserted replaced
2038:8d1c48de706d 2039:0cfd5baa7154
1 /* 1 /*
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
79 String mod = pkg.substring(0, cp); 79 String mod = pkg.substring(0, cp);
80 return lookupModule(mod); 80 return lookupModule(mod);
81 } 81 }
82 82
83 /** 83 /**
84 * Collect all packages, sources and artifacts for all modules 84 * Store references to all packages, sources and artifacts for all modules
85 * into the build state. 85 * into the build state. I.e. flatten the module tree structure
86 * into global maps stored in the BuildState for easy access.
86 * 87 *
87 * @param m The set of modules. 88 * @param m The set of modules.
88 */ 89 */
89 public void collectPackagesSourcesAndArtifacts(Map<String,Module> m) { 90 public void flattenPackagesSourcesAndArtifacts(Map<String,Module> m) {
90 modules = m; 91 modules = m;
91 // Extract all the found packages. 92 // Extract all the found packages.
92 for (Module i : modules.values()) { 93 for (Module i : modules.values()) {
93 for (Map.Entry<String,Package> j : i.packages().entrySet()) { 94 for (Map.Entry<String,Package> j : i.packages().entrySet()) {
94 Package p = packages.get(j.getKey()); 95 Package p = packages.get(j.getKey());
119 } 120 }
120 } 121 }
121 } 122 }
122 123
123 /** 124 /**
124 * Collect all the artifacts of all modules and packages. 125 * Store references to all artifacts found in the module tree into the maps
126 * stored in the build state.
125 * 127 *
126 * @param m The set of modules. 128 * @param m The set of modules.
127 */ 129 */
128 public void collectArtifacts(Map<String,Module> m) { 130 public void flattenArtifacts(Map<String,Module> m) {
129 modules = m; 131 modules = m;
130 // Extract all the found packages. 132 // Extract all the found packages.
131 for (Module i : modules.values()) { 133 for (Module i : modules.values()) {
132 for (Map.Entry<String,Package> j : i.packages().entrySet()) { 134 for (Map.Entry<String,Package> j : i.packages().entrySet()) {
133 Package p = packages.get(j.getKey()); 135 Package p = packages.get(j.getKey());
268 // Do not copy recompiled or removed packages. 270 // Do not copy recompiled or removed packages.
269 if (recompiled.contains(pkg) || removed.contains(pkg)) continue; 271 if (recompiled.contains(pkg) || removed.contains(pkg)) continue;
270 Module mnew = findModuleFromPackageName(pkg); 272 Module mnew = findModuleFromPackageName(pkg);
271 Package pprev = prev.packages().get(pkg); 273 Package pprev = prev.packages().get(pkg);
272 mnew.addPackage(pprev); 274 mnew.addPackage(pprev);
275 // Do not forget to update the flattened data.
276 packages.put(pkg, pprev);
273 } 277 }
274 } 278 }
275 } 279 }

mercurial