Skip to content

Commit 59d730a

Browse files
committed
Update bump script to update lock files
1 parent f97a1df commit 59d730a

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

scripts/bump-kotlin-nightlies.main.kts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ fun getLatestVersion(url: String, prefix: String? = null): String {
4949
document
5050
.getElementsByTagName("version")
5151
.let {
52+
@Suppress("SimplifiableCallChain")
5253
(0 until it.length)
5354
.map { i -> it.item(i).textContent }
5455
.filter { it.startsWith(prefix) }
@@ -79,12 +80,17 @@ fun runCommand(vararg args: String): String {
7980
val builder = ProcessBuilder(*args)
8081
.redirectError(ProcessBuilder.Redirect.INHERIT)
8182
val process = builder.start()
82-
val output = process.inputStream.bufferedReader().readText().trim()
83+
val output = StringBuilder()
84+
while (true) {
85+
val line = process.inputStream.bufferedReader().readLine() ?: break
86+
println("> $line")
87+
output.append(line + "\n")
88+
}
8389
val ret = process.waitFor()
8490
if (ret != 0) {
8591
throw Exception("command ${args.joinToString(" ")} failed:\n$output")
8692
}
87-
return output
93+
return output.toString().trim()
8894
}
8995

9096
fun runCommand(args: String): String {
@@ -95,13 +101,21 @@ fun rebaseOnTopOfMain() {
95101
val firstCommitMessage = "Add Kotlin Dev and Maven Central Snapshots repositories"
96102
runCommand("git fetch origin main:main")
97103
val baseCommit = runCommand("git", "rev-parse", "HEAD^{/$firstCommitMessage}^")
104+
println("Base commit: $baseCommit")
98105
runCommand("git rebase --rebase-merges $baseCommit --onto main")
99106
}
100107

101108
fun triggerPrWorkflow() {
102109
runCommand("gh workflow run pr --ref $BRANCH_NAME")
103110
}
104111

112+
fun updateLockFiles() {
113+
File("kotlin-js-store").deleteRecursively()
114+
File("tests/kotlin-js-store").deleteRecursively()
115+
runCommand("./gradlew kotlinUpgradePackageLock kotlinWasmUpgradePackageLock")
116+
runCommand("./gradlew -p tests kotlinUpgradePackageLock kotlinWasmUpgradePackageLock")
117+
}
118+
105119
fun commitAndPush() {
106120
val status = runCommand("git status")
107121
if (status.contains("nothing to commit")) {
@@ -120,6 +134,9 @@ fun main() {
120134
println("Bump versions in libraries.toml")
121135
bumpVersions()
122136

137+
println("Update lock files")
138+
updateLockFiles()
139+
123140
println("Commit and push")
124141
commitAndPush()
125142

0 commit comments

Comments
 (0)