allprojects { proj ->
proj.tasks.register("alefPrintClasspath") {
doLast {
def entries = new LinkedHashSet<String>()
proj.tasks.matching { it.name ==~ /(?i)compile.*Kotlin/ }.each { compileTask ->
try {
if (compileTask.hasProperty('destinationDirectory')) {
entries << compileTask.destinationDirectory.get().asFile.absolutePath
}
} catch (Exception ignored) {
}
try {
def classpath = compileTask.hasProperty('libraries') ? compileTask.libraries
: (compileTask.hasProperty('classpath') ? compileTask.classpath : null)
if (classpath != null) {
classpath.files.each { entries << it.absolutePath }
}
} catch (Exception ignored) {
}
}
entries.each { println "ALEF_CLASSPATH_ENTRY:" + it }
}
}
}