Skip to content
Snippets Groups Projects
build.gradle 2.25 KiB
Newer Older
  • Learn to ignore specific revisions
  • felmer's avatar
    felmer committed
    apply from: '../gradle/javaproject.gradle'
    
    
    group="cisd"
    
        compile 'apache:commons-io:+',
                'apache:commons-lang:+',
                'testng:testng:+',
                'rinn:restrictions:+'
    
    tasks.withType(Test) {
    
        systemProperty "java.library.path", "libs/native/unix/amd64-Linux:libs/native/nativedata/amd64-Linux:libs/native/unix/x86_64-Mac OS X:libs/native/nativedata/x86_64-Mac OS X"
    
    new ByteArrayOutputStream().withStream { os ->
        def result = exec {
            executable = 'svn'
            args = ['info']
            standardOutput = os
        }
        def outputAsString = os.toString()
        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
        }
    
    sourceSets {
      test {
        resources {
    
    }
    
    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 {configurations.testRuntime.collect {zipTree(it)}}
     
        manifest {
            attributes 'Main-Class': 'ch.systemsx.cisd.base.AllTests'
    
    task javadocZip(type: Zip, dependsOn: javadoc) {
        archiveName 'cisd-base-javadoc.zip'
        from javadoc.destinationDir
    
    task distributionZip(type: Zip, dependsOn: [jar, sourcesJar, javadocZip, standaloneTestJar]) {
    
        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