mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Merge pull request #494 from pabl0rg/improve-external-compiler-invocation
Improve external compiler invocation
This commit is contained in:
commit
e6b72c282f
6 changed files with 14 additions and 11 deletions
|
@ -16,6 +16,5 @@ class KotlinJarFiles @Inject constructor(val dependencyManager: DependencyManage
|
||||||
}
|
}
|
||||||
|
|
||||||
val stdlib: File get() = getKotlinCompilerJar("stdlib")
|
val stdlib: File get() = getKotlinCompilerJar("stdlib")
|
||||||
val runtime: File get() = getKotlinCompilerJar("runtime")
|
|
||||||
val compiler: File get() = getKotlinCompilerJar("compiler-embeddable")
|
val compiler: File get() = getKotlinCompilerJar("compiler-embeddable")
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,11 @@ open class NewRunCommand(val info: RunCommandInfo) {
|
||||||
val process = pb.start()
|
val process = pb.start()
|
||||||
|
|
||||||
// Run the command and collect the return code and streams
|
// Run the command and collect the return code and streams
|
||||||
val returnCode = process.waitFor(60, TimeUnit.SECONDS)
|
val processFinished = process.waitFor(120, TimeUnit.SECONDS)
|
||||||
|
|
||||||
|
if (!processFinished)
|
||||||
|
kobaltError("process timed out!")
|
||||||
|
|
||||||
val input =
|
val input =
|
||||||
if (process.inputStream.available() > 0) fromStream(process.inputStream)
|
if (process.inputStream.available() > 0) fromStream(process.inputStream)
|
||||||
else listOf()
|
else listOf()
|
||||||
|
@ -92,10 +96,9 @@ open class NewRunCommand(val info: RunCommandInfo) {
|
||||||
// Check to see if the command succeeded
|
// Check to see if the command succeeded
|
||||||
val isSuccess =
|
val isSuccess =
|
||||||
if (info.containsErrors != null) ! info.containsErrors!!(error)
|
if (info.containsErrors != null) ! info.containsErrors!!(error)
|
||||||
else isSuccess(if (info.ignoreExitValue) true else returnCode, input, error)
|
else isSuccess(if (info.ignoreExitValue) true else processFinished, input, error)
|
||||||
|
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
kobaltLog(3, "success so far")
|
|
||||||
if (!info.useErrorStreamAsErrorIndicator) {
|
if (!info.useErrorStreamAsErrorIndicator) {
|
||||||
info.successCallback(error + input)
|
info.successCallback(error + input)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,8 +8,8 @@ class KotlinTemplateGenerator : LanguageTemplateGenerator() {
|
||||||
override val defaultSourceDirectories = hashSetOf("src/main/kotlin")
|
override val defaultSourceDirectories = hashSetOf("src/main/kotlin")
|
||||||
override val defaultTestDirectories = hashSetOf("src/test/kotlin")
|
override val defaultTestDirectories = hashSetOf("src/test/kotlin")
|
||||||
override val mainDependencies = arrayListOf(
|
override val mainDependencies = arrayListOf(
|
||||||
Pom.Dependency("org.jetbrains.kotlin", "kotlin-runtime", null, Constants.KOTLIN_COMPILER_VERSION),
|
Pom.Dependency("org.jetbrains.kotlin", "kotlin-stdlib", null, Constants.KOTLIN_COMPILER_VERSION)
|
||||||
Pom.Dependency("org.jetbrains.kotlin", "kotlin-stdlib", null, Constants.KOTLIN_COMPILER_VERSION))
|
)
|
||||||
override val testDependencies = arrayListOf<Pom.Dependency>()
|
override val testDependencies = arrayListOf<Pom.Dependency>()
|
||||||
override val directive = "project"
|
override val directive = "project"
|
||||||
override val templateName = "kotlin"
|
override val templateName = "kotlin"
|
||||||
|
|
|
@ -99,9 +99,10 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors, val depen
|
||||||
// IClasspathContributor
|
// IClasspathContributor
|
||||||
|
|
||||||
override fun classpathEntriesFor(project: Project?, context: KobaltContext): List<IClasspathDependency> =
|
override fun classpathEntriesFor(project: Project?, context: KobaltContext): List<IClasspathDependency> =
|
||||||
if (project == null || accept(project)) {
|
if (project == null ||
|
||||||
|
context.pluginInfo.plugins.any { it is KotlinPlugin && it.settings.kobaltCompilerVersion == null }) {
|
||||||
// All Kotlin projects automatically get the Kotlin runtime added to their class path
|
// All Kotlin projects automatically get the Kotlin runtime added to their class path
|
||||||
listOf(kotlinJarFiles.stdlib, kotlinJarFiles.runtime)
|
listOf(kotlinJarFiles.stdlib)
|
||||||
.map { FileDependency(it.absolutePath) }
|
.map { FileDependency(it.absolutePath) }
|
||||||
} else {
|
} else {
|
||||||
emptyList()
|
emptyList()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
kobalt.version=1.0.120
|
kobalt.version=1.0.121
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<component name="libraryTable">
|
<component name="libraryTable">
|
||||||
<library name="KotlinJavaRuntime">
|
<library name="KotlinJavaRuntime">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime.jar!/" />
|
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib.jar!/" />
|
||||||
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar!/" />
|
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime-sources.jar!/" />
|
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
Loading…
Add table
Add a link
Reference in a new issue