From 5e51f35aafd973caf78ab2f5528c9df43e01b28e Mon Sep 17 00:00:00 2001 From: adambl4 Date: Thu, 8 Sep 2022 15:47:39 +0300 Subject: [PATCH] Release 1.6.0 --- README.md | 3 ++- build.gradle | 2 +- plugin/build.gradle | 2 +- plugin/src/main/kotlin/Mirakle.kt | 21 ++++++++++++--------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b6ce91b..b72aa60 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ initscript { mavenCentral() } dependencies { - classpath 'io.github.adambl4:mirakle:1.5.2' + classpath 'io.github.adambl4:mirakle:1.6.0' } } @@ -97,6 +97,7 @@ mirakle { downloadInParallel true downloadInterval 2000 breakOnTasks = ["install", "package"] // regex pattern + remoteBashCommand = "echo 'Hello World!'" } ``` diff --git a/build.gradle b/build.gradle index 896991f..801250f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'com.instamotor' -version '1.5.2' +version '1.6.0' buildscript { ext.kotlin_version = '1.5.31' diff --git a/plugin/build.gradle b/plugin/build.gradle index 0758bf6..0d681f9 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -84,7 +84,7 @@ signing { } task validatePublishing { - doLast { + doFirst { validateTagAndVersion() if (gradle.startParameter.configureOnDemand) //WTF https://stackoverflow.com/questions/25668020/gradle-artifactory-plugin-not-generating-pom-file/32064236#comment61270226_32064236 diff --git a/plugin/src/main/kotlin/Mirakle.kt b/plugin/src/main/kotlin/Mirakle.kt index d0c0955..34ebc8c 100644 --- a/plugin/src/main/kotlin/Mirakle.kt +++ b/plugin/src/main/kotlin/Mirakle.kt @@ -380,7 +380,7 @@ open class ExecuteOnRemoteTask : Exec() { @Internal lateinit var gradlewRoot: File @Internal lateinit var startParams: StartParameter private val tasksList = mutableListOf() - private val customArgs = mutableListOf() + private val additionalArgs = mutableListOf() override fun exec() { val startParamsArgs = startParams.copy() @@ -388,23 +388,26 @@ open class ExecuteOnRemoteTask : Exec() { .let { mergeStartParamsWithProperties(it, gradlewRoot) } .let(::startParamsToArgs) - val taskArgs = startParamsArgs.plus(customArgs).joinToString(separator = " ") { "\"$it\"" } + val taskArgs = startParamsArgs.plus(additionalArgs).joinToString(separator = " ") { "\"$it\"" } val remoteFolder = "${config.remoteFolder}/${gradlewRoot.name}" - val additionalCommand = config.remoteBashCommand?.ifBlank { null }?.let { "&& $it" } ?: "" + val additionalCommand = config.remoteBashCommand?.ifBlank { null } val remoteGradleCommand = "./gradlew -P$BUILD_ON_REMOTE=true $taskArgs" - val remoteBashCommand = listOf( - "set -e $additionalCommand", + val remoteBashCommand = listOfNotNull( + "set -e", + additionalCommand, "export LANG=C.UTF-8", "export LC_CTYPE=C.UTF-8", "cd $remoteFolder", remoteGradleCommand - ).joinToString(" && ") + ).joinToString(separator = " && ") setCommandLine(config.sshClient) args(config.sshArgs) args(config.host) args("echo '$remoteBashCommand' | bash") + //println("Remote bash command = $commandLine") + super.exec() } @@ -413,8 +416,8 @@ open class ExecuteOnRemoteTask : Exec() { tasksList.addAll(tasks) } - internal fun addCustomArgs(list: List) { - customArgs.addAll(list) + internal fun addArgs(list: List) { + additionalArgs.addAll(list) } } @@ -625,7 +628,7 @@ fun Gradle.uploadInitScripts(upload: Exec, execute: ExecuteOnRemoteTask, downloa } execute.doFirst { - execute.addCustomArgs(listOf("--init-script", "${initScriptsFolder.name}/${initScriptCopy.name}")) + execute.addArgs(listOf("--init-script", "${initScriptsFolder.name}/${initScriptCopy.name}")) } }