mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Put the javac command in a file.
Also introduce fixSlashes().
This commit is contained in:
parent
771f90332c
commit
4e4c5a7d9e
5 changed files with 15 additions and 8 deletions
|
@ -8,6 +8,7 @@ import com.beust.kobalt.homeDir
|
|||
import com.beust.kobalt.internal.GraphUtil
|
||||
import com.beust.kobalt.internal.KobaltSettings
|
||||
import com.beust.kobalt.maven.aether.Exceptions
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.warn
|
||||
import com.google.gson.Gson
|
||||
import com.google.inject.Guice
|
||||
|
@ -31,7 +32,7 @@ class KobaltClient : Runnable {
|
|||
val client = OkHttpClient()
|
||||
val port = KobaltServer.port ?: 1240
|
||||
val url = "ws://localhost:$port/v1/getDependencyGraph"
|
||||
val buildFile = homeDir("kotlin/kobalt/kobalt/src/Build.kt").replace("\\", "/")
|
||||
val buildFile = KFiles.fixSlashes(homeDir("kotlin/kobalt/kobalt/src/Build.kt"))
|
||||
val request = Request.Builder()
|
||||
// .url("ws://echo.websocket.org")
|
||||
.url("$url?buildFile=$buildFile")
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.google.inject.Inject
|
|||
import com.google.inject.Singleton
|
||||
import java.io.File
|
||||
import java.io.PrintWriter
|
||||
import java.nio.file.Files
|
||||
import javax.tools.DiagnosticCollector
|
||||
import javax.tools.JavaFileObject
|
||||
import javax.tools.ToolProvider
|
||||
|
@ -77,11 +78,13 @@ class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler, val kobaltL
|
|||
allArgs.addAll(info.compilerArgs)
|
||||
allArgs.addAll(info.sourceFiles.filter { File(it).isFile })
|
||||
|
||||
val pb = ProcessBuilder(allArgs)
|
||||
val dir = Files.createTempDirectory("kobalt").toFile()
|
||||
val atFile = File(dir, "javac-" + project?.name + ".txt")
|
||||
atFile.writeText(KFiles.fixSlashes(allArgs.subList(1, allArgs.size).joinToString(" ")))
|
||||
val pb = ProcessBuilder(executable.absolutePath, "@" + KFiles.fixSlashes(atFile))
|
||||
pb.inheritIO()
|
||||
val line = allArgs.joinToString(" ")
|
||||
logk(1, " Java compiling " + Strings.pluralizeAll(info.sourceFiles.size, "file"))
|
||||
logk(2, " Java compiling $line")
|
||||
logk(2, " Java compiling file: " + KFiles.fixSlashes(atFile))
|
||||
|
||||
command = allArgs.joinToString(" ") + " " + info.sourceFiles.joinToString(" ")
|
||||
val process = pb.start()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue