apply plugin: 'java'

// START SNIPPET access-source-set
// Various ways to access the main source set
println sourceSets.main.classesDir
println sourceSets['main'].classesDir
sourceSets {
    println main.classesDir
}
sourceSets {
    main {
        println classesDir
    }
}

// Iterate over the source sets
sourceSets.each {SourceSet set ->
    println set.name
}
// END SNIPPET access-source-set

// START SNIPPET define-source-set
sourceSets {
    intTest
}
// END SNIPPET define-source-set

repositories {
    mavenCentral()
}

// START SNIPPET classpath-using-configurations
configurations {
    intTestCompile { extendsFrom compile }
    intTestRuntime { extendsFrom intTestCompile, runtime }
}

sourceSets {
    intTest {
        compileClasspath = sourceSets.main.classes + configurations.intTestCompile
        runtimeClasspath = classes + sourceSets.main.classes + configurations.intTestRuntime
    }
}
// END SNIPPET classpath-using-configurations

// START SNIPPET jar
task intTestJar(type: Jar) {
    from sourceSets.intTest.classes
}
// END SNIPPET jar

// START SNIPPET javadoc
task intTestJavadoc(type: Javadoc) {
    source sourceSets.intTest.allJava
}
// END SNIPPET javadoc

// START SNIPPET test
task intTest(type: Test) {
    testClassesDir = sourceSets.intTest.classesDir
    classpath = sourceSets.intTest.runtimeClasspath
}
// END SNIPPET test
