69 private String name; |
69 private String name; |
70 // The directory path to the package. If the package belongs to a module, |
70 // The directory path to the package. If the package belongs to a module, |
71 // then that module's file system name is part of the path. |
71 // then that module's file system name is part of the path. |
72 private String dirname; |
72 private String dirname; |
73 // This package depends on these packages. |
73 // This package depends on these packages. |
74 private Set<String> dependencies = new HashSet<String>(); |
74 private Set<String> dependencies = new HashSet<>(); |
75 // This package has the following dependents, that depend on this package. |
75 // This package has the following dependents, that depend on this package. |
76 private Set<String> dependents = new HashSet<String>(); |
76 private Set<String> dependents = new HashSet<>(); |
77 // This is the public api of this package. |
77 // This is the public api of this package. |
78 private List<String> pubapi = new ArrayList<String>(); |
78 private List<String> pubapi = new ArrayList<>(); |
79 // Map from source file name to Source info object. |
79 // Map from source file name to Source info object. |
80 private Map<String,Source> sources = new HashMap<String,Source>(); |
80 private Map<String,Source> sources = new HashMap<>(); |
81 // This package generated these artifacts. |
81 // This package generated these artifacts. |
82 private Map<String,File> artifacts = new HashMap<String,File>(); |
82 private Map<String,File> artifacts = new HashMap<>(); |
83 |
83 |
84 public Package(Module m, String n) { |
84 public Package(Module m, String n) { |
85 int c = n.indexOf(":"); |
85 int c = n.indexOf(":"); |
86 assert(c != -1); |
86 assert(c != -1); |
87 String mn = n.substring(0,c); |
87 String mn = n.substring(0,c); |
211 String pi = l.substring(2); |
211 String pi = l.substring(2); |
212 addPubapi(pi); |
212 addPubapi(pi); |
213 } |
213 } |
214 |
214 |
215 public void saveDependencies(StringBuilder b) { |
215 public void saveDependencies(StringBuilder b) { |
216 List<String> sorted_dependencies = new ArrayList<String>(); |
216 List<String> sorted_dependencies = new ArrayList<>(); |
217 for (String key : dependencies) { |
217 for (String key : dependencies) { |
218 sorted_dependencies.add(key); |
218 sorted_dependencies.add(key); |
219 } |
219 } |
220 Collections.sort(sorted_dependencies); |
220 Collections.sort(sorted_dependencies); |
221 for (String a : sorted_dependencies) { |
221 for (String a : sorted_dependencies) { |
228 b.append("I "+l+"\n"); |
228 b.append("I "+l+"\n"); |
229 } |
229 } |
230 } |
230 } |
231 |
231 |
232 public static void savePackages(Map<String,Package> packages, StringBuilder b) { |
232 public static void savePackages(Map<String,Package> packages, StringBuilder b) { |
233 List<String> sorted_packages = new ArrayList<String>(); |
233 List<String> sorted_packages = new ArrayList<>(); |
234 for (String key : packages.keySet() ) { |
234 for (String key : packages.keySet() ) { |
235 sorted_packages.add(key); |
235 sorted_packages.add(key); |
236 } |
236 } |
237 Collections.sort(sorted_packages); |
237 Collections.sort(sorted_packages); |
238 for (String s : sorted_packages) { |
238 for (String s : sorted_packages) { |
255 } |
255 } |
256 } |
256 } |
257 |
257 |
258 public void setArtifacts(Set<URI> as) { |
258 public void setArtifacts(Set<URI> as) { |
259 assert(!artifacts.isEmpty()); |
259 assert(!artifacts.isEmpty()); |
260 artifacts = new HashMap<String,File>(); |
260 artifacts = new HashMap<>(); |
261 addArtifacts(as); |
261 addArtifacts(as); |
262 } |
262 } |
263 |
263 |
264 public void loadArtifact(String l) { |
264 public void loadArtifact(String l) { |
265 // Find next space after "A ". |
265 // Find next space after "A ". |
277 } |
277 } |
278 artifacts.put(f.getPath(), f); |
278 artifacts.put(f.getPath(), f); |
279 } |
279 } |
280 |
280 |
281 public void saveArtifacts(StringBuilder b) { |
281 public void saveArtifacts(StringBuilder b) { |
282 List<File> sorted_artifacts = new ArrayList<File>(); |
282 List<File> sorted_artifacts = new ArrayList<>(); |
283 for (File f : artifacts.values()) { |
283 for (File f : artifacts.values()) { |
284 sorted_artifacts.add(f); |
284 sorted_artifacts.add(f); |
285 } |
285 } |
286 Collections.sort(sorted_artifacts); |
286 Collections.sort(sorted_artifacts); |
287 for (File f : sorted_artifacts) { |
287 for (File f : sorted_artifacts) { |