1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 08:38:13 -07:00

Fix shadowing.

This commit is contained in:
Cedric Beust 2015-10-30 12:01:55 -07:00
parent 66e00fa7d8
commit c7608e000b

View file

@ -8,7 +8,6 @@ import com.beust.kobalt.internal.CompilerActionInfo
import com.beust.kobalt.internal.ICompilerAction import com.beust.kobalt.internal.ICompilerAction
import com.beust.kobalt.internal.JvmCompiler import com.beust.kobalt.internal.JvmCompiler
import com.beust.kobalt.internal.TaskResult import com.beust.kobalt.internal.TaskResult
import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.maven.IClasspathDependency import com.beust.kobalt.maven.IClasspathDependency
import com.beust.kobalt.misc.log import com.beust.kobalt.misc.log
import com.google.inject.Inject import com.google.inject.Inject
@ -16,8 +15,7 @@ import com.google.inject.Singleton
import java.io.File import java.io.File
@Singleton @Singleton
class JavaCompiler @Inject constructor(val dependencyManager: DependencyManager, class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler) {
val jvmCompiler: JvmCompiler){
/** /**
* Create an ICompilerAction and a CompilerActionInfo suitable to be passed to doCompiler() to perform the * Create an ICompilerAction and a CompilerActionInfo suitable to be passed to doCompiler() to perform the
* actual compilation. * actual compilation.
@ -32,23 +30,21 @@ class JavaCompiler @Inject constructor(val dependencyManager: DependencyManager,
val jvm = JavaInfo.create(File(SystemProperties.javaBase)) val jvm = JavaInfo.create(File(SystemProperties.javaBase))
val javac = jvm.javacExecutable val javac = jvm.javacExecutable
val args = arrayListOf( val allArgs = arrayListOf(
javac!!.absolutePath, javac!!.absolutePath,
"-d", info.outputDir) "-d", info.outputDir)
if (dependencies.size > 0) { if (info.dependencies.size > 0) {
args.add("-classpath") allArgs.add("-classpath")
args.add(info.dependencies.map {it.jarFile.get()}.joinToString(File.pathSeparator)) allArgs.add(info.dependencies.map {it.jarFile.get()}.joinToString(File.pathSeparator))
} }
args.addAll(info.compilerArgs) allArgs.addAll(info.compilerArgs)
args.addAll(info.sourceFiles) allArgs.addAll(info.sourceFiles)
val pb = ProcessBuilder(args) val pb = ProcessBuilder(allArgs)
if (outputDir != null) { pb.directory(File(info.outputDir))
pb.directory(File(outputDir))
}
pb.inheritIO() pb.inheritIO()
val line = args.joinToString(" ") val line = allArgs.joinToString(" ")
log(1, " Compiling ${sourceFiles.size} files with classpath size " + info.dependencies.size) log(1, " Compiling ${info.sourceFiles.size} files with classpath size " + info.dependencies.size)
log(2, " Compiling ${project?.name}:\n$line") log(2, " Compiling ${project?.name}:\n$line")
val process = pb.start() val process = pb.start()
val errorCode = process.waitFor() val errorCode = process.waitFor()