group 'com.r3cev.prototyping' version '1.0-SNAPSHOT' apply plugin: 'java' apply plugin: 'kotlin' buildscript { repositories { mavenCentral() } } // apply plugin: 'org.jetbrains.dokka' repositories { mavenLocal() mavenCentral() jcenter() maven { url 'http://oss.sonatype.org/content/repositories/snapshots' } } //noinspection GroovyAssignabilityCheck configurations { quasar } dependencies { testCompile 'junit:junit:4.12' testCompile 'org.assertj:assertj-core:3.4.1' testCompile "commons-fileupload:commons-fileupload:1.3.1" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" // Thread safety annotations compile "com.google.code.findbugs:jsr305:3.0.1" // AssertJ: for fluent assertions for testing testCompile "org.assertj:assertj-core:3.4.1" // SLF4J: Logging framework. compile "org.slf4j:slf4j-jdk14:1.7.13" // Guava: Google utilities library. compile "com.google.guava:guava:19.0" // RxJava: observable streams of events. compile "io.reactivex:rxjava:1.0.17" // Kryo: object graph serialization. compile "com.esotericsoftware:kryo:3.0.3" compile "de.javakaffee:kryo-serializers:0.37" // Quasar: for the bytecode rewriting for state machines. compile "co.paralleluniverse:quasar-core:${quasar_version}:jdk8" // Apache JEXL: An embeddable expression evaluation library. // This may be temporary until we experiment with other ways to do on-the-fly contract specialisation via an API. compile "org.apache.commons:commons-jexl3:3.0" // For JSON compile "com.fasterxml.jackson.core:jackson-databind:2.5.5" // Quasar: for the bytecode rewriting for state machines. quasar "co.paralleluniverse:quasar-core:${quasar_version}:jdk8@jar" } tasks.withType(Test) { jvmArgs "-javaagent:${configurations.quasar.singleFile}" jvmArgs "-Dco.paralleluniverse.fibers.verifyInstrumentation" } tasks.withType(JavaExec) { jvmArgs "-javaagent:${configurations.quasar.singleFile}" jvmArgs "-Dco.paralleluniverse.fibers.verifyInstrumentation" } // These lines tell gradle to run the Quasar suspendables scanner to look for unannotated super methods // that have @Suspendable sub implementations. These tend to cause NPEs and are not caught by the verifier // NOTE: need to make sure the output isn't on the classpath or every other run it generates empty results, so // we explicitly delete to avoid that happening. We also need to turn off what seems to be a spurious warning in the IDE // // TODO: Make this task incremental, as it can be quite slow. //noinspection GroovyAssignabilityCheck task quasarScan(dependsOn: ['classes']) << { ant.taskdef(name:'scanSuspendables', classname:'co.paralleluniverse.fibers.instrument.SuspendablesScanner', classpath: "${sourceSets.main.output.classesDir}:${sourceSets.main.output.resourcesDir}:${configurations.runtime.asPath}") delete "$sourceSets.main.output.resourcesDir/META-INF/suspendables", "$sourceSets.main.output.resourcesDir/META-INF/suspendable-supers" ant.scanSuspendables( auto:false, suspendablesFile: "$sourceSets.main.output.resourcesDir/META-INF/suspendables", supersFile: "$sourceSets.main.output.resourcesDir/META-INF/suspendable-supers") { fileset(dir: sourceSets.main.output.classesDir) } } jar.dependsOn quasarScan