apply plugin: 'java'

if (hasProperty('showOutput')) {

// tag::access-source-set[]
// Various ways to access the main source set
println sourceSets.main.output.classesDirs
println sourceSets['main'].output.classesDirs
sourceSets {
    logger.quiet main.output.classesDirs
}
sourceSets {
    main {
        logger.quiet output.classesDirs
    }
}

// Iterate over the source sets
sourceSets.all {
    logger.quiet name
}
// end::access-source-set[]

}

// tag::define-source-set[]
sourceSets {
    intTest
}
// end::define-source-set[]

repositories {
    mavenCentral()
}

// tag::source-set-dependencies[]
sourceSets {
    intTest
}

dependencies {
    intTestCompile 'junit:junit:4.12'
    intTestRuntime 'org.ow2.asm:asm-all:4.0'
}
// end::source-set-dependencies[]

// tag::jar[]
task intTestJar(type: Jar) {
    from sourceSets.intTest.output
}
// end::jar[]

// tag::javadoc[]
task intTestJavadoc(type: Javadoc) {
    source sourceSets.intTest.allJava
}
// end::javadoc[]

// tag::test[]
task intTest(type: Test) {
    testClassesDirs = sourceSets.intTest.output.classesDirs
    classpath = sourceSets.intTest.runtimeClasspath
}
// end::test[]
