/* buildfile for gradle (http://gradle.org/) */ // we compile java apply plugin: 'java' // allow creating files for IntelliJ IDEA apply plugin: 'idea' // ... as well as eclipse apply plugin: 'eclipse' // code coverage reporting apply plugin: 'jacoco' // publish repository for other projects to use apply plugin: 'ivy-publish' // put stuff build by gradle in this directory to avoid // confusion with IDE-generated stuff buildDir = "$projectDir/build-gradle" sourceCompatibility = "1.6" targetCompatibility = "1.6" // specify where to get jars repositories { // we either get them from the libs dir flatDir { dirs 'lib' } // or from the maven central repository mavenCentral() } dependencies { compile group: 'com.google.guava', name: 'guava', version: '16.0.1' compile group: 'junit', name: 'junit', version: '4.11' compile group: 'log4j', name: 'log4j', version: '1.2.16' compile group: 'org.slf4j', name: 'slf4j-api', version: '1.6.4' compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.6.4' } task showClasspath << { System.out.println(configurations.compile.asPath); } task showDeps << { configurations.compile.each { File file -> println file.getPath() } } compileJava.options.debugOptions.debugLevel = "source,lines,vars" // Define task and dependencies for creating an IZPack installer. project.ext.installerFile = "$projectDir/gnunet-java-installer.jar" task installer (type: Exec) { description "build an IZPack installer for gnunet-java" workingDir "$projectDir" outputs.file("$installerFile") } installer.dependsOn "build","javadoc" installer.outputs.upToDateWhen { false } installer.doFirst { def izpack = System.getenv("IZPACK_COMPILER") if (izpack == null) { throw new RuntimeException("environment variable IZPACK_COMPILER not defined") } installer.commandLine "$izpack", "$projectDir/izpack-installer.xml", "-o", "$installerFile" } // Which gradle version do we want to use // for the wrapper? task wrapper(type: Wrapper) { gradleVersion = '1.11' } test { // Print test name, so that we can easily find out // which test does not terminate. beforeTest{ descr -> logger.warn("Starting test ${descr.className} : ${descr.name}") } } task copyDeps(type: Copy) { into "$projectDir/lib" from configurations.runtime } task createResourcesDir << { def myDir = new File('src/main/resources') myDir.mkdirs() } task msgtypes (type: JavaCompile, dependsOn: 'createResourcesDir') { description = "Updates the index of GNUnet message types known to gnunet-java." classpath = project.sourceSets.main.runtimeClasspath source = files(project.sourceSets.main.allJava) options.setCompilerArgs(["-processor", "org.gnunet.construct.MessageIdAnnotationProcessor", "-proc:only", // generated "source" files should resources, tell the annotation processor! "-s", "src/main/resources"]) destinationDir = file("$buildDir/classes/main/") } publishing { publications { ivyGnuNetJava (IvyPublication) { organisation 'org.gnunet' module 'gnunet-java' revision 'svn' from components.java } } repositories { ivy { url "$projectDir/ivy-repo" } } } javadoc.exclude '**/messages/**'