1 package org
.argeo
.slc
.factory
;
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
.EXPORT_PACKAGE
;
8 import static org
.argeo
.slc
.ManifestConstants
.SLC_ORIGIN_M2
;
10 import java
.io
.FileNotFoundException
;
11 import java
.io
.IOException
;
12 import java
.io
.InputStream
;
13 import java
.io
.OutputStream
;
14 import java
.io
.Writer
;
15 import java
.lang
.System
.Logger
;
16 import java
.lang
.System
.Logger
.Level
;
18 import java
.nio
.file
.DirectoryStream
;
19 import java
.nio
.file
.FileSystem
;
20 import java
.nio
.file
.FileSystems
;
21 import java
.nio
.file
.FileVisitResult
;
22 import java
.nio
.file
.Files
;
23 import java
.nio
.file
.Path
;
24 import java
.nio
.file
.PathMatcher
;
25 import java
.nio
.file
.Paths
;
26 import java
.nio
.file
.SimpleFileVisitor
;
27 import java
.nio
.file
.attribute
.BasicFileAttributes
;
28 import java
.util
.ArrayList
;
29 import java
.util
.HashMap
;
30 import java
.util
.List
;
32 import java
.util
.Properties
;
33 import java
.util
.TreeMap
;
34 import java
.util
.jar
.Attributes
;
35 import java
.util
.jar
.JarEntry
;
36 import java
.util
.jar
.JarInputStream
;
37 import java
.util
.jar
.JarOutputStream
;
38 import java
.util
.jar
.Manifest
;
40 import org
.argeo
.slc
.DefaultNameVersion
;
41 import org
.argeo
.slc
.ManifestConstants
;
42 import org
.argeo
.slc
.NameVersion
;
43 import org
.argeo
.slc
.factory
.m2
.DefaultArtifact
;
44 import org
.argeo
.slc
.factory
.m2
.MavenConventionsUtils
;
46 import aQute
.bnd
.osgi
.Analyzer
;
47 import aQute
.bnd
.osgi
.Jar
;
49 /** The central class for A2 packaging. */
50 public class A2Factory
{
51 private final static Logger logger
= System
.getLogger(A2Factory
.class.getName());
53 private final static String COMMON_BND
= "common.bnd";
55 private Path originBase
;
56 private Path factoryBase
;
58 /** key is URI prefix, value list of base URLs */
59 private Map
<String
, List
<String
>> mirrors
= new HashMap
<String
, List
<String
>>();
61 public A2Factory(Path originBase
, Path factoryBase
) {
63 this.originBase
= originBase
;
64 this.factoryBase
= factoryBase
;
66 // TODO make it configurable
67 List
<String
> eclipseMirrors
= new ArrayList
<>();
68 eclipseMirrors
.add("https://archive.eclipse.org/");
70 mirrors
.put("http://www.eclipse.org/downloads", eclipseMirrors
);
73 public void processCategory(Path targetCategoryBase
) {
75 DirectoryStream
<Path
> bnds
= Files
.newDirectoryStream(targetCategoryBase
,
76 (p
) -> p
.getFileName().toString().endsWith(".bnd")
77 && !p
.getFileName().toString().equals(COMMON_BND
));
79 processSingleM2ArtifactDistributionUnit(p
);
82 DirectoryStream
<Path
> dus
= Files
.newDirectoryStream(targetCategoryBase
, (p
) -> Files
.isDirectory(p
));
83 for (Path duDir
: dus
) {
84 processM2BasedDistributionUnit(duDir
);
86 } catch (IOException e
) {
87 throw new RuntimeException("Cannot process category " + targetCategoryBase
, e
);
91 public void processSingleM2ArtifactDistributionUnit(Path bndFile
) {
93 String category
= bndFile
.getParent().getFileName().toString();
94 Path targetCategoryBase
= factoryBase
.resolve(category
);
95 Properties fileProps
= new Properties();
96 try (InputStream in
= Files
.newInputStream(bndFile
)) {
100 String m2Coordinates
= fileProps
.getProperty(SLC_ORIGIN_M2
.toString());
101 if (m2Coordinates
== null)
102 throw new IllegalArgumentException("No M2 coordinates available for " + bndFile
);
103 DefaultArtifact artifact
= new DefaultArtifact(m2Coordinates
);
104 URL url
= MavenConventionsUtils
.mavenCentralUrl(artifact
);
105 Path downloaded
= download(url
, originBase
, artifact
.toM2Coordinates() + ".jar");
107 Path targetBundleDir
= processBndJar(downloaded
, targetCategoryBase
, fileProps
, artifact
);
109 downloadAndProcessM2Sources(artifact
, targetBundleDir
);
111 createJar(targetBundleDir
);
112 } catch (Exception e
) {
113 throw new RuntimeException("Cannot process " + bndFile
, e
);
117 public void processM2BasedDistributionUnit(Path duDir
) {
119 String category
= duDir
.getParent().getFileName().toString();
120 Path targetCategoryBase
= factoryBase
.resolve(category
);
121 Path commonBnd
= duDir
.resolve(COMMON_BND
);
122 Properties commonProps
= new Properties();
123 try (InputStream in
= Files
.newInputStream(commonBnd
)) {
124 commonProps
.load(in
);
127 String m2Version
= commonProps
.getProperty(SLC_ORIGIN_M2
.toString());
128 if (!m2Version
.startsWith(":")) {
129 throw new IllegalStateException("Only the M2 version can be specified: " + m2Version
);
131 m2Version
= m2Version
.substring(1);
133 // String license = commonProps.getProperty(BUNDLE_LICENSE.toString());
135 DirectoryStream
<Path
> ds
= Files
.newDirectoryStream(duDir
,
136 (p
) -> p
.getFileName().toString().endsWith(".bnd")
137 && !p
.getFileName().toString().equals(COMMON_BND
));
139 Properties fileProps
= new Properties();
140 try (InputStream in
= Files
.newInputStream(p
)) {
143 String m2Coordinates
= fileProps
.getProperty(SLC_ORIGIN_M2
.toString());
144 DefaultArtifact artifact
= new DefaultArtifact(m2Coordinates
);
146 // temporary rewrite, for migration
147 String localLicense
= fileProps
.getProperty(BUNDLE_LICENSE
.toString());
148 if (localLicense
!= null || artifact
.getVersion() != null) {
149 fileProps
.remove(BUNDLE_LICENSE
.toString());
150 fileProps
.put(SLC_ORIGIN_M2
.toString(), artifact
.getGroupId() + ":" + artifact
.getArtifactId());
151 try (Writer writer
= Files
.newBufferedWriter(p
)) {
152 for (Object key
: fileProps
.keySet()) {
153 String value
= fileProps
.getProperty(key
.toString());
154 writer
.write(key
+ ": " + value
+ '\n');
156 logger
.log(DEBUG
, () -> "Migrated " + p
);
160 artifact
.setVersion(m2Version
);
161 URL url
= MavenConventionsUtils
.mavenCentralUrl(artifact
);
162 Path downloaded
= download(url
, originBase
, artifact
.toM2Coordinates() + ".jar");
164 // prepare manifest entries
165 Properties mergeProps
= new Properties();
166 mergeProps
.putAll(commonProps
);
168 // Map<String, String> entries = new HashMap<>();
169 // for (Object key : commonProps.keySet()) {
170 // entries.put(key.toString(), commonProps.getProperty(key.toString()));
172 fileEntries
: for (Object key
: fileProps
.keySet()) {
173 if (ManifestConstants
.SLC_ORIGIN_M2
.toString().equals(key
))
174 continue fileEntries
;
175 String value
= fileProps
.getProperty(key
.toString());
176 Object previousValue
= mergeProps
.put(key
.toString(), value
);
177 if (previousValue
!= null) {
178 logger
.log(Level
.WARNING
,
179 downloaded
+ ": " + key
+ " was " + previousValue
+ ", overridden with " + value
);
182 mergeProps
.put(ManifestConstants
.SLC_ORIGIN_M2
.toString(), artifact
.toM2Coordinates());
183 Path targetBundleDir
= processBndJar(downloaded
, targetCategoryBase
, mergeProps
, artifact
);
184 // logger.log(Level.DEBUG, () -> "Processed " + downloaded);
187 downloadAndProcessM2Sources(artifact
, targetBundleDir
);
189 createJar(targetBundleDir
);
191 } catch (IOException e
) {
192 throw new RuntimeException("Cannot process " + duDir
, e
);
197 protected void downloadAndProcessM2Sources(DefaultArtifact artifact
, Path targetBundleDir
) throws IOException
{
198 DefaultArtifact sourcesArtifact
= new DefaultArtifact(artifact
.toM2Coordinates(), "sources");
199 URL sourcesUrl
= MavenConventionsUtils
.mavenCentralUrl(sourcesArtifact
);
200 Path sourcesDownloaded
= download(sourcesUrl
, originBase
, artifact
.toM2Coordinates() + ".sources.jar");
201 processM2SourceJar(sourcesDownloaded
, targetBundleDir
);
202 logger
.log(Level
.DEBUG
, () -> "Processed source " + sourcesDownloaded
);
206 protected Path
processBndJar(Path downloaded
, Path targetCategoryBase
, Properties fileProps
,
207 DefaultArtifact artifact
) {
210 Map
<String
, String
> additionalEntries
= new TreeMap
<>();
211 boolean doNotModify
= Boolean
.parseBoolean(fileProps
212 .getOrDefault(ManifestConstants
.SLC_ORIGIN_MANIFEST_NOT_MODIFIED
.toString(), "false").toString());
215 fileEntries
: for (Object key
: fileProps
.keySet()) {
216 if (ManifestConstants
.SLC_ORIGIN_M2
.toString().equals(key
))
217 continue fileEntries
;
218 String value
= fileProps
.getProperty(key
.toString());
219 additionalEntries
.put(key
.toString(), value
);
222 if (artifact
!= null) {
223 if (!fileProps
.containsKey(BUNDLE_SYMBOLICNAME
.toString())) {
224 fileProps
.put(BUNDLE_SYMBOLICNAME
.toString(), artifact
.getName());
226 if (!fileProps
.containsKey(BUNDLE_VERSION
.toString())) {
227 fileProps
.put(BUNDLE_VERSION
.toString(), artifact
.getVersion());
231 if (!fileProps
.containsKey(EXPORT_PACKAGE
.toString())) {
232 fileProps
.put(EXPORT_PACKAGE
.toString(),
233 "*;version=\"" + fileProps
.getProperty(BUNDLE_VERSION
.toString()) + "\"");
235 // if (!fileProps.contains(IMPORT_PACKAGE.toString())) {
236 // fileProps.put(IMPORT_PACKAGE.toString(), "*");
239 try (Analyzer bndAnalyzer
= new Analyzer()) {
240 bndAnalyzer
.setProperties(fileProps
);
241 Jar jar
= new Jar(downloaded
.toFile());
242 bndAnalyzer
.setJar(jar
);
243 Manifest manifest
= bndAnalyzer
.calcManifest();
245 keys
: for (Object key
: manifest
.getMainAttributes().keySet()) {
246 Object value
= manifest
.getMainAttributes().get(key
);
248 switch (key
.toString()) {
250 case "Bnd-LastModified":
254 if ("Require-Capability".equals(key
.toString())
255 && value
.toString().equals("osgi.ee;filter:=\"(&(osgi.ee=JavaSE)(version=1.1))\""))
256 continue keys
;// hack for very old classes
257 additionalEntries
.put(key
.toString(), value
.toString());
258 logger
.log(DEBUG
, () -> key
+ "=" + value
);
263 // try (Builder bndBuilder = new Builder()) {
264 // Jar jar = new Jar(downloaded.toFile());
265 // bndBuilder.addClasspath(jar);
266 // Path targetBundleDir = targetCategoryBase.resolve(artifact.getName() + "." + artifact.getBranch());
268 // Jar target = new Jar(targetBundleDir.toFile());
269 // bndBuilder.setJar(target);
270 // return targetBundleDir;
273 Path targetBundleDir
= processBundleJar(downloaded
, targetCategoryBase
, additionalEntries
);
274 logger
.log(Level
.DEBUG
, () -> "Processed " + downloaded
);
275 return targetBundleDir
;
276 } catch (Exception e
) {
277 throw new RuntimeException("Cannot BND process " + downloaded
, e
);
282 protected void processM2SourceJar(Path file
, Path targetBundleDir
) throws IOException
{
283 try (JarInputStream jarIn
= new JarInputStream(Files
.newInputStream(file
), false)) {
284 Path targetSourceDir
= targetBundleDir
.resolve("OSGI-OPT/src");
286 // TODO make it less dangerous?
287 if (Files
.exists(targetSourceDir
)) {
288 deleteDirectory(targetSourceDir
);
290 Files
.createDirectories(targetSourceDir
);
295 entries
: while ((entry
= jarIn
.getNextJarEntry()) != null) {
296 if (entry
.isDirectory())
298 if (entry
.getName().startsWith("META-INF"))// skip META-INF entries
300 Path target
= targetSourceDir
.resolve(entry
.getName());
301 Files
.createDirectories(target
.getParent());
302 Files
.copy(jarIn
, target
);
303 logger
.log(Level
.TRACE
, () -> "Copied source " + target
);
309 public void processEclipseArchive(Path duDir
) {
311 String category
= duDir
.getParent().getFileName().toString();
312 Path targetCategoryBase
= factoryBase
.resolve(category
);
313 Files
.createDirectories(targetCategoryBase
);
314 Files
.createDirectories(originBase
);
316 Path commonBnd
= duDir
.resolve(COMMON_BND
);
317 Properties commonProps
= new Properties();
318 try (InputStream in
= Files
.newInputStream(commonBnd
)) {
319 commonProps
.load(in
);
321 Properties includes
= new Properties();
322 try (InputStream in
= Files
.newInputStream(duDir
.resolve("includes.properties"))) {
325 String url
= commonProps
.getProperty(ManifestConstants
.SLC_ORIGIN_URI
.toString());
326 Path downloaded
= tryDownload(url
, originBase
);
328 FileSystem zipFs
= FileSystems
.newFileSystem(downloaded
, (ClassLoader
) null);
330 List
<PathMatcher
> pathMatchers
= new ArrayList
<>();
331 for (Object pattern
: includes
.keySet()) {
332 PathMatcher pathMatcher
= zipFs
.getPathMatcher("glob:/" + pattern
);
333 pathMatchers
.add(pathMatcher
);
336 Files
.walkFileTree(zipFs
.getRootDirectories().iterator().next(), new SimpleFileVisitor
<Path
>() {
339 public FileVisitResult
visitFile(Path file
, BasicFileAttributes attrs
) throws IOException
{
340 pathMatchers
: for (PathMatcher pathMatcher
: pathMatchers
) {
341 if (pathMatcher
.matches(file
)) {
342 // Path target = targetBase.resolve(file.getFileName().toString());
343 // if (!Files.exists(target)) {
344 // Files.copy(file, target);
345 // logger.log(Level.DEBUG, () -> "Copied " + target + " from " + downloaded);
347 // logger.log(Level.DEBUG, () -> target + " already exists.");
350 if (file
.getFileName().toString().contains(".source_")) {
351 processEclipseSourceJar(file
, targetCategoryBase
);
352 logger
.log(Level
.DEBUG
, () -> "Processed source " + file
);
355 processBundleJar(file
, targetCategoryBase
, new HashMap
<>());
356 logger
.log(Level
.DEBUG
, () -> "Processed " + file
);
358 continue pathMatchers
;
361 return super.visitFile(file
, attrs
);
365 DirectoryStream
<Path
> dirs
= Files
.newDirectoryStream(targetCategoryBase
, (p
) -> Files
.isDirectory(p
));
366 for (Path dir
: dirs
) {
369 } catch (IOException e
) {
370 throw new RuntimeException("Cannot process " + duDir
, e
);
375 protected Path
processBundleJar(Path file
, Path targetBase
, Map
<String
, String
> entries
) throws IOException
{
376 NameVersion nameVersion
;
377 Path targetBundleDir
;
378 try (JarInputStream jarIn
= new JarInputStream(Files
.newInputStream(file
), false)) {
379 Manifest manifest
= new Manifest(jarIn
.getManifest());
381 // remove problematic entries in MANIFEST
382 manifest
.getEntries().clear();
383 // Set<String> entriesToDelete = new HashSet<>();
384 // for (String key : manifest.getEntries().keySet()) {
385 //// logger.log(DEBUG, "## " + key);
386 // Attributes attrs = manifest.getAttributes(key);
387 // for (Object attrName : attrs.keySet()) {
388 //// logger.log(DEBUG, attrName + "=" + attrs.get(attrName));
389 // if ("Specification-Version".equals(attrName.toString())
390 // || "Implementation-Version".equals(attrName.toString())) {
391 // entriesToDelete.add(key);
396 // for (String key : entriesToDelete) {
397 // manifest.getEntries().remove(key);
400 String symbolicNameFromEntries
= entries
.get(BUNDLE_SYMBOLICNAME
.toString());
401 String versionFromEntries
= entries
.get(BUNDLE_VERSION
.toString());
403 if (symbolicNameFromEntries
!= null && versionFromEntries
!= null) {
404 nameVersion
= new DefaultNameVersion(symbolicNameFromEntries
, versionFromEntries
);
406 nameVersion
= nameVersionFromManifest(manifest
);
407 if (versionFromEntries
!= null && !nameVersion
.getVersion().equals(versionFromEntries
)) {
408 logger
.log(Level
.WARNING
, "Original version is " + nameVersion
.getVersion()
409 + " while new version is " + versionFromEntries
);
412 targetBundleDir
= targetBase
.resolve(nameVersion
.getName() + "." + nameVersion
.getBranch());
414 // TODO make it less dangerous?
415 if (Files
.exists(targetBundleDir
)) {
416 deleteDirectory(targetBundleDir
);
421 entries
: while ((entry
= jarIn
.getNextJarEntry()) != null) {
422 if (entry
.isDirectory())
424 if (entry
.getName().endsWith(".RSA") || entry
.getName().endsWith(".SF"))
426 Path target
= targetBundleDir
.resolve(entry
.getName());
427 Files
.createDirectories(target
.getParent());
428 Files
.copy(jarIn
, target
);
429 logger
.log(Level
.TRACE
, () -> "Copied " + target
);
433 Path manifestPath
= targetBundleDir
.resolve("META-INF/MANIFEST.MF");
434 Files
.createDirectories(manifestPath
.getParent());
435 for (String key
: entries
.keySet()) {
436 String value
= entries
.get(key
);
437 Object previousValue
= manifest
.getMainAttributes().putValue(key
, value
);
438 if (previousValue
!= null && !previousValue
.equals(value
)) {
439 logger
.log(Level
.WARNING
,
440 file
.getFileName() + ": " + key
+ " was " + previousValue
+ ", overridden with " + value
);
443 try (OutputStream out
= Files
.newOutputStream(manifestPath
)) {
447 return targetBundleDir
;
450 protected void processEclipseSourceJar(Path file
, Path targetBase
) throws IOException
{
451 // NameVersion nameVersion;
452 Path targetBundleDir
;
453 try (JarInputStream jarIn
= new JarInputStream(Files
.newInputStream(file
), false)) {
454 Manifest manifest
= jarIn
.getManifest();
455 // nameVersion = nameVersionFromManifest(manifest);
457 String
[] relatedBundle
= manifest
.getMainAttributes().getValue("Eclipse-SourceBundle").split(";");
458 String version
= relatedBundle
[1].substring("version=\"".length());
459 version
= version
.substring(0, version
.length() - 1);
460 NameVersion nameVersion
= new DefaultNameVersion(relatedBundle
[0], version
);
461 targetBundleDir
= targetBase
.resolve(nameVersion
.getName() + "." + nameVersion
.getBranch());
463 Path targetSourceDir
= targetBundleDir
.resolve("OSGI-OPT/src");
465 // TODO make it less dangerous?
466 if (Files
.exists(targetSourceDir
)) {
467 deleteDirectory(targetSourceDir
);
469 Files
.createDirectories(targetSourceDir
);
474 entries
: while ((entry
= jarIn
.getNextJarEntry()) != null) {
475 if (entry
.isDirectory())
477 if (entry
.getName().startsWith("META-INF"))// skip META-INF entries
479 Path target
= targetSourceDir
.resolve(entry
.getName());
480 Files
.createDirectories(target
.getParent());
481 Files
.copy(jarIn
, target
);
482 logger
.log(Level
.TRACE
, () -> "Copied source " + target
);
486 // Path manifestPath = targetBundleDir.resolve("META-INF/MANIFEST.MF");
487 // Files.createDirectories(manifestPath.getParent());
488 // try (OutputStream out = Files.newOutputStream(manifestPath)) {
489 // manifest.write(out);
495 static void deleteDirectory(Path path
) throws IOException
{
496 if (!Files
.exists(path
))
498 Files
.walkFileTree(path
, new SimpleFileVisitor
<Path
>() {
500 public FileVisitResult
postVisitDirectory(Path directory
, IOException e
) throws IOException
{
503 Files
.delete(directory
);
504 return FileVisitResult
.CONTINUE
;
508 public FileVisitResult
visitFile(Path file
, BasicFileAttributes attrs
) throws IOException
{
510 return FileVisitResult
.CONTINUE
;
515 protected NameVersion
nameVersionFromManifest(Manifest manifest
) {
516 Attributes attrs
= manifest
.getMainAttributes();
518 String symbolicName
= attrs
.getValue(ManifestConstants
.BUNDLE_SYMBOLICNAME
.toString());
519 if (symbolicName
== null)
521 // make sure there is no directive
522 symbolicName
= symbolicName
.split(";")[0];
524 String version
= attrs
.getValue(ManifestConstants
.BUNDLE_VERSION
.toString());
525 return new DefaultNameVersion(symbolicName
, version
);
528 protected Path
tryDownload(String uri
, Path dir
) throws IOException
{
530 List
<String
> urlBases
= null;
531 String uriPrefix
= null;
532 uriPrefixes
: for (String uriPref
: mirrors
.keySet()) {
533 if (uri
.startsWith(uriPref
)) {
534 if (mirrors
.get(uriPref
).size() > 0) {
535 urlBases
= mirrors
.get(uriPref
);
541 if (urlBases
== null)
543 return download(new URL(uri
), dir
, null);
544 } catch (FileNotFoundException e
) {
545 throw new FileNotFoundException("Cannot find " + uri
);
549 for (String urlBase
: urlBases
) {
550 String relativePath
= uri
.substring(uriPrefix
.length());
551 URL url
= new URL(urlBase
+ relativePath
);
553 return download(url
, dir
, null);
554 } catch (FileNotFoundException e
) {
555 logger
.log(Level
.WARNING
, "Cannot download " + url
+ ", trying another mirror");
558 throw new FileNotFoundException("Cannot find " + uri
);
561 // protected String simplifyName(URL u) {
562 // String name = u.getPath().substring(u.getPath().lastIndexOf('/') + 1);
566 protected Path
download(URL url
, Path dir
, String name
) throws IOException
{
570 name
= url
.getPath().substring(url
.getPath().lastIndexOf('/') + 1);
573 dest
= dir
.resolve(name
);
574 if (Files
.exists(dest
)) {
575 logger
.log(Level
.TRACE
, () -> "File " + dest
+ " already exists for " + url
+ ", not downloading again");
579 try (InputStream in
= url
.openStream()) {
580 Files
.copy(in
, dest
);
581 logger
.log(Level
.DEBUG
, () -> "Downloaded " + dest
+ " from " + url
);
586 protected Path
createJar(Path bundleDir
) throws IOException
{
587 Path jarPath
= bundleDir
.getParent().resolve(bundleDir
.getFileName() + ".jar");
588 Path manifestPath
= bundleDir
.resolve("META-INF/MANIFEST.MF");
590 try (InputStream in
= Files
.newInputStream(manifestPath
)) {
591 manifest
= new Manifest(in
);
593 try (JarOutputStream jarOut
= new JarOutputStream(Files
.newOutputStream(jarPath
), manifest
)) {
594 Files
.walkFileTree(bundleDir
, new SimpleFileVisitor
<Path
>() {
597 public FileVisitResult
visitFile(Path file
, BasicFileAttributes attrs
) throws IOException
{
598 if (file
.getFileName().toString().equals("MANIFEST.MF"))
599 return super.visitFile(file
, attrs
);
600 JarEntry entry
= new JarEntry(bundleDir
.relativize(file
).toString());
601 jarOut
.putNextEntry(entry
);
602 Files
.copy(file
, jarOut
);
603 return super.visitFile(file
, attrs
);
608 deleteDirectory(bundleDir
);
612 public static void main(String
[] args
) {
613 Path originBase
= Paths
.get("../output/origin").toAbsolutePath().normalize();
614 Path factoryBase
= Paths
.get("../output/a2").toAbsolutePath().normalize();
615 A2Factory factory
= new A2Factory(originBase
, factoryBase
);
617 Path descriptorsBase
= Paths
.get("../tp").toAbsolutePath().normalize();
619 // factory.processSingleM2ArtifactDistributionUnit(descriptorsBase.resolve("org.argeo.tp.apache").resolve("org.apache.xml.resolver.bnd"));
620 // factory.processM2BasedDistributionUnit(descriptorsBase.resolve("org.argeo.tp/slf4j"));
624 factory
.processEclipseArchive(
625 descriptorsBase
.resolve("org.argeo.tp.eclipse.equinox").resolve("eclipse-equinox"));
626 factory
.processEclipseArchive(descriptorsBase
.resolve("org.argeo.tp.eclipse.rap").resolve("eclipse-rap"));
627 factory
.processEclipseArchive(descriptorsBase
.resolve("org.argeo.tp.eclipse.rcp").resolve("eclipse-rcp"));
630 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp.sdk"));
631 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp"));
632 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp.apache"));
633 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp.jetty"));
634 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp.jcr"));