fix bug leading to srcjar expansion and merge occuring twice
diff --git a/.bazelrc b/.bazelrc
index b3686d8..c610825 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,2 +1,3 @@
build --strategy=KotlinCompile=worker
build --test_output=errors
+build --verbose_failures
\ No newline at end of file
diff --git a/kotlin/builder/src/io/bazel/kotlin/builder/KotlinBuilder.kt b/kotlin/builder/src/io/bazel/kotlin/builder/KotlinBuilder.kt
index 54d3d2a..a5cda42 100644
--- a/kotlin/builder/src/io/bazel/kotlin/builder/KotlinBuilder.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/KotlinBuilder.kt
@@ -32,32 +32,23 @@
private val jarToolInvoker: KotlinToolchain.JarToolInvoker,
private val compilationExector: KotlinJvmCompilationExecutor
) : CommandLineProgram {
- fun execute(command: KotlinModel.BuilderCommand): Int =
- prepareForExecution(command).let { doExecute(it) }
-
fun execute(args: List<String>): Int =
- execute(ArgMaps.from(args))
+ ArgMaps.from(args).let { execute(it) }
fun execute(args: ArgMap): Int =
- prepareForExecution(commandBuilder.fromInput(args)).let {
- execute(it)
- }
+ commandBuilder.fromInput(args).let { execute(it) }
-
- private fun doExecute(command: KotlinModel.BuilderCommand): Int {
+ fun execute(command: KotlinModel.BuilderCommand): Int {
+ ensureOutputDirectories(command)
+ val updatedCommand = expandWithSourceJarSources(command)
return try {
- compilationExector.compile(command)
+ compilationExector.compile(updatedCommand)
0
} catch (ex: CompilationStatusException) {
ex.status
}
}
- private fun prepareForExecution(originalCommand: KotlinModel.BuilderCommand): KotlinModel.BuilderCommand {
- ensureOutputDirectories(originalCommand)
- return expandWithSourceJarSources(originalCommand)
- }
-
private fun ensureOutputDirectories(command: KotlinModel.BuilderCommand) {
Files.createDirectories(Paths.get(command.outputs.classDirectory))
Files.createDirectories(Paths.get(command.outputs.tempDirectory))
@@ -82,7 +73,6 @@
}
}
}
-
for (sourceJar in command.inputs.sourceJarsList) {
jarToolInvoker.invoke(
listOf("xf", Paths.get(sourceJar).toAbsolutePath().toString()), sourceUnpackDirectory)