Initial builds using bazel
Change-Id: I38123b396a2ffda5f36cdca43f3ad1fa67a7ab52
diff --git a/utils/osgiwrap/BUILD b/utils/osgiwrap/BUILD
new file mode 100644
index 0000000..8e1e872
--- /dev/null
+++ b/utils/osgiwrap/BUILD
@@ -0,0 +1,15 @@
+OSGIWRAP_EXECUTABLE = 'osgi-jar'
+
+COMPILE_DEPS = [
+ '@guava//jar',
+ '@bndlib//jar',
+ '@org_apache_felix_scr_bnd//jar'
+]
+
+java_binary(
+ name = OSGIWRAP_EXECUTABLE,
+ srcs = glob(['src/main/java/**/*.java']),
+ deps = COMPILE_DEPS,
+ main_class = 'org.onlab.osgiwrap.OSGiWrapper',
+ visibility = ["//visibility:public"]
+)
diff --git a/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java b/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java
index 8a10992..fe286cb 100644
--- a/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java
+++ b/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java
@@ -74,10 +74,11 @@
private String bundleLicense;
private String webContext;
+ private String destdir;
// FIXME should consider using Commons CLI, etc.
public static void main(String[] args) {
- if (args.length < 12) {
+ if (args.length < 13) {
System.err.println("Not enough args");
System.exit(1);
}
@@ -94,6 +95,7 @@
String includeResources = args[9];
String webContext = args[10];
String dynamicimportPackages = args[11];
+ String destdir = args[12];
String desc = Joiner.on(' ').join(Arrays.copyOfRange(args, 12, args.length));
OSGiWrapper wrapper = new OSGiWrapper(jar, output, cp,
@@ -103,7 +105,8 @@
includeResources,
webContext,
dynamicimportPackages,
- desc);
+ desc,
+ destdir);
wrapper.log(wrapper + "\n");
if (!wrapper.execute()) {
System.err.printf("Error generating %s\n", name);
@@ -124,7 +127,8 @@
String includeResources,
String webContext,
String dynamicimportPackages,
- String bundleDescription) {
+ String bundleDescription,
+ String destdir) {
this.inputJar = inputJar;
this.classpath = Lists.newArrayList(classpath.split(":"));
if (!this.classpath.contains(inputJar)) {
@@ -151,6 +155,7 @@
}
this.webContext = webContext;
+ this.destdir = destdir;
}
private void setProperties(Analyzer analyzer) {
@@ -209,6 +214,8 @@
// Scan the JAR for Felix SCR annotations and generate XML files
Map<String, String> properties = Maps.newHashMap();
+ // destdir hack
+ properties.put("destdir", destdir);
SCRDescriptorBndPlugin scrDescriptorBndPlugin = new SCRDescriptorBndPlugin();
scrDescriptorBndPlugin.setProperties(properties);
scrDescriptorBndPlugin.setReporter(analyzer);