-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsyncVersions.main.kts
More file actions
37 lines (29 loc) · 1.35 KB
/
syncVersions.main.kts
File metadata and controls
37 lines (29 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
@file:OptIn(ExperimentalPathApi::class)
import java.nio.file.Path
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.absolute
import kotlin.io.path.pathString
/*
This script is just a wrapper around the `amper do syncVersions` command that is used to update several user-facing versions in:
- the Amper project itself
- our examples
- our docs
The source of truth is the list of versions located in `build-sources/project-commands/module.yaml`.
The script is used by TeamCity.
Locally, developers should use either the "Sync versions" run configuration or the custom command itself.
*/
val bootstrapAmperVersion = "0.11.0-dev-3836" // AUTO-UPDATED BY THE CI - DO NOT RENAME
private val amperRootDir: Path = __FILE__.toPath().absolute().parent
@Suppress("PROCESS_BUILDER_START_LEAK")
fun runAmperCli(vararg args: String): Int {
val isWindows = System.getProperty("os.name").startsWith("Win", ignoreCase = true)
val amperScript = amperRootDir.resolve(if (isWindows) "kotlin.bat" else "kotlin")
return ProcessBuilder(amperScript.pathString, *args).inheritIO().start().waitFor()
}
val exitCode = runAmperCli("do", "syncVersions")
check(exitCode == 0) {
"syncVersions failed: $exitCode. Check the output above"
}