Skip to content

Commit

Permalink
Release 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
skrugly committed Sep 8, 2022
1 parent ab471e6 commit 5e51f35
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ initscript {
mavenCentral()
}
dependencies {
classpath 'io.github.adambl4:mirakle:1.5.2'
classpath 'io.github.adambl4:mirakle:1.6.0'
}
}
Expand Down Expand Up @@ -97,6 +97,7 @@ mirakle {
downloadInParallel true
downloadInterval 2000
breakOnTasks = ["install", "package"] // regex pattern
remoteBashCommand = "echo 'Hello World!'"
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.instamotor'
version '1.5.2'
version '1.6.0'

buildscript {
ext.kotlin_version = '1.5.31'
Expand Down
2 changes: 1 addition & 1 deletion plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 12 additions & 9 deletions plugin/src/main/kotlin/Mirakle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -380,31 +380,34 @@ open class ExecuteOnRemoteTask : Exec() {
@Internal lateinit var gradlewRoot: File
@Internal lateinit var startParams: StartParameter
private val tasksList = mutableListOf<String>()
private val customArgs = mutableListOf<String>()
private val additionalArgs = mutableListOf<String>()

override fun exec() {
val startParamsArgs = startParams.copy()
.apply { setTaskNames(tasksList) }
.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()
}

Expand All @@ -413,8 +416,8 @@ open class ExecuteOnRemoteTask : Exec() {
tasksList.addAll(tasks)
}

internal fun addCustomArgs(list: List<String>) {
customArgs.addAll(list)
internal fun addArgs(list: List<String>) {
additionalArgs.addAll(list)
}
}

Expand Down Expand Up @@ -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}"))
}
}

Expand Down

0 comments on commit 5e51f35

Please sign in to comment.