java-tutorials/gradle-modules/gradle-5/source-sets/build.gradle

67 lines
1.5 KiB
Groovy
Raw Normal View History

2020-08-15 07:42:21 -04:00
apply plugin: "eclipse"
apply plugin: "java"
2020-08-15 07:42:21 -04:00
description = "Source Sets example"
task printSourceSetInformation(){
2020-08-18 14:52:30 -04:00
description = "Print source set information"
2020-08-15 07:42:21 -04:00
doLast{
sourceSets.each { srcSet ->
println "["+srcSet.name+"]"
print "-->Source directories: "+srcSet.allJava.srcDirs+"\n"
print "-->Output directories: "+srcSet.output.classesDirs.files+"\n"
print "-->Compile classpath:\n"
srcSet.compileClasspath.files.each {
print " "+it.path+"\n"
}
println ""
2020-08-15 07:42:21 -04:00
}
}
}
2020-08-17 16:55:43 -04:00
sourceSets{
itest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
java {
}
}
}
2020-08-17 16:55:43 -04:00
test {
testLogging {
events "passed","skipped", "failed"
}
}
2020-08-15 07:42:21 -04:00
dependencies {
implementation('org.apache.httpcomponents:httpclient:4.5.12')
testImplementation('junit:junit:4.12')
2020-08-17 16:55:43 -04:00
itestImplementation('com.google.guava:guava:29.0-jre')
}
2020-08-18 14:52:30 -04:00
task itest(type: Test) {
description = "Run integration tests"
group = "verification"
testClassesDirs = sourceSets.itest.output.classesDirs
classpath = sourceSets.itest.runtimeClasspath
}
itest {
testLogging {
events "passed","skipped", "failed"
}
}
2020-08-17 16:55:43 -04:00
configurations {
itestImplementation.extendsFrom(testImplementation)
2020-08-18 14:52:30 -04:00
itestRuntimeOnly.extendsFrom(testRuntimeOnly)
2020-08-15 07:42:21 -04:00
}
eclipse {
classpath {
plusConfigurations+=[configurations.itestCompileClasspath]
}
}