Skip to content

Commit 2ca153b

Browse files
committed
Implement 'command' utility
1 parent 02f38bf commit 2ca153b

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ plugins {
3939
kotlin("multiplatform") version "2.1.20-Beta2" // <- Use Kotlin 2.1.20-Beta2 or higher!
4040
kotlin("plugin.compose") version "2.1.20-Beta2" // <- Use Compose Compiler Plugin 2.1.20-Beta2 or higher!
4141
id("org.jetbrains.compose")
42-
id("org.jetbrains.compose-hot-reload") version "1.0.0-dev-38 <- add this additionally
42+
id("org.jetbrains.compose-hot-reload") version "1.0.0-dev-38<- add this additionally
4343
}
4444
```
4545

repository-tools/src/main/kotlin/bumpBootstrapVersion.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ fun main() {
88
val version = readGradleProperties("version")
99
writeGradleProperties("bootstrap.version", version)
1010

11-
ProcessBuilder("git", "add", ".").inheritIO().start().waitFor()
12-
ProcessBuilder("git", "commit", "-m", "Bootstrap v$version").inheritIO().start().waitFor()
11+
command("git", "add", ".")
12+
command("git", "commit", "-m", "Bootstrap v$version")
1313
}
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import org.jetbrains.kotlin.tooling.core.KotlinToolingVersion
22
import org.jetbrains.kotlin.tooling.core.buildNumber
3-
import kotlin.io.path.Path
4-
import kotlin.io.path.readText
5-
import kotlin.io.path.writeText
63

74
/*
85
* Copyright 2024-2025 JetBrains s.r.o. and Compose Hot Reload contributors.
@@ -17,12 +14,9 @@ fun main() {
1714
val newVersion = version.toString().replace("-$buildNumber", "-${buildNumber + 1}")
1815
writeGradleProperties("version", newVersion)
1916

20-
// Execute 'updateVersions' task
21-
ProcessBuilder("./gradlew", "updateVersions")
22-
.inheritIO().start().waitFor()
23-
24-
ProcessBuilder("git", "add", ".").inheritIO().start().waitFor()
25-
ProcessBuilder("git", "commit", "-m", "v$newVersion").inheritIO().start().waitFor()
26-
ProcessBuilder("git", "tag", "v$newVersion").inheritIO().start().waitFor()
27-
ProcessBuilder("git", "push", "origin", "tag", "v$newVersion").inheritIO().start().waitFor()
17+
command("./gradlew", "updateVersions")
18+
command("git", "add", ".")
19+
command("git", "commit", "-m", "v$newVersion")
20+
command("git", "tag", "v$newVersion")
21+
command("git", "push", "origin", "tag", "v$newVersion")
2822
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright 2024-2025 JetBrains s.r.o. and Compose Hot Reload contributors.
3+
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
4+
*/
5+
6+
fun command(vararg args: String) {
7+
val process = ProcessBuilder(*args).inheritIO()
8+
.redirectErrorStream(true)
9+
.start()
10+
11+
val input = process.inputStream.reader().readText()
12+
if (process.waitFor() != 0) error("${args.joinToString(" ")} failed\n" + input)
13+
}

0 commit comments

Comments
 (0)