1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-25 07:57:12 -07:00

Merge pull request #494 from pabl0rg/improve-external-compiler-invocation

Improve external compiler invocation
This commit is contained in:
Cedric Beust 2018-11-23 07:15:34 -08:00 committed by GitHub
commit e6b72c282f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 11 deletions

View file

@ -16,6 +16,5 @@ class KotlinJarFiles @Inject constructor(val dependencyManager: DependencyManage
}
val stdlib: File get() = getKotlinCompilerJar("stdlib")
val runtime: File get() = getKotlinCompilerJar("runtime")
val compiler: File get() = getKotlinCompilerJar("compiler-embeddable")
}

View file

@ -79,7 +79,11 @@ open class NewRunCommand(val info: RunCommandInfo) {
val process = pb.start()
// 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 =
if (process.inputStream.available() > 0) fromStream(process.inputStream)
else listOf()
@ -92,10 +96,9 @@ open class NewRunCommand(val info: RunCommandInfo) {
// Check to see if the command succeeded
val isSuccess =
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) {
kobaltLog(3, "success so far")
if (!info.useErrorStreamAsErrorIndicator) {
info.successCallback(error + input)
} else {

View file

@ -8,8 +8,8 @@ class KotlinTemplateGenerator : LanguageTemplateGenerator() {
override val defaultSourceDirectories = hashSetOf("src/main/kotlin")
override val defaultTestDirectories = hashSetOf("src/test/kotlin")
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 directive = "project"
override val templateName = "kotlin"

View file

@ -99,9 +99,10 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors, val depen
// IClasspathContributor
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
listOf(kotlinJarFiles.stdlib, kotlinJarFiles.runtime)
listOf(kotlinJarFiles.stdlib)
.map { FileDependency(it.absolutePath) }
} else {
emptyList()

View file

@ -1 +1 @@
kobalt.version=1.0.120
kobalt.version=1.0.121

View file

@ -1,12 +1,12 @@
<component name="libraryTable">
<library name="KotlinJavaRuntime">
<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!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime-sources.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib-sources.jar!/" />
</SOURCES>
</library>
</component>