Files
Sourcetrail/bin/app/data/java/gradle/init.gradle
T
amorphous1andGitHub 3d68f1d131 src: support Gradle 7 when copying (test) compile libs (#1203)
Gradle 7 drops support of the depracated compile/testCompile configurations - compileClasspath/testCompileClasspath can be used instead.
2021-07-26 17:28:04 +02:00

61 lines
2.0 KiB
Groovy

def copyDependencies(source, destination) {
copy {
into destination
from source
eachFile { println "copying file \"" + it.file.name + "\" to \"" + destination + "\"" }
}
}
allprojects { pp ->
task printMainSrcDirs {
doLast {
if (project.hasProperty("sourceSets")) {
if (project.sourceSets.hasProperty("main")) {
project.sourceSets.main.java.srcDirs.each { dir ->
println "${dir}"
}
}
}
}
}
task printTestSrcDirs {
doLast {
if (project.hasProperty("sourceSets")) {
if (project.sourceSets.hasProperty("test")) {
project.sourceSets.test.java.srcDirs.each { dir ->
println "${dir}"
}
}
}
}
}
task copyCompileLibs {
doLast {
File rootDir = pp.getRootDir()
String destination = project.hasProperty('sourcetrail_lib_path') ? project.property('sourcetrail_lib_path').replace("\"", "") : rootDir.getPath() + rootDir.separator + "lib"
println destination;
if (pp.configurations.hasProperty("compile")) {
copyDependencies(pp.configurations.compile, destination)
}
if (pp.configurations.hasProperty("compileClasspath")) {
copyDependencies(pp.configurations.compileClasspath, destination)
}
}
}
task copyTestCompileLibs {
doLast {
File rootDir = pp.getRootDir()
String destination = project.hasProperty('sourcetrail_lib_path') ? project.property('sourcetrail_lib_path') : rootDir.getPath() + rootDir.separator + "lib"
if (pp.configurations.hasProperty("testCompile")) {
copyDependencies(pp.configurations.testCompile, destination)
}
if (pp.configurations.hasProperty("testCompileClasspath")) {
copyDependencies(pp.configurations.testCompileClasspath, destination)
}
}
}
}