X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.repo%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Frepo%2Fosgi%2FNormalizeGroup.java;h=347e79be9917c2a13fc464060d75dc90828ae42a;hb=604aac63035b30549b51a7030f49e0bf83c558f5;hp=57cc1145c9f2e909b6c4f5c8d47f5dee19bce35d;hpb=4578db21c506c3f8eee57a896c9e71154e2065be;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/NormalizeGroup.java b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/NormalizeGroup.java index 57cc1145c..347e79be9 100644 --- a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/NormalizeGroup.java +++ b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/NormalizeGroup.java @@ -59,8 +59,10 @@ public class NormalizeGroup implements Runnable, SlcNames { private String workspace; private String groupId; private String artifactBasePath = "/"; - private String version = "1.3.0"; - private String parentPomCoordinates = "org.argeo:parent:1.3.0"; + private String version = null; + private String parentPomCoordinates; + + private List excludedSuffixes = new ArrayList(); private ArtifactIndexer artifactIndexer = new ArtifactIndexer(); private JarFileIndexer jarFileIndexer = new JarFileIndexer(); @@ -155,8 +157,10 @@ public class NormalizeGroup implements Runnable, SlcNames { Set artifacts) throws RepositoryException { Artifact artifact = new DefaultArtifact(groupId, artifactId, "pom", version); + Artifact parentArtifact = parentPomCoordinates != null ? new DefaultArtifact( + parentPomCoordinates) : null; String pom = MavenConventionsUtils.artifactsAsDependencyPom(artifact, - artifacts, new DefaultArtifact(parentPomCoordinates)); + artifacts, parentArtifact); Node node = RepoUtils.copyBytesAsArtifact( session.getNode(artifactBasePath), artifact, pom.getBytes()); artifactIndexer.index(node); @@ -178,6 +182,12 @@ public class NormalizeGroup implements Runnable, SlcNames { if (symbolicName.endsWith(".source")) { // TODO make a shared node with classifier 'sources' + String bundleName = RepoUtils + .extractBundleNameFromSourceName(symbolicName); + for (String excludedSuffix : excludedSuffixes) { + if (bundleName.endsWith(excludedSuffix)) + return;// skip adding to sources + } sources.add(RepoUtils.asArtifact(bundleNode)); return; } @@ -191,7 +201,14 @@ public class NormalizeGroup implements Runnable, SlcNames { } symbolicNamesToNodes.put(symbolicName, bundleNode); + for (String excludedSuffix : excludedSuffixes) { + if (symbolicName.endsWith(excludedSuffix)) + return;// skip adding to binaries + } binaries.add(RepoUtils.asArtifact(bundleNode)); + + if (bundleNode.getSession().hasPendingChanges()) + bundleNode.getSession().save(); } protected void processBundleArtifact(Node bundleNode) @@ -355,4 +372,16 @@ public class NormalizeGroup implements Runnable, SlcNames { this.parentPomCoordinates = parentPomCoordinates; } + public void setArtifactBasePath(String artifactBasePath) { + this.artifactBasePath = artifactBasePath; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setExcludedSuffixes(List excludedSuffixes) { + this.excludedSuffixes = excludedSuffixes; + } + }