bundlor.gradle 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import java.util.jar.Manifest
  2. import org.gradle.api.tasks.bundling.GradleManifest
  3. apply id: 'java'
  4. configurations {
  5. bundlor
  6. }
  7. dependencies {
  8. bundlor 'com.springsource.bundlor:com.springsource.bundlor.ant:1.0.0.RELEASE',
  9. 'com.springsource.bundlor:com.springsource.bundlor:1.0.0.RELEASE',
  10. 'com.springsource.bundlor:com.springsource.bundlor.blint:1.0.0.RELEASE'
  11. }
  12. task bundlor(dependsOn: compileJava) {
  13. onlyIf {
  14. dependsOnTaskDidWork()
  15. }
  16. doFirst {
  17. ant.taskdef(resource: 'com/springsource/bundlor/ant/antlib.xml', classpath: configurations.bundlor.asPath)
  18. File template = new File(projectDir, 'template.mf')
  19. mkdir(buildDir, 'bundlor')
  20. if (template.exists()) {
  21. ant.bundlor(inputPath: sourceSets.main.classesDir, outputPath: "$buildDir/bundlor", manifestTemplatePath: template) {
  22. property(name: 'version', value: "$version")
  23. property(name: 'spring.version', value: "$springVersion")
  24. }
  25. // See GRADLE-395 for support for using an existing manifest
  26. jar.manifest = new GradleManifest(new Manifest(new File("$buildDir/bundlor/META-INF/MANIFEST.MF").newInputStream()))
  27. }
  28. }
  29. }
  30. jar.dependsOn bundlor