apply from: "$rootProject.projectDir/gradle/coverage.gradle"
apply from: "$rootProject.projectDir/gradle/publishing.gradle"

dependencies {
    compile "io.vertx:vertx-core:$vertxVersion"
    compile "io.vertx:vertx-codegen:$vertxVersion"
    compile "io.vertx:vertx-service-proxy:$vertxVersion"
    compile "io.vertx:vertx-service-discovery:$vertxVersion"
    compile "com.graphql-java:graphql-java:$graphqlVersion"

    testCompile project(path: ':graphql-service-publisher')
    testCompile project(path: ':graphql-testdata')

    testCompile "junit:junit:$junitVersion"
    testCompile "io.vertx:vertx-unit:$vertxVersion"
}

sourceSets {
    generated {
        java.srcDir "${projectDir}/src/main/generated"
    }
}

task generateProxies(type: JavaCompile) {
    group = "build"
    description = "Generate Vert.x service proxies"

    source = sourceSets.main.java
    classpath = configurations.compile
    options.compilerArgs = [
            "-proc:only",
            "-processor", "io.vertx.codegen.CodeGenProcessor",
            "-Acodegen.output=${projectDir}/src/main"
    ]
    destinationDir = file("${projectDir}/src/main/generated")
}

compileJava{
    dependsOn generateProxies
    source += sourceSets.generated.java
}

clean {
    delete += sourceSets.generated.java.srcDirs
}
