File tree Expand file tree Collapse file tree
plugin/src/main/kotlin/dev/vyp/stringcare/plugin/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 url = https://github.com/vypdev/stringcare-android-c.git
66[submodule "example "]
77 path = example
8- url = https://github.com/vypdev/stringcare-android-sample
8+ url = https://github.com/vypdev/stringcare-android-sample.git
Original file line number Diff line number Diff line change @@ -4,7 +4,15 @@ import dev.vyp.stringcare.plugin.domain.models.ExecutionResult
44import java.io.IOException
55import java.util.concurrent.TimeUnit
66
7- private const val COMMAND_TIMEOUT_SECONDS = 60L
7+ private const val DEFAULT_COMMAND_TIMEOUT_SECONDS = 300L
8+ private const val COMMAND_TIMEOUT_PROPERTY = " stringcare.command.timeout.seconds"
9+
10+ private fun commandTimeoutSeconds (): Long =
11+ System
12+ .getProperty(COMMAND_TIMEOUT_PROPERTY )
13+ ?.toLongOrNull()
14+ ?.takeIf { it > 0 }
15+ ? : DEFAULT_COMMAND_TIMEOUT_SECONDS
816
917fun execute (command : String ): Result <ExecutionResult > = executeShell(shellCommand(command), command)
1018
@@ -29,7 +37,7 @@ private fun executeShell(
2937 process.inputStream.bufferedReader().use { reader ->
3038 reader.readText()
3139 }.replace(" \r " , " " )
32- val completed = process.waitFor(COMMAND_TIMEOUT_SECONDS , TimeUnit .SECONDS )
40+ val completed = process.waitFor(commandTimeoutSeconds() , TimeUnit .SECONDS )
3341 if (! completed) {
3442 process.destroyForcibly()
3543 return Result .success(
Original file line number Diff line number Diff line change @@ -43,9 +43,22 @@ internal fun prepareTask(directory: String): String =
4343 """
4444 cd $directory &&
4545 git clone https://github.com/StringCare/$testProjectName .git &&
46- cd $testProjectName
46+ cd $testProjectName &&
47+ ${updateWrapperForJava17()}
4748 """ .trimIndent()
4849
50+ /* *
51+ * Integration fixtures may carry an old wrapper distribution that cannot evaluate scripts
52+ * referencing Java 17 bytecode. Pin to a modern Gradle distribution before executing tasks.
53+ */
54+ private fun updateWrapperForJava17 (): String =
55+ when (getOs()) {
56+ Os .WINDOWS -> " echo Wrapper update skipped on Windows"
57+ Os .OSX , Os .LINUX ->
58+ " sed -i.bak 's#distributionUrl=.*#distributionUrl=https\\\\ ://services.gradle.org/distributions/gradle-8.11.1-bin.zip#' " +
59+ " gradle/wrapper/gradle-wrapper.properties && rm -f gradle/wrapper/gradle-wrapper.properties.bak"
60+ }
61+
4962internal fun buildTask (directory : String ): String =
5063 """
5164 cd $directory &&
You can’t perform that action at this time.
0 commit comments