Write an identical value to bin/cache/engine.stamp to prepare for migration (#164317)

Towards https://github.com/flutter/flutter/issues/164315.

This PR just writes `bin/cache/engine.stamp` identically to how
`bin/internal/engine.version` would otherwise be written, with a caveat
that _if_ `engine.version` is tracked, it is now _copied_ to
`bin/cache/engine.stamp`.

After this lands, I'll send PRs to update tooling that looks for
`engine.version` and give a heads up to the larger team (i.e. Dart HH
bot or whomever we will break by doing this).
This commit is contained in:
Matan Lurey
2025-02-27 17:52:57 -08:00
committed by GitHub
parent 37ff5a337a
commit 6f71aa9901
5 changed files with 164 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ $flutterRoot = (Get-Item $progName).parent.parent.FullName
# On stable, beta, and release tags, the engine.version is tracked by git - do not override it.
$trackedEngine = (git -C "$flutterRoot" ls-files bin/internal/engine.version) | Out-String
if ($trackedEngine.length -ne 0) {
Copy-Item -Path "$flutterRoot\bin\internal\engine.version" -Destination "$flutterRoot\bin\cache\engine.stamp" -Force
return
}
@@ -59,9 +60,17 @@ if ([string]::IsNullOrEmpty($engineVersion) -and (Test-Path "$flutterRoot\DEPS"
# Write the engine version out so downstream tools know what to look for.
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
[System.IO.File]::WriteAllText("$flutterRoot\bin\cache\engine.stamp", $engineVersion, $utf8NoBom)
# TODO(matanlurey): Stop writing to internal/engine.version. https://github.com/flutter/flutter/issues/164315.
[System.IO.File]::WriteAllText("$flutterRoot\bin\internal\engine.version", $engineVersion, $utf8NoBom)
# The realm on CI is passed in.
if ($Env:FLUTTER_REALM) {
[System.IO.File]::WriteAllText("$flutterRoot\bin\cache\engine.realm", $Env:FLUTTER_REALM, $utf8NoBom)
# TODO(matanlurey): Stop writing to internal/engine.realm. https://github.com/flutter/flutter/issues/164315.
[System.IO.File]::WriteAllText("$flutterRoot\bin\internal\engine.realm", $Env:FLUTTER_REALM, $utf8NoBom)
}
} else {
[System.IO.File]::WriteAllText("$flutterRoot\bin\cache\engine.realm", "", $utf8NoBom)
# TODO(matanlurey): Stop writing to internal/engine.realm. https://github.com/flutter/flutter/issues/164315.
[System.IO.File]::WriteAllText("$flutterRoot\bin\internal\engine.realm", "", $utf8NoBom)
}

View File

@@ -36,6 +36,7 @@ FLUTTER_ROOT="$(dirname "$(dirname "$(dirname "${BASH_SOURCE[0]}")")")"
# On stable, beta, and release tags, the engine.version is tracked by git - do not override it.
TRACKED_ENGINE="$(git -C "$FLUTTER_ROOT" ls-files bin/internal/engine.version)"
if [[ -n "$TRACKED_ENGINE" ]]; then
cp $FLUTTER_ROOT/bin/internal/engine.version $FLUTTER_ROOT/bin/cache/engine.stamp
exit
fi
@@ -60,9 +61,17 @@ if [ -z "$ENGINE_VERSION" ] && [ -f "$FLUTTER_ROOT/DEPS" ] && [ -f "$FLUTTER_ROO
fi
# Write the engine version out so downstream tools know what to look for.
echo $ENGINE_VERSION > "$FLUTTER_ROOT/bin/cache/engine.stamp"
# TODO(matanlurey): Stop writing to internal/engine.version. https://github.com/flutter/flutter/issues/164315.
echo $ENGINE_VERSION > "$FLUTTER_ROOT/bin/internal/engine.version"
# The realm on CI is passed in.
if [ -n "${FLUTTER_REALM}" ]; then
echo $FLUTTER_REALM > "$FLUTTER_ROOT/bin/cache/engine.realm"
# TODO(matanlurey): Stop writing to internal/engine.realm. https://github.com/flutter/flutter/issues/164315.
echo $FLUTTER_REALM > "$FLUTTER_ROOT/bin/internal/engine.realm"
else
echo "" > "$FLUTTER_ROOT/bin/cache/engine.realm"
# TODO(matanlurey): Stop writing to internal/engine.realm. https://github.com/flutter/flutter/issues/164315.
echo "" > "$FLUTTER_ROOT/bin/internal/engine.realm"
fi