Kaynağa Gözat

Added bundlor and maven support to gradle build

Luke Taylor 15 yıl önce
ebeveyn
işleme
d900829921
1 değiştirilmiş dosya ile 24 ekleme ve 2 silme
  1. 24 2
      build.gradle

+ 24 - 2
build.gradle

@@ -1,17 +1,22 @@
+import java.util.jar.Manifest
+import org.gradle.api.tasks.bundling.GradleManifest
 
 
-version = '3.0.0.CI-SNAPSHOT'
+VERSION = '3.0.1.CI-SNAPSHOT'
 
 
 allprojects {
 allprojects {
     repositories {
     repositories {
-        mavenRepo name:'localRepo', urls:'file:///Users/luke/.m2/repository'
+        mavenRepo name:'Local', urls:'file:///Users/luke/.m2/repository'
         mavenCentral()
         mavenCentral()
+        mavenRepo name:'SpringSource Milestone Repo', urls:'http://repository.springsource.com/maven/bundles/milestone'
     }
     }
 }
 }
 
 
 subprojects {
 subprojects {
     apply id: 'java'
     apply id: 'java'
+    apply id: 'maven'
 
 
     group = 'org.springframework.security'
     group = 'org.springframework.security'
+    version = VERSION
 
 
     springVersion = '3.0.0.RELEASE'
     springVersion = '3.0.0.RELEASE'
     springLdapVersion = '1.3.0.RELEASE'
     springLdapVersion = '1.3.0.RELEASE'
@@ -25,6 +30,7 @@ subprojects {
     }*/
     }*/
 
 
     configurations {
     configurations {
+        bundlor
         provided
         provided
     }
     }
 
 
@@ -38,6 +44,9 @@ subprojects {
                     'org.hamcrest:hamcrest-core:1.1',
                     'org.hamcrest:hamcrest-core:1.1',
                     'org.hamcrest:hamcrest-library:1.1',
                     'org.hamcrest:hamcrest-library:1.1',
                     "org.springframework:spring-test:$springVersion"
                     "org.springframework:spring-test:$springVersion"
+        bundlor     'com.springsource.bundlor:com.springsource.bundlor.ant:1.0.0.RC1',
+                    'com.springsource.bundlor:com.springsource.bundlor:1.0.0.RC1',
+                    'com.springsource.bundlor:com.springsource.bundlor.blint:1.0.0.RC1'
     }
     }
 
 
     sourceSets {
     sourceSets {
@@ -52,5 +61,18 @@ subprojects {
     test {
     test {
         options.fork(forkMode: ForkMode.ONCE, jvmArgs: ["-ea", '-Xms128m', '-Xmx1g', '-XX:MaxPermSize=128m', '-XX:+HeapDumpOnOutOfMemoryError'])
         options.fork(forkMode: ForkMode.ONCE, jvmArgs: ["-ea", '-Xms128m', '-Xmx1g', '-XX:MaxPermSize=128m', '-XX:+HeapDumpOnOutOfMemoryError'])
     }
     }
+
+    compileJava.doLast {
+        ant.taskdef(resource: 'com/springsource/bundlor/ant/antlib.xml', classpath: configurations.bundlor.asPath)
+        File template = new File(projectDir, 'template.mf')
+        if (template.exists()) {
+            ant.bundlor(inputPath: "${buildDir}/classes", outputPath: "${buildDir}/classes", manifestTemplatePath: "${projectDir}/template.mf") {
+                property(name: 'version', value: "${version}")
+                property(name: 'spring.version', value: "${springVersion}")
+            }
+            // See GRADLE-395 for support for using an existing manifest
+            jar.manifest = new GradleManifest(new Manifest(new File("${buildDir}/classes/META-INF/MANIFEST.MF").newInputStream()))
+        }
+    }
 }
 }