mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
_downloadArtifacts (Web SDK) uses content-aware hashing in post-submit (#174236)
Towards https://github.com/flutter/flutter/issues/174225. Will need to get cherry-picked into 3.35 and 3.36.
This commit is contained in:
parent
a24dbd551f
commit
6c7d6429bd
@ -258,6 +258,31 @@ final String gitRevision = () {
|
||||
return (result.stdout as String).trim();
|
||||
}();
|
||||
|
||||
final String contentHash = () {
|
||||
final String executable;
|
||||
final List<String> args;
|
||||
if (io.Platform.isWindows) {
|
||||
executable = 'powershell';
|
||||
args = <String>[path.join('bin', 'internal', 'content_aware_hash.ps1')];
|
||||
} else {
|
||||
executable = path.join('bin', 'internal', 'content_aware_hash.sh');
|
||||
args = <String>[];
|
||||
}
|
||||
final result = io.Process.runSync(
|
||||
executable,
|
||||
args,
|
||||
workingDirectory: environment.flutterRootDir.path,
|
||||
stderrEncoding: utf8,
|
||||
stdoutEncoding: utf8,
|
||||
);
|
||||
if (result.exitCode != 0) {
|
||||
throw ToolExit(
|
||||
'Failed to get content hash. Exit code: ${result.exitCode} Error: ${result.stderr}',
|
||||
);
|
||||
}
|
||||
return (result.stdout as String).trim();
|
||||
}();
|
||||
|
||||
const String kChrome = 'chrome';
|
||||
const String kEdge = 'edge';
|
||||
const String kFirefox = 'firefox';
|
||||
|
||||
@ -24,6 +24,7 @@ class Environment {
|
||||
final io.File self = io.File.fromUri(io.Platform.script);
|
||||
|
||||
final io.Directory engineSrcDir = self.parent.parent.parent.parent.parent;
|
||||
final io.Directory flutterRootDir = engineSrcDir.parent.parent;
|
||||
final io.Directory engineToolsDir = io.Directory(
|
||||
pathlib.join(engineSrcDir.path, 'flutter', 'tools'),
|
||||
);
|
||||
@ -52,6 +53,7 @@ class Environment {
|
||||
isMacosArm: isMacosArm,
|
||||
webUiRootDir: webUiRootDir,
|
||||
engineSrcDir: engineSrcDir,
|
||||
flutterRootDir: flutterRootDir,
|
||||
engineToolsDir: engineToolsDir,
|
||||
outDir: outDir,
|
||||
wasmReleaseOutDir: wasmReleaseOutDir,
|
||||
@ -67,6 +69,7 @@ class Environment {
|
||||
required this.isMacosArm,
|
||||
required this.webUiRootDir,
|
||||
required this.engineSrcDir,
|
||||
required this.flutterRootDir,
|
||||
required this.engineToolsDir,
|
||||
required this.outDir,
|
||||
required this.wasmReleaseOutDir,
|
||||
@ -137,6 +140,9 @@ class Environment {
|
||||
'dart2wasm.dart',
|
||||
);
|
||||
|
||||
/// Path to the root flutter directory (which itself contains `engine/src/flutter`).
|
||||
final io.Directory flutterRootDir;
|
||||
|
||||
/// Path to where github.com/flutter/engine is checked out inside the engine workspace.
|
||||
io.Directory get flutterDirectory => io.Directory(pathlib.join(engineSrcDir.path, 'flutter'));
|
||||
io.Directory get webSdkRootDir => io.Directory(pathlib.join(flutterDirectory.path, 'web_sdk'));
|
||||
|
||||
@ -57,7 +57,7 @@ class CopyArtifactsStep implements PipelineStep {
|
||||
};
|
||||
final Uri url = Uri.https(
|
||||
'storage.googleapis.com',
|
||||
'${realmComponent}flutter_infra_release/flutter/$gitRevision/flutter-web-sdk.zip',
|
||||
'${realmComponent}flutter_infra_release/flutter/${realm == LuciRealm.Try ? gitRevision : contentHash}/flutter-web-sdk.zip',
|
||||
);
|
||||
final http.Response response = await http.Client().get(url);
|
||||
if (response.statusCode != 200) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user