From d170e6314741911501e91b121863833a9279ff52 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Tue, 17 Jan 2012 14:03:49 +0100 Subject: [PATCH] Generate OSGi manifests using bundlor-plugin - Apply custom-built Gradle 'bundlor' plugin This plugin wraps the existing bundlor ant task. Sources available at https://github.com/SpringSource/gradle-plugins. - Use existing template.mf files The bundlor plugin allows for 'inlining' bundlor templates directly within build.gradle using the 'importTemplate' property, but opting for now to keep the template.mf files separate. - Exclude spring-aspects from bundlor processing It appears that the bundlor plugin somehow interferes with iajc compilation of aspects, resulting in compiler errors. Bundlor has been disabled for this project for the time being. - Fail the build on any bundlor warning The gradle bundlor plugin defaults to failing the build if there are any warnings when processing template.mf files. This helps to ensure that template.mf files don't drift too far from actual dependency declarations. This behavior can be modified by setting bundlor { failOnWarnings = false } in the build script. --- build.gradle | 16 +++++++++++++++- org.springframework.context/template.mf | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index cae83ec5f8..aa1943c702 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ buildscript { } dependencies { classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.2-SNAPSHOT' + classpath 'org.springframework.build.gradle:bundlor-plugin:0.1.2-SNAPSHOT' } } @@ -24,7 +25,10 @@ configure(allprojects) { test.systemProperty("java.awt.headless", "true") repositories { - maven { url "http://repo.springsource.org/libs-release" } + maven { + url "http://repo.springsource.org/libs-release" + url "http://repo.springsource.org/plugins-release" + } } dependencies { @@ -77,6 +81,16 @@ configure(subprojects) { } } +configure(subprojects - project(":spring-aspects")) { + apply plugin: 'bundlor' + bundlor { + manifestTemplate = new File("${projectDir}/template.mf").text + .replace('${spring.osgi.range}', /"[$version, $version]"/) + .replace('${aj.osgi.range}', '"[1.6.8, 2.0.0)"') + } +} + + project("spring-asm") { description = 'Spring ASM' diff --git a/org.springframework.context/template.mf b/org.springframework.context/template.mf index 12f4bbb0e1..19cae29fd6 100644 --- a/org.springframework.context/template.mf +++ b/org.springframework.context/template.mf @@ -4,7 +4,7 @@ Bundle-Vendor: SpringSource Bundle-ManifestVersion: 2 Import-Package: javax.persistence;version="[1.0.0, 3.0.0)";resolution:=optional, - org.springframework.orm.jpa.support;version="${spring.osgi.range.nq}";resolution:=optional, + org.springframework.orm.jpa.support;version=${spring.osgi.range};resolution:=optional, com.ibm.websphere.management;version="0";resolution:=optional Import-Template: bsh.*;version="[2.0.0.b4, 3.0.0)";resolution:=optional,