@@ -49,6 +49,7 @@ fun getLatestVersion(url: String, prefix: String? = null): String {
49
49
document
50
50
.getElementsByTagName(" version" )
51
51
.let {
52
+ @Suppress(" SimplifiableCallChain" )
52
53
(0 until it.length)
53
54
.map { i -> it.item(i).textContent }
54
55
.filter { it.startsWith(prefix) }
@@ -79,12 +80,17 @@ fun runCommand(vararg args: String): String {
79
80
val builder = ProcessBuilder (* args)
80
81
.redirectError(ProcessBuilder .Redirect .INHERIT )
81
82
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
+ }
83
89
val ret = process.waitFor()
84
90
if (ret != 0 ) {
85
91
throw Exception (" command ${args.joinToString(" " )} failed:\n $output " )
86
92
}
87
- return output
93
+ return output.toString().trim()
88
94
}
89
95
90
96
fun runCommand (args : String ): String {
@@ -95,13 +101,21 @@ fun rebaseOnTopOfMain() {
95
101
val firstCommitMessage = " Add Kotlin Dev and Maven Central Snapshots repositories"
96
102
runCommand(" git fetch origin main:main" )
97
103
val baseCommit = runCommand(" git" , " rev-parse" , " HEAD^{/$firstCommitMessage }^" )
104
+ println (" Base commit: $baseCommit " )
98
105
runCommand(" git rebase --rebase-merges $baseCommit --onto main" )
99
106
}
100
107
101
108
fun triggerPrWorkflow () {
102
109
runCommand(" gh workflow run pr --ref $BRANCH_NAME " )
103
110
}
104
111
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
+
105
119
fun commitAndPush () {
106
120
val status = runCommand(" git status" )
107
121
if (status.contains(" nothing to commit" )) {
@@ -120,6 +134,9 @@ fun main() {
120
134
println (" Bump versions in libraries.toml" )
121
135
bumpVersions()
122
136
137
+ println (" Update lock files" )
138
+ updateLockFiles()
139
+
123
140
println (" Commit and push" )
124
141
commitAndPush()
125
142
0 commit comments