mirror of
https://github.com/gmeligio/flutter-docker-image.git
synced 2026-05-24 12:30:34 +00:00
40b632ca7f
- Fixes a broken pipeline: the `single_update` branch had a half-migrated step that pre-wrote `flutter_version.json` before the JS comparator ran, causing every scheduled run to emit `result=false` and skip all downstream jobs — meaning no update PRs were ever opened - Replaces `script/updateFlutterVersion.js` with a single shell+jq step that fetches `releases_linux.json`, reads the pinned version, compares, and only writes when the upstream stable version actually changed - Sources `android.buildTools.version` from Flutter's own `engine/src/flutter/tools/android_sdk/packages.txt` at the new tag (instead of being orphaned with no write path into `version.json`) - Fixes `config/schema.cue` undefined reference (`#PatchVersion` → `#SemverPatch`) that caused `cue vet` to fail - Fixes `config/android.cue` length guard typo (`fileContentTests` → `commandTests`) - Fixes the PR creation step writing `commit_message` to `$GITHUB_ENV` instead of `$GITHUB_OUTPUT`, which resulted in PRs with empty titles and commit messages --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
42 lines
1.5 KiB
Kotlin
42 lines
1.5 KiB
Kotlin
// Snippet to include at the end of android/app/build.gradle.kts
|
|
|
|
tasks.register<DefaultTask>("updateAndroidVersions") {
|
|
doLast {
|
|
val jsonFile = File("../../config/version.json")
|
|
|
|
// Parse existing JSON file
|
|
val resultJsonMap = groovy.json.JsonSlurper().parseText(jsonFile.readText()) as MutableMap<String, Any>
|
|
|
|
// Get unique platform versions
|
|
val platformVersions = listOf(
|
|
flutter.targetSdkVersion,
|
|
flutter.compileSdkVersion
|
|
).distinct()
|
|
|
|
val buildToolsVersion = System.getenv("BUILD_TOOLS_VERSION")
|
|
?: error("BUILD_TOOLS_VERSION env var is required")
|
|
|
|
// Create new Android version data
|
|
val newJsonMap = mapOf(
|
|
"platforms" to platformVersions.map {
|
|
mapOf("version" to it)
|
|
},
|
|
"gradle" to mapOf("version" to gradle.gradleVersion),
|
|
"buildTools" to mapOf("version" to buildToolsVersion),
|
|
"ndk" to mapOf("version" to flutter.ndkVersion)
|
|
)
|
|
|
|
// Merge new values into the existing JSON structure
|
|
(resultJsonMap["android"] as? MutableMap<String, Any>)?.putAll(newJsonMap)
|
|
|
|
// Format JSON with pretty printing
|
|
val jsonStr = groovy.json.JsonOutput.toJson(resultJsonMap)
|
|
val prettyStr = groovy.json.JsonOutput.prettyPrint(jsonStr)
|
|
|
|
println(prettyStr)
|
|
|
|
// Write updated JSON back to the file
|
|
jsonFile.writeText("$prettyStr\n")
|
|
}
|
|
}
|