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) } } } }