mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Fix shadowing.
This commit is contained in:
parent
66e00fa7d8
commit
c7608e000b
1 changed files with 11 additions and 15 deletions
|
@ -8,7 +8,6 @@ import com.beust.kobalt.internal.CompilerActionInfo
|
|||
import com.beust.kobalt.internal.ICompilerAction
|
||||
import com.beust.kobalt.internal.JvmCompiler
|
||||
import com.beust.kobalt.internal.TaskResult
|
||||
import com.beust.kobalt.maven.DependencyManager
|
||||
import com.beust.kobalt.maven.IClasspathDependency
|
||||
import com.beust.kobalt.misc.log
|
||||
import com.google.inject.Inject
|
||||
|
@ -16,8 +15,7 @@ import com.google.inject.Singleton
|
|||
import java.io.File
|
||||
|
||||
@Singleton
|
||||
class JavaCompiler @Inject constructor(val dependencyManager: DependencyManager,
|
||||
val jvmCompiler: JvmCompiler){
|
||||
class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler) {
|
||||
/**
|
||||
* Create an ICompilerAction and a CompilerActionInfo suitable to be passed to doCompiler() to perform the
|
||||
* actual compilation.
|
||||
|
@ -32,23 +30,21 @@ class JavaCompiler @Inject constructor(val dependencyManager: DependencyManager,
|
|||
val jvm = JavaInfo.create(File(SystemProperties.javaBase))
|
||||
val javac = jvm.javacExecutable
|
||||
|
||||
val args = arrayListOf(
|
||||
val allArgs = arrayListOf(
|
||||
javac!!.absolutePath,
|
||||
"-d", info.outputDir)
|
||||
if (dependencies.size > 0) {
|
||||
args.add("-classpath")
|
||||
args.add(info.dependencies.map {it.jarFile.get()}.joinToString(File.pathSeparator))
|
||||
if (info.dependencies.size > 0) {
|
||||
allArgs.add("-classpath")
|
||||
allArgs.add(info.dependencies.map {it.jarFile.get()}.joinToString(File.pathSeparator))
|
||||
}
|
||||
args.addAll(info.compilerArgs)
|
||||
args.addAll(info.sourceFiles)
|
||||
allArgs.addAll(info.compilerArgs)
|
||||
allArgs.addAll(info.sourceFiles)
|
||||
|
||||
val pb = ProcessBuilder(args)
|
||||
if (outputDir != null) {
|
||||
pb.directory(File(outputDir))
|
||||
}
|
||||
val pb = ProcessBuilder(allArgs)
|
||||
pb.directory(File(info.outputDir))
|
||||
pb.inheritIO()
|
||||
val line = args.joinToString(" ")
|
||||
log(1, " Compiling ${sourceFiles.size} files with classpath size " + info.dependencies.size)
|
||||
val line = allArgs.joinToString(" ")
|
||||
log(1, " Compiling ${info.sourceFiles.size} files with classpath size " + info.dependencies.size)
|
||||
log(2, " Compiling ${project?.name}:\n$line")
|
||||
val process = pb.start()
|
||||
val errorCode = process.waitFor()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue