Skip to content
Snippets Groups Projects
Commit c4da4a83 authored by anttil's avatar anttil
Browse files

SSDM-149: Build cisd-base with Gradle

SVN: 31432
parent cbbf0ddb
No related branches found
No related tags found
No related merge requests found
apply from: 'http://svncisd.ethz.ch/repos/cisd/gradle/trunk/javaproject.gradle' apply from: '../gradle/javaproject.gradle'
apply plugin: 'ivy-publish'
group="cisd"
dependencies { dependencies {
compile 'apache:commons-io:+', compile 'apache:commons-io:+',
'apache:commons-lang:+', 'apache:commons-lang:+',
'testng:testng:+', 'testng:testng:+',
'rinn:restrictions:+', 'rinn:restrictions:+'
'cisd:cisd-unix:+',
'cisd:cisd-nativedata:+'
} }
tasks.withType(Test) {
systemProperty "java.library.path", "../libraries/unix/native/unix/amd64-Linux:../libraries/nativedata/native/nativedata/amd64-Linux:../libraries/unix/native/unix/x86_64-Mac OS X:../libraries/nativedata/native/nativedata/x86_64-Mac OS X"
}
group="cisd"
new ByteArrayOutputStream().withStream { os -> new ByteArrayOutputStream().withStream { os ->
def result = exec { def result = exec {
executable = 'svn' executable = 'svn'
...@@ -22,32 +23,79 @@ new ByteArrayOutputStream().withStream { os -> ...@@ -22,32 +23,79 @@ new ByteArrayOutputStream().withStream { os ->
def matchLastChangedRevMatcher = outputAsString =~ /Last Changed Rev: (\d+)/ def matchLastChangedRevMatcher = outputAsString =~ /Last Changed Rev: (\d+)/
def urlMatcher = outputAsString =~ /URL: .*\/(.+)/ def urlMatcher = outputAsString =~ /URL: .*\/(.+)/
def revision = "r${matchLastChangedRevMatcher[0][1]}" def revision = "r${matchLastChangedRevMatcher[0][1]}"
def branch = urlMatcher[0][1] def branch = urlMatcher[0][1]
if (branch.equals('trunk')) { if (branch.equals('trunk')) {
project.version = revision project.version = revision
} else { } else {
project.version = branch project.version = branch
} }
} }
publishing { sourceSets {
publications { test {
ivy(IvyPublication) { resources {
from components.java srcDir "../libraries"
artifact(sourceJar) include "nativedata/**"
} include "unix/**"
} }
repositories { }
ivy { }
ivyPattern "file://${project.projectDir}/../ivy-repository/[organisation]/[module]/[revision]/ivy.xml"
artifactPattern "file://${project.projectDir}/../ivy-repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" jar {
} from fileTree("../libraries/nativedata/")
from fileTree("../libraries/unix/")
}
task standaloneTestJar(type: Jar, dependsOn: [classes, testClasses]) {
archiveName 'cisd-base-test.jar'
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from files(sourceSets.test.output.classesDir)
from files("../libraries/nativedata")
from files("../libraries/unix")
from {configurations.testRuntime.collect {zipTree(it)}}
manifest {
attributes 'Main-Class': 'ch.systemsx.cisd.base.AllTests'
} }
} }
publish { task javadocZip(type: Zip, dependsOn: javadoc) {
dependsOn build archiveName 'cisd-base-javadoc.zip'
from javadoc.destinationDir
} }
task distributionZip(type: Zip, dependsOn: [jar, sourcesJar, javadocZip, standaloneTestJar]) {
archiveBaseName = 'cisd-base'
from ('dist') {
into 'cisd-base'
}
from ('doc') {
into 'cisd-base/doc'
}
from (jar.archivePath) {
into 'cisd-base/lib'
rename '(.*)', 'cisd-base.jar'
}
from (sourcesJar.archivePath) {
into 'cisd-base/src'
rename '(.*)', 'cisd-base-src.jar'
}
from (standaloneTestJar.archivePath) {
into 'cisd-base/lib'
}
from (javadocZip.archivePath) {
into 'cisd-base/doc'
}
}
build.dependsOn distributionZip
No preview for this file type
#Fri May 10 09:46:23 CEST 2013 #Wed Apr 23 11:31:33 CEST 2014
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=http\://svncisd.ethz.ch/repos/cisd/ivy-repository/trunk/gradle/distribution/1.5/gradle-1.5-bin.zip distributionUrl=http\://svncisd.ethz.ch/repos/cisd/ivy-repository/trunk/gradle/distribution/1.8/gradle-1.8-all.zip
...@@ -75,26 +75,31 @@ gatheringTask.setProject(antProject) ...@@ -75,26 +75,31 @@ gatheringTask.setProject(antProject)
gatheringTask.setVersion("version") gatheringTask.setVersion("version")
gatheringTask.setRevision("revision") gatheringTask.setRevision("revision")
gatheringTask.setClean("clean") gatheringTask.setClean("clean")
gatheringTask.execute()
versionNumber = antProject.getProperty("version")
revisionNumber = antProject.getProperty("revision")
cleanFlag = antProject.getProperty("clean")
// set version
version=versionNumber+"-r"+revisionNumber
println "${project.name}: ${version}"
// create BUILD INFO file
def targetsDist = 'targets/dist'
def distFolder = new File("${project.projectDir}/${targetsDist}")
distFolder.deleteDir()
distFolder.mkdirs()
def writer = new FileWriter("${project.projectDir}/${targetsDist}/BUILD-${project.name}.INFO")
try { try {
writer.println("${versionNumber}:${revisionNumber}:${cleanFlag}") gatheringTask.execute()
} finally { versionNumber = antProject.getProperty("version")
writer.close() revisionNumber = antProject.getProperty("revision")
cleanFlag = antProject.getProperty("clean")
// set version
version=versionNumber+"-r"+revisionNumber
println "${project.name}: ${version}"
// create BUILD INFO file
def targetsDist = 'targets/dist'
def distFolder = new File("${project.projectDir}/${targetsDist}")
distFolder.deleteDir()
distFolder.mkdirs()
def writer = new FileWriter("${project.projectDir}/${targetsDist}/BUILD-${project.name}.INFO")
try {
writer.println("${versionNumber}:${revisionNumber}:${cleanFlag}")
} finally {
writer.close()
}
} catch (Exception e) {
println "skipping gathering"
} }
...@@ -236,9 +241,29 @@ task testRuntimeDependencies(type: Copy) { ...@@ -236,9 +241,29 @@ task testRuntimeDependencies(type: Copy) {
task checkDependencies(dependsOn: classes) << { task checkDependencies(dependsOn: classes) << {
ant.taskdef(name: 'dependencychecker', classname: 'classycle.ant.DependencyCheckingTask', classpath: configurations.testRuntime.asPath) ant.taskdef(name: 'dependencychecker', classname: 'classycle.ant.DependencyCheckingTask', classpath: configurations.testRuntime.asPath)
ant.dependencychecker( ant.dependencychecker(
definitionFile: 'resource/dependency-structure.ddf', definitionFile: 'resource/dependency-structure.ddf',
failOnUnwantedDependencies: 'true', failOnUnwantedDependencies: 'true',
mergeInnerClasses: 'true') { mergeInnerClasses: 'true') {
fileset(dir: "${buildDir}", includes: "**/*.class") fileset(dir: "${buildDir}", includes: "**/*.class")
} }
}
apply plugin: 'ivy-publish'
publishing {
publications {
ivy(IvyPublication) {
from components.java
artifact(sourcesJar)
}
}
repositories {
ivy {
ivyPattern "file://${project.projectDir}/../ivy-repository/[organisation]/[module]/[revision]/ivy.xml"
artifactPattern "file://${project.projectDir}/../ivy-repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
}
}
}
publish {
dependsOn build
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment