From 0cc2c23a32cbb0f85892205bdcde8cad2656d3aa Mon Sep 17 00:00:00 2001 From: Juan Liska Date: Fri, 23 Nov 2018 05:07:34 -0600 Subject: [PATCH 1/5] extend timeout to 2 mins, log error when process times out --- .../main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt index a41f27d0..e105133b 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt @@ -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 { From 1ff46b58426082f95d3db0ae20e375c6d923f0c1 Mon Sep 17 00:00:00 2001 From: Juan Liska Date: Fri, 23 Nov 2018 05:11:00 -0600 Subject: [PATCH 2/5] =?UTF-8?q?don=E2=80=99t=20add=20deprecated=20kotlin?= =?UTF-8?q?=20runtime=20jar=20to=20classpath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/com/beust/kobalt/internal/KotlinJarFiles.kt | 1 - src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KotlinJarFiles.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KotlinJarFiles.kt index 3f29427a..123e8b76 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KotlinJarFiles.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KotlinJarFiles.kt @@ -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") } diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt index 3c437628..788a8dc2 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt @@ -101,7 +101,7 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors, val depen override fun classpathEntriesFor(project: Project?, context: KobaltContext): List = if (project == null || accept(project)) { // 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() From c33800b1899e1ca9ce8f897377f8184c4559dccc Mon Sep 17 00:00:00 2001 From: Juan Liska Date: Fri, 23 Nov 2018 05:11:43 -0600 Subject: [PATCH 3/5] =?UTF-8?q?don=E2=80=99t=20add=20deprecated=20kotlin?= =?UTF-8?q?=20runtime=20jar=20to=20project=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/beust/kobalt/app/kotlin/KotlinTemplateGenerator.kt | 4 ++-- src/main/resources/templates/idea/KotlinJavaRuntime.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/app/kotlin/KotlinTemplateGenerator.kt b/src/main/kotlin/com/beust/kobalt/app/kotlin/KotlinTemplateGenerator.kt index 4c408d48..f10698c4 100644 --- a/src/main/kotlin/com/beust/kobalt/app/kotlin/KotlinTemplateGenerator.kt +++ b/src/main/kotlin/com/beust/kobalt/app/kotlin/KotlinTemplateGenerator.kt @@ -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() override val directive = "project" override val templateName = "kotlin" diff --git a/src/main/resources/templates/idea/KotlinJavaRuntime.xml b/src/main/resources/templates/idea/KotlinJavaRuntime.xml index c630c0b8..3792609b 100644 --- a/src/main/resources/templates/idea/KotlinJavaRuntime.xml +++ b/src/main/resources/templates/idea/KotlinJavaRuntime.xml @@ -1,12 +1,12 @@ - + - + \ No newline at end of file From 6934dec51a3e6f12f33d16723dfa0c707a8d7897 Mon Sep 17 00:00:00 2001 From: Juan Liska Date: Fri, 23 Nov 2018 05:22:49 -0600 Subject: [PATCH 4/5] only add stdlib to classpath when project does not specify a kotlin version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when the project specifies a kotlin version, that version’s stdlib will be added to the classpath by other means --- src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt index 788a8dc2..886f3537 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt @@ -99,7 +99,8 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors, val depen // IClasspathContributor override fun classpathEntriesFor(project: Project?, context: KobaltContext): List = - 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) .map { FileDependency(it.absolutePath) } From a0d33fcaaefd4de419be118257c3f93d46da085a Mon Sep 17 00:00:00 2001 From: Juan Liska Date: Fri, 23 Nov 2018 05:32:43 -0600 Subject: [PATCH 5/5] bump version to 1.0.121 --- src/main/resources/kobalt.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index a7b70c39..a3f0abbf 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=1.0.120 +kobalt.version=1.0.121