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());
214 // we always force the symbolic name
215 if (artifact
!= null) {
216 if (!fileProps
.containsKey(BUNDLE_SYMBOLICNAME
.toString())) {
217 fileProps
.put(BUNDLE_SYMBOLICNAME
.toString(), artifact
.getName());
219 if (!fileProps
.containsKey(BUNDLE_VERSION
.toString())) {
220 fileProps
.put(BUNDLE_VERSION
.toString(), artifact
.getVersion());
225 fileEntries
: for (Object key
: fileProps
.keySet()) {
226 if (ManifestConstants
.SLC_ORIGIN_M2
.toString().equals(key
))
227 continue fileEntries
;
228 String value
= fileProps
.getProperty(key
.toString());
229 additionalEntries
.put(key
.toString(), value
);
233 if (!fileProps
.containsKey(EXPORT_PACKAGE
.toString())) {
234 fileProps
.put(EXPORT_PACKAGE
.toString(),
235 "*;version=\"" + fileProps
.getProperty(BUNDLE_VERSION
.toString()) + "\"");
237 // if (!fileProps.contains(IMPORT_PACKAGE.toString())) {
238 // fileProps.put(IMPORT_PACKAGE.toString(), "*");
241 try (Analyzer bndAnalyzer
= new Analyzer()) {
242 bndAnalyzer
.setProperties(fileProps
);
243 Jar jar
= new Jar(downloaded
.toFile());
244 bndAnalyzer
.setJar(jar
);
245 Manifest manifest
= bndAnalyzer
.calcManifest();
247 keys
: for (Object key
: manifest
.getMainAttributes().keySet()) {
248 Object value
= manifest
.getMainAttributes().get(key
);
250 switch (key
.toString()) {
252 case "Bnd-LastModified":
256 if ("Require-Capability".equals(key
.toString())
257 && value
.toString().equals("osgi.ee;filter:=\"(&(osgi.ee=JavaSE)(version=1.1))\""))
258 continue keys
;// hack for very old classes
259 additionalEntries
.put(key
.toString(), value
.toString());
260 logger
.log(DEBUG
, () -> key
+ "=" + value
);
265 // try (Builder bndBuilder = new Builder()) {
266 // Jar jar = new Jar(downloaded.toFile());
267 // bndBuilder.addClasspath(jar);
268 // Path targetBundleDir = targetCategoryBase.resolve(artifact.getName() + "." + artifact.getBranch());
270 // Jar target = new Jar(targetBundleDir.toFile());
271 // bndBuilder.setJar(target);
272 // return targetBundleDir;
275 Path targetBundleDir
= processBundleJar(downloaded
, targetCategoryBase
, additionalEntries
);
276 logger
.log(Level
.DEBUG
, () -> "Processed " + downloaded
);
277 return targetBundleDir
;
278 } catch (Exception e
) {
279 throw new RuntimeException("Cannot BND process " + downloaded
, e
);
284 protected void processM2SourceJar(Path file
, Path targetBundleDir
) throws IOException
{
285 try (JarInputStream jarIn
= new JarInputStream(Files
.newInputStream(file
), false)) {
286 Path targetSourceDir
= targetBundleDir
.resolve("OSGI-OPT/src");
288 // TODO make it less dangerous?
289 if (Files
.exists(targetSourceDir
)) {
290 deleteDirectory(targetSourceDir
);
292 Files
.createDirectories(targetSourceDir
);
297 entries
: while ((entry
= jarIn
.getNextJarEntry()) != null) {
298 if (entry
.isDirectory())
300 if (entry
.getName().startsWith("META-INF"))// skip META-INF entries
302 Path target
= targetSourceDir
.resolve(entry
.getName());
303 Files
.createDirectories(target
.getParent());
304 Files
.copy(jarIn
, target
);
305 logger
.log(Level
.TRACE
, () -> "Copied source " + target
);
311 public void processEclipseArchive(Path duDir
) {
313 String category
= duDir
.getParent().getFileName().toString();
314 Path targetCategoryBase
= factoryBase
.resolve(category
);
315 Files
.createDirectories(targetCategoryBase
);
316 Files
.createDirectories(originBase
);
318 Path commonBnd
= duDir
.resolve(COMMON_BND
);
319 Properties commonProps
= new Properties();
320 try (InputStream in
= Files
.newInputStream(commonBnd
)) {
321 commonProps
.load(in
);
323 Properties includes
= new Properties();
324 try (InputStream in
= Files
.newInputStream(duDir
.resolve("includes.properties"))) {
327 String url
= commonProps
.getProperty(ManifestConstants
.SLC_ORIGIN_URI
.toString());
328 Path downloaded
= tryDownload(url
, originBase
);
330 FileSystem zipFs
= FileSystems
.newFileSystem(downloaded
, (ClassLoader
) null);
332 List
<PathMatcher
> pathMatchers
= new ArrayList
<>();
333 for (Object pattern
: includes
.keySet()) {
334 PathMatcher pathMatcher
= zipFs
.getPathMatcher("glob:/" + pattern
);
335 pathMatchers
.add(pathMatcher
);
338 Files
.walkFileTree(zipFs
.getRootDirectories().iterator().next(), new SimpleFileVisitor
<Path
>() {
341 public FileVisitResult
visitFile(Path file
, BasicFileAttributes attrs
) throws IOException
{
342 pathMatchers
: for (PathMatcher pathMatcher
: pathMatchers
) {
343 if (pathMatcher
.matches(file
)) {
344 // Path target = targetBase.resolve(file.getFileName().toString());
345 // if (!Files.exists(target)) {
346 // Files.copy(file, target);
347 // logger.log(Level.DEBUG, () -> "Copied " + target + " from " + downloaded);
349 // logger.log(Level.DEBUG, () -> target + " already exists.");
352 if (file
.getFileName().toString().contains(".source_")) {
353 processEclipseSourceJar(file
, targetCategoryBase
);
354 logger
.log(Level
.DEBUG
, () -> "Processed source " + file
);
357 processBundleJar(file
, targetCategoryBase
, new HashMap
<>());
358 logger
.log(Level
.DEBUG
, () -> "Processed " + file
);
360 continue pathMatchers
;
363 return super.visitFile(file
, attrs
);
367 DirectoryStream
<Path
> dirs
= Files
.newDirectoryStream(targetCategoryBase
, (p
) -> Files
.isDirectory(p
));
368 for (Path dir
: dirs
) {
371 } catch (IOException e
) {
372 throw new RuntimeException("Cannot process " + duDir
, e
);
377 protected Path
processBundleJar(Path file
, Path targetBase
, Map
<String
, String
> entries
) throws IOException
{
378 NameVersion nameVersion
;
379 Path targetBundleDir
;
380 try (JarInputStream jarIn
= new JarInputStream(Files
.newInputStream(file
), false)) {
381 Manifest manifest
= new Manifest(jarIn
.getManifest());
383 // remove problematic entries in MANIFEST
384 manifest
.getEntries().clear();
385 // Set<String> entriesToDelete = new HashSet<>();
386 // for (String key : manifest.getEntries().keySet()) {
387 //// logger.log(DEBUG, "## " + key);
388 // Attributes attrs = manifest.getAttributes(key);
389 // for (Object attrName : attrs.keySet()) {
390 //// logger.log(DEBUG, attrName + "=" + attrs.get(attrName));
391 // if ("Specification-Version".equals(attrName.toString())
392 // || "Implementation-Version".equals(attrName.toString())) {
393 // entriesToDelete.add(key);
398 // for (String key : entriesToDelete) {
399 // manifest.getEntries().remove(key);
402 String symbolicNameFromEntries
= entries
.get(BUNDLE_SYMBOLICNAME
.toString());
403 String versionFromEntries
= entries
.get(BUNDLE_VERSION
.toString());
405 if (symbolicNameFromEntries
!= null && versionFromEntries
!= null) {
406 nameVersion
= new DefaultNameVersion(symbolicNameFromEntries
, versionFromEntries
);
408 nameVersion
= nameVersionFromManifest(manifest
);
409 if (versionFromEntries
!= null && !nameVersion
.getVersion().equals(versionFromEntries
)) {
410 logger
.log(Level
.WARNING
, "Original version is " + nameVersion
.getVersion()
411 + " while new version is " + versionFromEntries
);
414 targetBundleDir
= targetBase
.resolve(nameVersion
.getName() + "." + nameVersion
.getBranch());
416 // TODO make it less dangerous?
417 if (Files
.exists(targetBundleDir
)) {
418 deleteDirectory(targetBundleDir
);
423 entries
: while ((entry
= jarIn
.getNextJarEntry()) != null) {
424 if (entry
.isDirectory())
426 if (entry
.getName().endsWith(".RSA") || entry
.getName().endsWith(".SF"))
428 Path target
= targetBundleDir
.resolve(entry
.getName());
429 Files
.createDirectories(target
.getParent());
430 Files
.copy(jarIn
, target
);
431 logger
.log(Level
.TRACE
, () -> "Copied " + target
);
435 Path manifestPath
= targetBundleDir
.resolve("META-INF/MANIFEST.MF");
436 Files
.createDirectories(manifestPath
.getParent());
437 for (String key
: entries
.keySet()) {
438 String value
= entries
.get(key
);
439 Object previousValue
= manifest
.getMainAttributes().putValue(key
, value
);
440 if (previousValue
!= null && !previousValue
.equals(value
)) {
441 logger
.log(Level
.WARNING
,
442 file
.getFileName() + ": " + key
+ " was " + previousValue
+ ", overridden with " + value
);
445 try (OutputStream out
= Files
.newOutputStream(manifestPath
)) {
449 return targetBundleDir
;
452 protected void processEclipseSourceJar(Path file
, Path targetBase
) throws IOException
{
453 // NameVersion nameVersion;
454 Path targetBundleDir
;
455 try (JarInputStream jarIn
= new JarInputStream(Files
.newInputStream(file
), false)) {
456 Manifest manifest
= jarIn
.getManifest();
457 // nameVersion = nameVersionFromManifest(manifest);
459 String
[] relatedBundle
= manifest
.getMainAttributes().getValue("Eclipse-SourceBundle").split(";");
460 String version
= relatedBundle
[1].substring("version=\"".length());
461 version
= version
.substring(0, version
.length() - 1);
462 NameVersion nameVersion
= new DefaultNameVersion(relatedBundle
[0], version
);
463 targetBundleDir
= targetBase
.resolve(nameVersion
.getName() + "." + nameVersion
.getBranch());
465 Path targetSourceDir
= targetBundleDir
.resolve("OSGI-OPT/src");
467 // TODO make it less dangerous?
468 if (Files
.exists(targetSourceDir
)) {
469 deleteDirectory(targetSourceDir
);
471 Files
.createDirectories(targetSourceDir
);
476 entries
: while ((entry
= jarIn
.getNextJarEntry()) != null) {
477 if (entry
.isDirectory())
479 if (entry
.getName().startsWith("META-INF"))// skip META-INF entries
481 Path target
= targetSourceDir
.resolve(entry
.getName());
482 Files
.createDirectories(target
.getParent());
483 Files
.copy(jarIn
, target
);
484 logger
.log(Level
.TRACE
, () -> "Copied source " + target
);
488 // Path manifestPath = targetBundleDir.resolve("META-INF/MANIFEST.MF");
489 // Files.createDirectories(manifestPath.getParent());
490 // try (OutputStream out = Files.newOutputStream(manifestPath)) {
491 // manifest.write(out);
497 static void deleteDirectory(Path path
) throws IOException
{
498 if (!Files
.exists(path
))
500 Files
.walkFileTree(path
, new SimpleFileVisitor
<Path
>() {
502 public FileVisitResult
postVisitDirectory(Path directory
, IOException e
) throws IOException
{
505 Files
.delete(directory
);
506 return FileVisitResult
.CONTINUE
;
510 public FileVisitResult
visitFile(Path file
, BasicFileAttributes attrs
) throws IOException
{
512 return FileVisitResult
.CONTINUE
;
517 protected NameVersion
nameVersionFromManifest(Manifest manifest
) {
518 Attributes attrs
= manifest
.getMainAttributes();
520 String symbolicName
= attrs
.getValue(ManifestConstants
.BUNDLE_SYMBOLICNAME
.toString());
521 if (symbolicName
== null)
523 // make sure there is no directive
524 symbolicName
= symbolicName
.split(";")[0];
526 String version
= attrs
.getValue(ManifestConstants
.BUNDLE_VERSION
.toString());
527 return new DefaultNameVersion(symbolicName
, version
);
530 protected Path
tryDownload(String uri
, Path dir
) throws IOException
{
532 List
<String
> urlBases
= null;
533 String uriPrefix
= null;
534 uriPrefixes
: for (String uriPref
: mirrors
.keySet()) {
535 if (uri
.startsWith(uriPref
)) {
536 if (mirrors
.get(uriPref
).size() > 0) {
537 urlBases
= mirrors
.get(uriPref
);
543 if (urlBases
== null)
545 return download(new URL(uri
), dir
, null);
546 } catch (FileNotFoundException e
) {
547 throw new FileNotFoundException("Cannot find " + uri
);
551 for (String urlBase
: urlBases
) {
552 String relativePath
= uri
.substring(uriPrefix
.length());
553 URL url
= new URL(urlBase
+ relativePath
);
555 return download(url
, dir
, null);
556 } catch (FileNotFoundException e
) {
557 logger
.log(Level
.WARNING
, "Cannot download " + url
+ ", trying another mirror");
560 throw new FileNotFoundException("Cannot find " + uri
);
563 // protected String simplifyName(URL u) {
564 // String name = u.getPath().substring(u.getPath().lastIndexOf('/') + 1);
568 protected Path
download(URL url
, Path dir
, String name
) throws IOException
{
572 name
= url
.getPath().substring(url
.getPath().lastIndexOf('/') + 1);
575 dest
= dir
.resolve(name
);
576 if (Files
.exists(dest
)) {
577 logger
.log(Level
.TRACE
, () -> "File " + dest
+ " already exists for " + url
+ ", not downloading again");
581 try (InputStream in
= url
.openStream()) {
582 Files
.copy(in
, dest
);
583 logger
.log(Level
.DEBUG
, () -> "Downloaded " + dest
+ " from " + url
);
588 protected Path
createJar(Path bundleDir
) throws IOException
{
589 Path jarPath
= bundleDir
.getParent().resolve(bundleDir
.getFileName() + ".jar");
590 Path manifestPath
= bundleDir
.resolve("META-INF/MANIFEST.MF");
592 try (InputStream in
= Files
.newInputStream(manifestPath
)) {
593 manifest
= new Manifest(in
);
595 try (JarOutputStream jarOut
= new JarOutputStream(Files
.newOutputStream(jarPath
), manifest
)) {
596 Files
.walkFileTree(bundleDir
, new SimpleFileVisitor
<Path
>() {
599 public FileVisitResult
visitFile(Path file
, BasicFileAttributes attrs
) throws IOException
{
600 if (file
.getFileName().toString().equals("MANIFEST.MF"))
601 return super.visitFile(file
, attrs
);
602 JarEntry entry
= new JarEntry(bundleDir
.relativize(file
).toString());
603 jarOut
.putNextEntry(entry
);
604 Files
.copy(file
, jarOut
);
605 return super.visitFile(file
, attrs
);
610 deleteDirectory(bundleDir
);
614 public static void main(String
[] args
) {
615 Path originBase
= Paths
.get("../output/origin").toAbsolutePath().normalize();
616 Path factoryBase
= Paths
.get("../output/a2").toAbsolutePath().normalize();
617 A2Factory factory
= new A2Factory(originBase
, factoryBase
);
619 Path descriptorsBase
= Paths
.get("../tp").toAbsolutePath().normalize();
621 // factory.processSingleM2ArtifactDistributionUnit(descriptorsBase.resolve("org.argeo.tp.apache").resolve("org.apache.xml.resolver.bnd"));
622 factory
.processM2BasedDistributionUnit(descriptorsBase
.resolve("org.argeo.tp.apache/apache-sshd"));
623 // factory.processM2BasedDistributionUnit(descriptorsBase.resolve("org.argeo.tp.jcr/oak"));
627 factory
.processEclipseArchive(
628 descriptorsBase
.resolve("org.argeo.tp.eclipse.equinox").resolve("eclipse-equinox"));
629 factory
.processEclipseArchive(descriptorsBase
.resolve("org.argeo.tp.eclipse.rap").resolve("eclipse-rap"));
630 factory
.processEclipseArchive(descriptorsBase
.resolve("org.argeo.tp.eclipse.rcp").resolve("eclipse-rcp"));
633 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp.sdk"));
634 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp"));
635 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp.apache"));
636 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp.jetty"));
637 factory
.processCategory(descriptorsBase
.resolve("org.argeo.tp.jcr"));