Skip to content

Commit 574aae1

Browse files
authored
[infra] provision flutter from a gstore archive (#8951)
Moves Flutter provisioning from a `git clone` to pulling down an archive which is **much faster**. First run is coming in at just under 17 minutes; down from an hour: <img width="949" height="254" alt="image" src="https://github.com/user-attachments/assets/37d3f816-0996-410d-91a5-caca882fd815" /> --- If this sticks, we'll be waiting 71.7% less time for builds to complete, and our deployment pipeline will be running 253% faster than it used to be. 🚀 Fixes: #8950 --- Review the contribution guidelines below: - [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR. - [x] I've included the required information in the description above. - [x] My up-to-date information is in the `AUTHORS` file. - [x] I've updated `CHANGELOG.md` if appropriate. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide](../CONTRIBUTING.md) and the [Flutter organization contributor guide]([https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](#8098)). </details>
1 parent 9a1a847 commit 574aae1

3 files changed

Lines changed: 30 additions & 4 deletions

File tree

tool/github.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ ls $JAVA_HOME
2020
echo "export PATH=$JAVA_HOME/bin:\$PATH"
2121
export PATH=$JAVA_HOME/bin:$PATH
2222

23-
# Clone and configure Flutter to the latest stable release
24-
git clone --depth 1 https://github.com/flutter/flutter.git ../flutter
23+
# Download and configure Flutter to the pinned stable release if not present
24+
source ./tool/provision_flutter.sh
2525
export PATH="$PATH":`pwd`/../flutter/bin:`pwd`/../flutter/bin/cache/dart-sdk/bin
2626
flutter config --no-analytics
2727
flutter doctor

tool/kokoro/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ setup() {
3232

3333
export JAVA_OPTS=" -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true"
3434

35-
# Clone and configure Flutter to the latest stable release
36-
git clone --depth 1 https://github.com/flutter/flutter.git ../flutter
35+
# Download and configure Flutter to the pinned stable release if not present
36+
source ./tool/provision_flutter.sh
3737
export PATH="$PATH":`pwd`/../flutter/bin:`pwd`/../flutter/bin/cache/dart-sdk/bin
3838
flutter config --no-analytics
3939
flutter doctor

tool/provision_flutter.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Copyright 2026 The Chromium Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
6+
# Fail on any error.
7+
set -e
8+
9+
# Provision the pinned Flutter SDK if not present
10+
if [ ! -d "../flutter" ]; then
11+
OS_NAME=$(uname -s | tr '[:upper:]' '[:lower:]')
12+
FLUTTER_VERSION="3.41.0"
13+
14+
echo "Provisioning Flutter SDK version ${FLUTTER_VERSION} for ${OS_NAME}..."
15+
if [ "$OS_NAME" = "darwin" ]; then
16+
curl -fLO "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_${FLUTTER_VERSION}-stable.zip"
17+
unzip -q "flutter_macos_${FLUTTER_VERSION}-stable.zip" -d ../
18+
rm "flutter_macos_${FLUTTER_VERSION}-stable.zip"
19+
else
20+
curl -fLO "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz"
21+
tar xf "flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" -C ../
22+
rm "flutter_linux_${FLUTTER_VERSION}-stable.tar.xz"
23+
fi
24+
else
25+
echo "../flutter already exists, skipping download."
26+
fi

0 commit comments

Comments
 (0)