import org.argeo.slc.SlcException;
import org.argeo.slc.aether.ArtifactIdComparator;
import org.argeo.slc.build.Distribution;
+import org.argeo.slc.build.License;
import org.argeo.slc.repo.OsgiFactory;
import org.argeo.slc.repo.RepoUtils;
import org.sonatype.aether.artifact.Artifact;
private OsgiFactory osgiFactory;
private String version;
+ private License license;
private String uri;
private Boolean mavenGroupIndexes = false;
public void init() {
- if (version != null)
- for (BndWrapper wrapper : wrappers.values()) {
- if (wrapper.getVersion() == null)
- wrapper.setVersion(version);
- wrapper.setFactory(this);
- }
+ for (BndWrapper wrapper : wrappers.values()) {
+ wrapper.setFactory(this);
+ if (version != null && wrapper.getVersion() == null)
+ wrapper.setVersion(version);
+ if (license != null && wrapper.getLicense() == null)
+ wrapper.setLicense(license);
+ }
}
public void destroy() {
this.version = version;
}
+ public void setLicense(License license) {
+ this.license = license;
+ }
+
public void setPathMatcher(PathMatcher pathMatcher) {
this.pathMatcher = pathMatcher;
}
import org.argeo.slc.CategorizedNameVersion;
import org.argeo.slc.SlcException;
import org.argeo.slc.build.Distribution;
+import org.argeo.slc.build.License;
import org.osgi.framework.Version;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.util.artifact.DefaultArtifact;
private String groupId;
private String name;
- private String version;
private Properties bndProperties = new Properties();
+ private String version;
+ private License license;
+
private Boolean doNotModify = false;
private Runnable factory = null;
Version versionToUse;
if (sourceManifest != null) {
+ // Symbolic name
String sourceSymbolicName = sourceManifest.getMainAttributes()
.getValue(BUNDLE_SYMBOLICNAME);
if (sourceSymbolicName != null
+ ") is not consistant with the wrapped bundle symbolic name ("
+ sourceSymbolicName + ")");
+ // Version
String sourceVersion = sourceManifest.getMainAttributes()
.getValue(BUNDLE_VERSION);
if (version == null && sourceVersion == null) {
properties.setProperty(BUNDLE_SYMBOLICNAME, name);
properties.setProperty(BUNDLE_VERSION, versionToUse.toString());
+ // License
+ if (license != null) {
+ StringBuilder sb = new StringBuilder(license.getUri());
+ if (license.getName() != null)
+ sb.append(';').append("description=")
+ .append(license.getName());
+ if (license.getLink() != null)
+ sb.append(';').append("link=")
+ .append(license.getLink());
+ properties.setProperty(BUNDLE_LICENSE, sb.toString());
+ // TODO add LICENSE.TXT
+ } else {
+ log.warn("No license set for " + toString());
+ }
+
// b.addIncluded(jarFile);
b.addClasspath(jar);
}
public void setFactory(Runnable factory) {
+ if (this.factory != null)
+ throw new SlcException("Factory already set on " + name);
this.factory = factory;
}
}
public void setVersion(String version) {
+ if (this.version != null)
+ throw new SlcException("Version already set on " + name + " ("
+ + this.version + ")");
this.version = version;
}
return version;
}
+ public License getLicense() {
+ return license;
+ }
+
+ public void setLicense(License license) {
+ if (this.license != null)
+ throw new SlcException("License already set on " + name);
+ this.license = license;
+ }
+
public Properties getBndProperties() {
return bndProperties;
}