]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.build/src/org/argeo/slc/build/A2Factory.java
First complete base distribution with the new approach (Argeo Commons
[gpl/argeo-slc.git] / org.argeo.slc.build / src / org / argeo / slc / build / A2Factory.java
1 package org.argeo.slc.build;
2
3 import static java.lang.System.Logger.Level.DEBUG;
4 import static org.argeo.slc.ManifestConstants.BUNDLE_LICENSE;
5 import static org.argeo.slc.ManifestConstants.BUNDLE_SYMBOLICNAME;
6 import static org.argeo.slc.ManifestConstants.BUNDLE_VERSION;
7 import static org.argeo.slc.ManifestConstants.SLC_ORIGIN_M2;
8
9 import java.io.FileNotFoundException;
10 import java.io.IOException;
11 import java.io.InputStream;
12 import java.io.OutputStream;
13 import java.io.Writer;
14 import java.lang.System.Logger;
15 import java.lang.System.Logger.Level;
16 import java.net.URL;
17 import java.nio.file.DirectoryStream;
18 import java.nio.file.FileSystem;
19 import java.nio.file.FileSystems;
20 import java.nio.file.FileVisitResult;
21 import java.nio.file.Files;
22 import java.nio.file.Path;
23 import java.nio.file.PathMatcher;
24 import java.nio.file.Paths;
25 import java.nio.file.SimpleFileVisitor;
26 import java.nio.file.attribute.BasicFileAttributes;
27 import java.util.ArrayList;
28 import java.util.HashMap;
29 import java.util.List;
30 import java.util.Map;
31 import java.util.Properties;
32 import java.util.TreeMap;
33 import java.util.jar.Attributes;
34 import java.util.jar.JarEntry;
35 import java.util.jar.JarInputStream;
36 import java.util.jar.JarOutputStream;
37 import java.util.jar.Manifest;
38
39 import org.argeo.slc.DefaultNameVersion;
40 import org.argeo.slc.ManifestConstants;
41 import org.argeo.slc.NameVersion;
42 import org.argeo.slc.build.m2.DefaultArtifact;
43 import org.argeo.slc.build.m2.MavenConventionsUtils;
44
45 import aQute.bnd.osgi.Analyzer;
46 import aQute.bnd.osgi.Jar;
47
48 public class A2Factory {
49 private final static Logger logger = System.getLogger(A2Factory.class.getName());
50
51 private final static String COMMON_BND = "common.bnd";
52
53 private Path originBase;
54 private Path factoryBase;
55
56 /** key is URI prefix, value list of base URLs */
57 private Map<String, List<String>> mirrors = new HashMap<String, List<String>>();
58
59 public A2Factory(Path originBase, Path factoryBase) {
60 super();
61 this.originBase = originBase;
62 this.factoryBase = factoryBase;
63
64 // TODO make it configurable
65 List<String> eclipseMirrors = new ArrayList<>();
66 eclipseMirrors.add("https://archive.eclipse.org/");
67
68 mirrors.put("http://www.eclipse.org/downloads", eclipseMirrors);
69 }
70
71 public void processCategory(Path targetCategoryBase) {
72 try {
73 DirectoryStream<Path> bnds = Files.newDirectoryStream(targetCategoryBase,
74 (p) -> p.getFileName().toString().endsWith(".bnd")
75 && !p.getFileName().toString().equals(COMMON_BND));
76 for (Path p : bnds) {
77 processSingleM2ArtifactDistributionUnit(p);
78 }
79
80 DirectoryStream<Path> dus = Files.newDirectoryStream(targetCategoryBase, (p) -> Files.isDirectory(p));
81 for (Path duDir : dus) {
82 processM2BasedDistributionUnit(duDir);
83 }
84 } catch (IOException e) {
85 throw new RuntimeException("Cannot process category " + targetCategoryBase, e);
86 }
87 }
88
89 public void processSingleM2ArtifactDistributionUnit(Path bndFile) {
90 try {
91 String category = bndFile.getParent().getFileName().toString();
92 Path targetCategoryBase = factoryBase.resolve(category);
93 Properties fileProps = new Properties();
94 try (InputStream in = Files.newInputStream(bndFile)) {
95 fileProps.load(in);
96 }
97
98 String m2Coordinates = fileProps.getProperty(SLC_ORIGIN_M2.toString());
99 if (m2Coordinates == null)
100 throw new IllegalArgumentException("No M2 coordinates available for " + bndFile);
101 DefaultArtifact artifact = new DefaultArtifact(m2Coordinates);
102 URL url = MavenConventionsUtils.mavenCentralUrl(artifact);
103 Path downloaded = download(url, originBase, artifact.toM2Coordinates() + ".jar");
104
105 Path targetBundleDir = processBndJar(downloaded, targetCategoryBase, fileProps, artifact);
106
107 downloadAndProcessM2Sources(artifact, targetBundleDir);
108
109 createJar(targetBundleDir);
110 } catch (Exception e) {
111 throw new RuntimeException("Cannot process " + bndFile, e);
112 }
113 }
114
115 public void processM2BasedDistributionUnit(Path duDir) {
116 try {
117 String category = duDir.getParent().getFileName().toString();
118 Path targetCategoryBase = factoryBase.resolve(category);
119 Path commonBnd = duDir.resolve(COMMON_BND);
120 Properties commonProps = new Properties();
121 try (InputStream in = Files.newInputStream(commonBnd)) {
122 commonProps.load(in);
123 }
124
125 String m2Version = commonProps.getProperty(SLC_ORIGIN_M2.toString());
126 if (!m2Version.startsWith(":")) {
127 throw new IllegalStateException("Only the M2 version can be specified: " + m2Version);
128 }
129 m2Version = m2Version.substring(1);
130
131 // String license = commonProps.getProperty(BUNDLE_LICENSE.toString());
132
133 DirectoryStream<Path> ds = Files.newDirectoryStream(duDir,
134 (p) -> p.getFileName().toString().endsWith(".bnd")
135 && !p.getFileName().toString().equals(COMMON_BND));
136 for (Path p : ds) {
137 Properties fileProps = new Properties();
138 try (InputStream in = Files.newInputStream(p)) {
139 fileProps.load(in);
140 }
141 String m2Coordinates = fileProps.getProperty(SLC_ORIGIN_M2.toString());
142 DefaultArtifact artifact = new DefaultArtifact(m2Coordinates);
143
144 // temporary rewrite, for migration
145 String localLicense = fileProps.getProperty(BUNDLE_LICENSE.toString());
146 if (localLicense != null || artifact.getVersion() != null) {
147 fileProps.remove(BUNDLE_LICENSE.toString());
148 fileProps.put(SLC_ORIGIN_M2.toString(), artifact.getGroupId() + ":" + artifact.getArtifactId());
149 try (Writer writer = Files.newBufferedWriter(p)) {
150 for (Object key : fileProps.keySet()) {
151 String value = fileProps.getProperty(key.toString());
152 writer.write(key + ": " + value + '\n');
153 }
154 logger.log(DEBUG, () -> "Migrated " + p);
155 }
156 }
157
158 artifact.setVersion(m2Version);
159 URL url = MavenConventionsUtils.mavenCentralUrl(artifact);
160 Path downloaded = download(url, originBase, artifact.toM2Coordinates() + ".jar");
161
162 // prepare manifest entries
163 Properties mergeProps = new Properties();
164 mergeProps.putAll(commonProps);
165
166 // Map<String, String> entries = new HashMap<>();
167 // for (Object key : commonProps.keySet()) {
168 // entries.put(key.toString(), commonProps.getProperty(key.toString()));
169 // }
170 fileEntries: for (Object key : fileProps.keySet()) {
171 if (ManifestConstants.SLC_ORIGIN_M2.toString().equals(key))
172 continue fileEntries;
173 String value = fileProps.getProperty(key.toString());
174 Object previousValue = mergeProps.put(key.toString(), value);
175 if (previousValue != null) {
176 logger.log(Level.WARNING,
177 downloaded + ": " + key + " was " + previousValue + ", overridden with " + value);
178 }
179 }
180 mergeProps.put(ManifestConstants.SLC_ORIGIN_M2.toString(), artifact.toM2Coordinates());
181 Path targetBundleDir = processBndJar(downloaded, targetCategoryBase, mergeProps, artifact);
182 // logger.log(Level.DEBUG, () -> "Processed " + downloaded);
183
184 // sources
185 downloadAndProcessM2Sources(artifact, targetBundleDir);
186
187 createJar(targetBundleDir);
188 }
189 } catch (IOException e) {
190 throw new RuntimeException("Cannot process " + duDir, e);
191 }
192
193 }
194
195 protected void downloadAndProcessM2Sources(DefaultArtifact artifact, Path targetBundleDir) throws IOException {
196 DefaultArtifact sourcesArtifact = new DefaultArtifact(artifact.toM2Coordinates(), "sources");
197 URL sourcesUrl = MavenConventionsUtils.mavenCentralUrl(sourcesArtifact);
198 Path sourcesDownloaded = download(sourcesUrl, originBase, artifact.toM2Coordinates() + ".sources.jar");
199 processM2SourceJar(sourcesDownloaded, targetBundleDir);
200 logger.log(Level.DEBUG, () -> "Processed source " + sourcesDownloaded);
201
202 }
203
204 protected Path processBndJar(Path downloaded, Path targetCategoryBase, Properties fileProps,
205 DefaultArtifact artifact) {
206
207 try {
208 Map<String, String> additionalEntries = new TreeMap<>();
209 boolean doNotModify = Boolean.parseBoolean(fileProps
210 .getOrDefault(ManifestConstants.SLC_ORIGIN_MANIFEST_NOT_MODIFIED.toString(), "false").toString());
211
212 if (doNotModify) {
213 fileEntries: for (Object key : fileProps.keySet()) {
214 if (ManifestConstants.SLC_ORIGIN_M2.toString().equals(key))
215 continue fileEntries;
216 String value = fileProps.getProperty(key.toString());
217 additionalEntries.put(key.toString(), value);
218 }
219 } else {
220 if (artifact != null) {
221 if (!fileProps.containsKey(BUNDLE_SYMBOLICNAME.toString())) {
222 fileProps.put(BUNDLE_SYMBOLICNAME.toString(), artifact.getName());
223 }
224 if (!fileProps.containsKey(BUNDLE_VERSION.toString())) {
225 fileProps.put(BUNDLE_VERSION.toString(), artifact.getVersion());
226 }
227 }
228
229 // if (!fileProps.contains(EXPORT_PACKAGE.toString())) {
230 // fileProps.put(EXPORT_PACKAGE.toString(), "*");
231 // }
232 // if (!fileProps.contains(IMPORT_PACKAGE.toString())) {
233 // fileProps.put(IMPORT_PACKAGE.toString(), "*");
234 // }
235
236 try (Analyzer bndAnalyzer = new Analyzer()) {
237 bndAnalyzer.setProperties(fileProps);
238 Jar jar = new Jar(downloaded.toFile());
239 bndAnalyzer.setJar(jar);
240 Manifest manifest = bndAnalyzer.calcManifest();
241
242 keys: for (Object key : manifest.getMainAttributes().keySet()) {
243 Object value = manifest.getMainAttributes().get(key);
244
245 switch (key.toString()) {
246 case "Tool":
247 case "Bnd-LastModified":
248 case "Created-By":
249 continue keys;
250 }
251 additionalEntries.put(key.toString(), value.toString());
252 // logger.log(DEBUG, () -> key + "=" + value);
253
254 }
255 }
256 }
257 Path targetBundleDir = processBundleJar(downloaded, targetCategoryBase, additionalEntries);
258 logger.log(Level.DEBUG, () -> "Processed " + downloaded);
259 return targetBundleDir;
260 } catch (Exception e) {
261 throw new RuntimeException("Cannot BND process " + downloaded, e);
262 }
263
264 }
265
266 protected void processM2SourceJar(Path file, Path targetBundleDir) throws IOException {
267 try (JarInputStream jarIn = new JarInputStream(Files.newInputStream(file), false)) {
268 Path targetSourceDir = targetBundleDir.resolve("OSGI-OPT/src");
269
270 // TODO make it less dangerous?
271 if (Files.exists(targetSourceDir)) {
272 deleteDirectory(targetSourceDir);
273 } else {
274 Files.createDirectories(targetSourceDir);
275 }
276
277 // copy entries
278 JarEntry entry;
279 entries: while ((entry = jarIn.getNextJarEntry()) != null) {
280 if (entry.isDirectory())
281 continue entries;
282 if (entry.getName().startsWith("META-INF"))// skip META-INF entries
283 continue entries;
284 Path target = targetSourceDir.resolve(entry.getName());
285 Files.createDirectories(target.getParent());
286 Files.copy(jarIn, target);
287 logger.log(Level.TRACE, () -> "Copied source " + target);
288 }
289 }
290
291 }
292
293 public void processEclipseArchive(Path duDir) {
294 try {
295 String category = duDir.getParent().getFileName().toString();
296 Path targetCategoryBase = factoryBase.resolve(category);
297 Files.createDirectories(targetCategoryBase);
298 Files.createDirectories(originBase);
299
300 Path commonBnd = duDir.resolve(COMMON_BND);
301 Properties commonProps = new Properties();
302 try (InputStream in = Files.newInputStream(commonBnd)) {
303 commonProps.load(in);
304 }
305 Properties includes = new Properties();
306 try (InputStream in = Files.newInputStream(duDir.resolve("includes.properties"))) {
307 includes.load(in);
308 }
309 String url = commonProps.getProperty(ManifestConstants.SLC_ORIGIN_URI.toString());
310 Path downloaded = tryDownload(url, originBase);
311
312 FileSystem zipFs = FileSystems.newFileSystem(downloaded, null);
313
314 List<PathMatcher> pathMatchers = new ArrayList<>();
315 for (Object pattern : includes.keySet()) {
316 PathMatcher pathMatcher = zipFs.getPathMatcher("glob:/" + pattern);
317 pathMatchers.add(pathMatcher);
318 }
319
320 Files.walkFileTree(zipFs.getRootDirectories().iterator().next(), new SimpleFileVisitor<Path>() {
321
322 @Override
323 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
324 pathMatchers: for (PathMatcher pathMatcher : pathMatchers) {
325 if (pathMatcher.matches(file)) {
326 // Path target = targetBase.resolve(file.getFileName().toString());
327 // if (!Files.exists(target)) {
328 // Files.copy(file, target);
329 // logger.log(Level.DEBUG, () -> "Copied " + target + " from " + downloaded);
330 // } else {
331 // logger.log(Level.DEBUG, () -> target + " already exists.");
332 //
333 // }
334 if (file.getFileName().toString().contains(".source_")) {
335 processEclipseSourceJar(file, targetCategoryBase);
336 logger.log(Level.DEBUG, () -> "Processed source " + file);
337
338 } else {
339 processBundleJar(file, targetCategoryBase, new HashMap<>());
340 logger.log(Level.DEBUG, () -> "Processed " + file);
341 }
342 continue pathMatchers;
343 }
344 }
345 return super.visitFile(file, attrs);
346 }
347 });
348
349 DirectoryStream<Path> dirs = Files.newDirectoryStream(targetCategoryBase, (p) -> Files.isDirectory(p));
350 for (Path dir : dirs) {
351 createJar(dir);
352 }
353 } catch (IOException e) {
354 throw new RuntimeException("Cannot process " + duDir, e);
355 }
356
357 }
358
359 protected Path processBundleJar(Path file, Path targetBase, Map<String, String> entries) throws IOException {
360 NameVersion nameVersion;
361 Path targetBundleDir;
362 try (JarInputStream jarIn = new JarInputStream(Files.newInputStream(file), false)) {
363 Manifest manifest = new Manifest(jarIn.getManifest());
364
365 // remove problematic entries in MANIFEST
366 manifest.getEntries().clear();
367 // Set<String> entriesToDelete = new HashSet<>();
368 // for (String key : manifest.getEntries().keySet()) {
369 //// logger.log(DEBUG, "## " + key);
370 // Attributes attrs = manifest.getAttributes(key);
371 // for (Object attrName : attrs.keySet()) {
372 //// logger.log(DEBUG, attrName + "=" + attrs.get(attrName));
373 // if ("Specification-Version".equals(attrName.toString())
374 // || "Implementation-Version".equals(attrName.toString())) {
375 // entriesToDelete.add(key);
376 //
377 // }
378 // }
379 // }
380 // for (String key : entriesToDelete) {
381 // manifest.getEntries().remove(key);
382 // }
383
384 String symbolicNameFromEntries = entries.get(BUNDLE_SYMBOLICNAME.toString());
385 String versionFromEntries = entries.get(BUNDLE_VERSION.toString());
386
387 if (symbolicNameFromEntries != null && versionFromEntries != null) {
388 nameVersion = new DefaultNameVersion(symbolicNameFromEntries, versionFromEntries);
389 } else {
390 nameVersion = nameVersionFromManifest(manifest);
391 if (versionFromEntries != null && !nameVersion.getVersion().equals(versionFromEntries)) {
392 logger.log(Level.WARNING, "Original version is " + nameVersion.getVersion()
393 + " while new version is " + versionFromEntries);
394 }
395 }
396 targetBundleDir = targetBase.resolve(nameVersion.getName() + "." + nameVersion.getBranch());
397
398 // TODO make it less dangerous?
399 if (Files.exists(targetBundleDir)) {
400 deleteDirectory(targetBundleDir);
401 }
402
403 // copy entries
404 JarEntry entry;
405 entries: while ((entry = jarIn.getNextJarEntry()) != null) {
406 if (entry.isDirectory())
407 continue entries;
408 if (entry.getName().endsWith(".RSA") || entry.getName().endsWith(".SF"))
409 continue entries;
410 Path target = targetBundleDir.resolve(entry.getName());
411 Files.createDirectories(target.getParent());
412 Files.copy(jarIn, target);
413 logger.log(Level.TRACE, () -> "Copied " + target);
414 }
415
416 // copy MANIFEST
417 Path manifestPath = targetBundleDir.resolve("META-INF/MANIFEST.MF");
418 Files.createDirectories(manifestPath.getParent());
419 for (String key : entries.keySet()) {
420 String value = entries.get(key);
421 Object previousValue = manifest.getMainAttributes().putValue(key, value);
422 if (previousValue != null && !previousValue.equals(value)) {
423 logger.log(Level.WARNING,
424 file.getFileName() + ": " + key + " was " + previousValue + ", overridden with " + value);
425 }
426 }
427 try (OutputStream out = Files.newOutputStream(manifestPath)) {
428 manifest.write(out);
429 }
430 }
431 return targetBundleDir;
432 }
433
434 protected void processEclipseSourceJar(Path file, Path targetBase) throws IOException {
435 // NameVersion nameVersion;
436 Path targetBundleDir;
437 try (JarInputStream jarIn = new JarInputStream(Files.newInputStream(file), false)) {
438 Manifest manifest = jarIn.getManifest();
439 // nameVersion = nameVersionFromManifest(manifest);
440
441 String[] relatedBundle = manifest.getMainAttributes().getValue("Eclipse-SourceBundle").split(";");
442 String version = relatedBundle[1].substring("version=\"".length());
443 version = version.substring(0, version.length() - 1);
444 NameVersion nameVersion = new DefaultNameVersion(relatedBundle[0], version);
445 targetBundleDir = targetBase.resolve(nameVersion.getName() + "." + nameVersion.getBranch());
446
447 Path targetSourceDir = targetBundleDir.resolve("OSGI-OPT/src");
448
449 // TODO make it less dangerous?
450 if (Files.exists(targetSourceDir)) {
451 deleteDirectory(targetSourceDir);
452 } else {
453 Files.createDirectories(targetSourceDir);
454 }
455
456 // copy entries
457 JarEntry entry;
458 entries: while ((entry = jarIn.getNextJarEntry()) != null) {
459 if (entry.isDirectory())
460 continue entries;
461 if (entry.getName().startsWith("META-INF"))// skip META-INF entries
462 continue entries;
463 Path target = targetSourceDir.resolve(entry.getName());
464 Files.createDirectories(target.getParent());
465 Files.copy(jarIn, target);
466 logger.log(Level.TRACE, () -> "Copied source " + target);
467 }
468
469 // copy MANIFEST
470 // Path manifestPath = targetBundleDir.resolve("META-INF/MANIFEST.MF");
471 // Files.createDirectories(manifestPath.getParent());
472 // try (OutputStream out = Files.newOutputStream(manifestPath)) {
473 // manifest.write(out);
474 // }
475 }
476
477 }
478
479 static void deleteDirectory(Path path) throws IOException {
480 if (!Files.exists(path))
481 return;
482 Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
483 @Override
484 public FileVisitResult postVisitDirectory(Path directory, IOException e) throws IOException {
485 if (e != null)
486 throw e;
487 Files.delete(directory);
488 return FileVisitResult.CONTINUE;
489 }
490
491 @Override
492 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
493 Files.delete(file);
494 return FileVisitResult.CONTINUE;
495 }
496 });
497 }
498
499 protected NameVersion nameVersionFromManifest(Manifest manifest) {
500 Attributes attrs = manifest.getMainAttributes();
501 // symbolic name
502 String symbolicName = attrs.getValue(ManifestConstants.BUNDLE_SYMBOLICNAME.toString());
503 if (symbolicName == null)
504 return null;
505 // make sure there is no directive
506 symbolicName = symbolicName.split(";")[0];
507
508 String version = attrs.getValue(ManifestConstants.BUNDLE_VERSION.toString());
509 return new DefaultNameVersion(symbolicName, version);
510 }
511
512 protected Path tryDownload(String uri, Path dir) throws IOException {
513 // find mirror
514 List<String> urlBases = null;
515 String uriPrefix = null;
516 uriPrefixes: for (String uriPref : mirrors.keySet()) {
517 if (uri.startsWith(uriPref)) {
518 if (mirrors.get(uriPref).size() > 0) {
519 urlBases = mirrors.get(uriPref);
520 uriPrefix = uriPref;
521 break uriPrefixes;
522 }
523 }
524 }
525 if (urlBases == null)
526 try {
527 return download(new URL(uri), dir, null);
528 } catch (FileNotFoundException e) {
529 throw new FileNotFoundException("Cannot find " + uri);
530 }
531
532 // try to download
533 for (String urlBase : urlBases) {
534 String relativePath = uri.substring(uriPrefix.length());
535 URL url = new URL(urlBase + relativePath);
536 try {
537 return download(url, dir, null);
538 } catch (FileNotFoundException e) {
539 logger.log(Level.WARNING, "Cannot download " + url + ", trying another mirror");
540 }
541 }
542 throw new FileNotFoundException("Cannot find " + uri);
543 }
544
545 // protected String simplifyName(URL u) {
546 // String name = u.getPath().substring(u.getPath().lastIndexOf('/') + 1);
547 //
548 // }
549
550 protected Path download(URL url, Path dir, String name) throws IOException {
551
552 Path dest;
553 if (name == null) {
554 name = url.getPath().substring(url.getPath().lastIndexOf('/') + 1);
555 }
556
557 dest = dir.resolve(name);
558 if (Files.exists(dest)) {
559 logger.log(Level.TRACE, () -> "File " + dest + " already exists for " + url + ", not downloading again");
560 return dest;
561 }
562
563 try (InputStream in = url.openStream()) {
564 Files.copy(in, dest);
565 logger.log(Level.DEBUG, () -> "Downloaded " + dest + " from " + url);
566 }
567 return dest;
568 }
569
570 protected Path createJar(Path bundleDir) throws IOException {
571 Path jarPath = bundleDir.getParent().resolve(bundleDir.getFileName() + ".jar");
572 Path manifestPath = bundleDir.resolve("META-INF/MANIFEST.MF");
573 Manifest manifest;
574 try (InputStream in = Files.newInputStream(manifestPath)) {
575 manifest = new Manifest(in);
576 }
577 try (JarOutputStream jarOut = new JarOutputStream(Files.newOutputStream(jarPath), manifest)) {
578 Files.walkFileTree(bundleDir, new SimpleFileVisitor<Path>() {
579
580 @Override
581 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
582 if (file.getFileName().toString().equals("MANIFEST.MF"))
583 return super.visitFile(file, attrs);
584 JarEntry entry = new JarEntry(bundleDir.relativize(file).toString());
585 jarOut.putNextEntry(entry);
586 Files.copy(file, jarOut);
587 return super.visitFile(file, attrs);
588 }
589
590 });
591 }
592 deleteDirectory(bundleDir);
593 return jarPath;
594 }
595
596 public static void main(String[] args) {
597 Path originBase = Paths.get("../output/origin").toAbsolutePath().normalize();
598 Path factoryBase = Paths.get("../output/a2").toAbsolutePath().normalize();
599 A2Factory factory = new A2Factory(originBase, factoryBase);
600
601 Path descriptorsBase = Paths.get("../tp").toAbsolutePath().normalize();
602
603 // Eclipse
604 factory.processEclipseArchive(
605 descriptorsBase.resolve("org.argeo.tp.eclipse.equinox").resolve("eclipse-equinox"));
606 factory.processEclipseArchive(descriptorsBase.resolve("org.argeo.tp.eclipse.rap").resolve("eclipse-rap"));
607 factory.processEclipseArchive(descriptorsBase.resolve("org.argeo.tp.eclipse.rcp").resolve("eclipse-rcp"));
608
609 // Maven
610 factory.processCategory(descriptorsBase.resolve("org.argeo.tp.javax"));
611 factory.processCategory(descriptorsBase.resolve("org.argeo.tp"));
612 factory.processCategory(descriptorsBase.resolve("org.argeo.tp.apache"));
613 factory.processCategory(descriptorsBase.resolve("org.argeo.tp.jetty"));
614 factory.processCategory(descriptorsBase.resolve("org.argeo.tp.sdk"));
615 factory.processCategory(descriptorsBase.resolve("org.argeo.tp.jcr"));
616 }
617 }