diff --git a/base/build.gradle b/base/build.gradle index 54d149dc3b34e3dcc168d3903637281764082fd9..3f45da87c48c4475d9ddfa2424535082db21e4c5 100644 --- a/base/build.gradle +++ b/base/build.gradle @@ -1,17 +1,18 @@ -apply from: 'http://svncisd.ethz.ch/repos/cisd/gradle/trunk/javaproject.gradle' -apply plugin: 'ivy-publish' +apply from: '../gradle/javaproject.gradle' + +group="cisd" dependencies { - compile 'apache:commons-io:+', - 'apache:commons-lang:+', - 'testng:testng:+', - 'rinn:restrictions:+', - 'cisd:cisd-unix:+', - 'cisd:cisd-nativedata:+' + compile 'apache:commons-io:+', + 'apache:commons-lang:+', + 'testng:testng:+', + 'rinn:restrictions:+' } +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 -> def result = exec { executable = 'svn' @@ -22,32 +23,79 @@ new ByteArrayOutputStream().withStream { os -> def matchLastChangedRevMatcher = outputAsString =~ /Last Changed Rev: (\d+)/ def urlMatcher = outputAsString =~ /URL: .*\/(.+)/ - def revision = "r${matchLastChangedRevMatcher[0][1]}" - def branch = urlMatcher[0][1] - - if (branch.equals('trunk')) { - project.version = revision - } else { - project.version = branch - } + def revision = "r${matchLastChangedRevMatcher[0][1]}" + def branch = urlMatcher[0][1] + + if (branch.equals('trunk')) { + project.version = revision + } else { + project.version = branch + } } -publishing { - publications { - ivy(IvyPublication) { - from components.java - artifact(sourceJar) - } +sourceSets { + test { + resources { + srcDir "../libraries" + 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 { - dependsOn build +task javadocZip(type: Zip, dependsOn: javadoc) { + 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 + diff --git a/base/gradle/wrapper/gradle-wrapper.jar b/base/gradle/wrapper/gradle-wrapper.jar index faa569a9a0eedc9ff37450fed24a7efd77a86729..667288ad6c2b3b87c990ece1267e56f0bcbf3622 100644 Binary files a/base/gradle/wrapper/gradle-wrapper.jar and b/base/gradle/wrapper/gradle-wrapper.jar differ diff --git a/base/gradle/wrapper/gradle-wrapper.properties b/base/gradle/wrapper/gradle-wrapper.properties index 2a19a986753344bdd4ebfa1e9ed7541f871eb0ca..e4d08ce084b943b08c9756b4b25c33133f02e40b 100644 --- a/base/gradle/wrapper/gradle-wrapper.properties +++ b/base/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri May 10 09:46:23 CEST 2013 +#Wed Apr 23 11:31:33 CEST 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME 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 diff --git a/gradle/javaproject.gradle b/gradle/javaproject.gradle index 455b7b3630a75496c5c88001557b6cb336f4c854..315a17fabad594283acff6b25b4964d3f7540b08 100644 --- a/gradle/javaproject.gradle +++ b/gradle/javaproject.gradle @@ -75,26 +75,31 @@ gatheringTask.setProject(antProject) gatheringTask.setVersion("version") gatheringTask.setRevision("revision") 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 { - writer.println("${versionNumber}:${revisionNumber}:${cleanFlag}") -} finally { - writer.close() + 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 { + writer.println("${versionNumber}:${revisionNumber}:${cleanFlag}") + } finally { + writer.close() + } +} catch (Exception e) { + println "skipping gathering" } @@ -236,9 +241,29 @@ task testRuntimeDependencies(type: Copy) { task checkDependencies(dependsOn: classes) << { ant.taskdef(name: 'dependencychecker', classname: 'classycle.ant.DependencyCheckingTask', classpath: configurations.testRuntime.asPath) ant.dependencychecker( - definitionFile: 'resource/dependency-structure.ddf', - failOnUnwantedDependencies: 'true', - mergeInnerClasses: 'true') { - fileset(dir: "${buildDir}", includes: "**/*.class") - } + definitionFile: 'resource/dependency-structure.ddf', + failOnUnwantedDependencies: 'true', + mergeInnerClasses: 'true') { + 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