@@ -52,7 +52,7 @@ private fun createTemporaryGradleFile(): File {
52
52
}
53
53
54
54
temp.bufferedWriter().use {
55
- it.write(" rootProject { apply from: '${config.absolutePath} '} " )
55
+ it.write(" rootProject { apply from: '${config.absolutePath.replace( " \\ " , " \\\\ " ) } '} " )
56
56
}
57
57
58
58
return temp
@@ -67,21 +67,21 @@ private fun getGradleCommand(workspace: Path): Path {
67
67
}
68
68
}
69
69
70
+ val jarArtifactOutputLine by lazy { Pattern .compile(" ^.+?\\ .jar$" ) }
71
+
70
72
private fun readDependenciesViaTask (directory : Path ): Set <Path >? {
71
73
val gradle = getGradleCommand(directory)
72
74
val config = createTemporaryGradleFile()
73
75
74
76
val gradleCommand = " $gradle -I ${config.absolutePath} classpath"
75
77
val classpathCommand = Runtime .getRuntime().exec(gradleCommand, null , directory.toFile())
76
78
val stdout = classpathCommand.inputStream
77
- val artifact = Pattern .compile(" ^.+?\\ .jar$" )
78
79
val dependencies = mutableSetOf<Path >()
79
80
80
81
stdout.bufferedReader().use { reader ->
81
- for (dependency in reader.lines()) {
82
- val line = dependency.toString().trim()
83
-
84
- if (artifact.matcher(line).matches()) {
82
+ reader.lines().forEach {
83
+ val line = it.toString().trim()
84
+ if (! line.startsWith(" Download" ) && jarArtifactOutputLine.matcher(line).matches()) {
85
85
dependencies.add(Paths .get(line))
86
86
}
87
87
}
0 commit comments