blob: 9ab9df4b5f4076530ed07d0b956c829d58c7d61e [file] [log] [blame]
buildscript {
repositories { mavenCentral() }
dependencies {
classpath 'org.apache.ivy:ivy:2.4.0'
}
}
defaultTasks 'clean', 'bundlor', 'publishToMavenLocal', 'test', 'publishIvyPublicationToIvyRepository'
apply plugin: 'java'
allprojects {
apply plugin: 'java'
repositories {
mavenLocal()
mavenCentral()
ivy {
url "http://build.eclipse.org/rt/virgo/ivy/bundles/release/"
layout "pattern", { artifact "[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" }
}
}
}
subprojects {
apply plugin: 'ivy-publish'
apply plugin: 'maven-publish'
configurations {
bundlorRuntime
sourceBundle
}
dependencies {
bundlorRuntime('org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor.commandline:1.2.0.D-20180309125043')
bundlorRuntime('org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor:1.2.0.D-20180309125043')
bundlorRuntime('org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor.blint:1.2.0.D-20180309125043')
}
task createBuildDir() {
doLast() {
file(project.buildDir).mkdir()
}
}
task('addProjectVersionToGradlePropertiesTask', type: Copy) {
ext.outputDir = new File(buildDir, 'bundlor-properties')
inputs.file project.rootProject.file('gradle.properties')
outputs.dir ext.outputDir
from project.rootProject.file('gradle.properties')
into ext.outputDir
}
def artifactName = project.name.split('-')[0]
def artifactVersion = project.name.split('-')[1]
def outputFile = new File(file(project.buildDir), "${project.name}.jar")
def propertiesPath = new File(file(project.buildDir), "bundlor-properties/gradle.properties")
task bundlor(type: JavaExec, dependsOn: [createBuildDir, 'addProjectVersionToGradlePropertiesTask']) {
classpath = configurations.bundlorRuntime
main = 'org.eclipse.virgo.bundlor.commandline.Bundlor'
args '-r', propertiesPath
args '-D', "springframeworkVersion=${springframeworkVersion}"
args '-i', "${-> configurations.sourceBundle[0]}" // lazy GString to resolve the configuration at runtime
args '-m', "${artifactName}.mf"
args '-o', outputFile
args '-f'
}
publishing {
publications {
ivy(IvyPublication) {
organisation 'org.eclipse.virgo.mirrored'
module "${artifactName}"
revision "${artifactVersion}"
artifact(outputFile)
}
maven(MavenPublication) {
groupId 'org.eclipse.virgo.mirrored'
artifactId "${artifactName}"
version "${artifactVersion}"
artifact(outputFile)
}
}
repositories {
ivy {
url "/opt/public/rt/virgo/ivy/bundles/release"
}
}
}
}
dependencies {
testCompile "junit:junit:${junitVersion}"
testCompile "org.ops4j.pax.exam:pax-exam-junit4:$paxExamJunit4Version"
testCompile group: "org.eclipse.virgo.mirrored", name: "org.eclipse.osgi", version: equinoxVersion, configuration: "compile", ext: "jar"
testCompile group: "org.eclipse.virgo.mirrored", name: "javax.inject", version: javaxInjectVersion, configuration: "compile", ext: "jar"
testRuntime "org.ops4j.pax.exam:pax-exam-container-native:$paxExamContainerNativeVersion"
testRuntime "org.ops4j.pax.exam:pax-exam-link-mvn:$paxExamLinkMvnVersion"
testRuntime "org.ops4j.pax.url:pax-url-aether:$paxUrlAetherVersion"
}
task wrapper(type: Wrapper) {
description 'Creates a local Gradle Wrapper'
group = 'Build Setup'
gradleVersion = '3.5' // CQ 13634
}