Partially reverting Change-Id: Ic3a2f13c14816e803debc208826445ef27b49a4f
Calls to .build() and addLocalPackages() were breaking WARs.
Also, forcing onos-buck to check SHA of downloaded bits rather than just Buck's version
Change-Id: I2e93ffaec7eb08ace3742b8f5456516836e149e2
diff --git a/tools/build/buck-plugin/buck-plugin-install b/tools/build/buck-plugin/buck-plugin-install
index 9dc44d7..15cf0e6 100755
--- a/tools/build/buck-plugin/buck-plugin-install
+++ b/tools/build/buck-plugin/buck-plugin-install
@@ -5,7 +5,7 @@
set -e
# Build it first
-pluginJar=$(NO_BUCKD=1 buck build //tools/build/buck-plugin:onos --no-cache --show-output | grep onos.jar | cut -d\ -f2)
+pluginJar=$(NO_BUCKD=1 onos-buck build //tools/build/buck-plugin:onos --no-cache --show-output | grep onos.jar | cut -d\ -f2)
# Then install it
mkdir -p $PLUGINS
diff --git a/tools/build/buck-plugin/buck-plugin-test b/tools/build/buck-plugin/buck-plugin-test
index 41ddf31..cb8fd76 100755
--- a/tools/build/buck-plugin/buck-plugin-test
+++ b/tools/build/buck-plugin/buck-plugin-test
@@ -1,3 +1,3 @@
#!/bin/bash
-NO_BUCKD=1 buck build //apps/dhcp/app:onos-apps-dhcp-app --no-cache --show-output
+NO_BUCKD=1 onos-buck build //apps/dhcp/app:onos-apps-dhcp-app --no-cache --show-output
diff --git a/tools/build/buck-plugin/src/main/java/org/onosproject/onosjar/OSGiWrapper.java b/tools/build/buck-plugin/src/main/java/org/onosproject/onosjar/OSGiWrapper.java
index 8cf91af..a1f3a5f 100644
--- a/tools/build/buck-plugin/src/main/java/org/onosproject/onosjar/OSGiWrapper.java
+++ b/tools/build/buck-plugin/src/main/java/org/onosproject/onosjar/OSGiWrapper.java
@@ -158,9 +158,10 @@
dynamicimportPackages);
// TODO include version in export, but not in import
- // analyzer.setProperty(Analyzer.EXPORT_PACKAGE, exportPackages);
+ analyzer.setProperty(Analyzer.EXPORT_PACKAGE, exportPackages);
// TODO we may need INCLUDE_RESOURCE, or that might be done by Buck
+ // FIXME NOTE we handle this manually below
if (includeResources != null) {
analyzer.setProperty(Analyzer.INCLUDE_RESOURCE, includeResources);
}
@@ -176,7 +177,7 @@
Builder analyzer = new Builder();
try {
- Jar jar = new Jar(inputJar.toFile()); // where our data is
+ Jar jar = new Jar(inputJar.toFile()); // where our data is
analyzer.setJar(jar); // give bnd the contents
// You can provide additional class path entries to allow
@@ -186,16 +187,20 @@
setProperties(analyzer);
- //analyzer.setBase(classesDir.toFile());
+ // Analyze the target JAR first
+ analyzer.analyze();
-// analyzer.setProperty("DESTDIR");
-// analyzer.setBase();
-
- // ------------- let's begin... -------------------------
+ // Scan the JAR for Felix SCR annotations and generate XML files
+ Map<String, String> properties = Maps.newHashMap();
+ properties.put("destdir", classesDir.toAbsolutePath().toString());
+ SCRDescriptorBndPlugin scrDescriptorBndPlugin = new SCRDescriptorBndPlugin();
+ scrDescriptorBndPlugin.setProperties(properties);
+ scrDescriptorBndPlugin.setReporter(analyzer);
+ scrDescriptorBndPlugin.analyzeJar(analyzer);
//Add local packges to jar file.
- addLocalPackages(new File(classesDir.toString()), analyzer);
-// analyzer.analyze();
+ //FIXME removing this call for now; not sure what exactly it's doing
+ //addLocalPackages(new File(classesDir.toString()), analyzer);
//add resources.
if (includeResources != null) {
@@ -206,27 +211,15 @@
doWabStaging(analyzer);
// Calculate the manifest
-// Manifest manifest = analyzer.calcManifest();
- //OutputStream s = new FileOutputStream("/tmp/foo2.txt");
- //manifest.write(s);
- //s.close();
+ Manifest manifest = analyzer.calcManifest();
+
+ //Build the jar files
+ //FIXME this call conflicts with some of the above
+// analyzer.build();
if (analyzer.isOk()) {
- //Build the jar files
- analyzer.build();
- Map<String, String> properties = Maps.newHashMap();
-
- // Scan the JAR for Felix SCR annotations and generate XML files
- properties.put("destdir", classesDir.toAbsolutePath().toString());
- SCRDescriptorBndPlugin scrDescriptorBndPlugin = new SCRDescriptorBndPlugin();
- scrDescriptorBndPlugin.setProperties(properties);
- scrDescriptorBndPlugin.setReporter(analyzer);
- scrDescriptorBndPlugin.analyzeJar(analyzer);
-
//add calculated manifest file.
- Manifest manifest = analyzer.calcManifest();
analyzer.getJar().setManifest(manifest);
-
if (analyzer.save(outputJar.toFile(), true)) {
log("Saved!\n");
} else {