diff --git a/tool/github.sh b/tool/github.sh index 77a9fb6f6..7cb118493 100755 --- a/tool/github.sh +++ b/tool/github.sh @@ -20,8 +20,8 @@ ls $JAVA_HOME echo "export PATH=$JAVA_HOME/bin:\$PATH" export PATH=$JAVA_HOME/bin:$PATH -# Clone and configure Flutter to the latest stable release -git clone --depth 1 https://github.com/flutter/flutter.git ../flutter +# Download and configure Flutter to the pinned stable release if not present +source ./tool/provision_flutter.sh export PATH="$PATH":`pwd`/../flutter/bin:`pwd`/../flutter/bin/cache/dart-sdk/bin flutter config --no-analytics flutter doctor diff --git a/tool/kokoro/setup.sh b/tool/kokoro/setup.sh index b6a57b98c..4c44ec0b7 100644 --- a/tool/kokoro/setup.sh +++ b/tool/kokoro/setup.sh @@ -32,8 +32,8 @@ setup() { export JAVA_OPTS=" -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true" - # Clone and configure Flutter to the latest stable release - git clone --depth 1 https://github.com/flutter/flutter.git ../flutter + # Download and configure Flutter to the pinned stable release if not present + source ./tool/provision_flutter.sh export PATH="$PATH":`pwd`/../flutter/bin:`pwd`/../flutter/bin/cache/dart-sdk/bin flutter config --no-analytics flutter doctor diff --git a/tool/provision_flutter.sh b/tool/provision_flutter.sh new file mode 100755 index 000000000..537841ac5 --- /dev/null +++ b/tool/provision_flutter.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2026 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Fail on any error. +set -e + +# Provision the pinned Flutter SDK if not present +if [ ! -d "../flutter" ]; then + OS_NAME=$(uname -s | tr '[:upper:]' '[:lower:]') + FLUTTER_VERSION="3.41.0" + + echo "Provisioning Flutter SDK version ${FLUTTER_VERSION} for ${OS_NAME}..." + if [ "$OS_NAME" = "darwin" ]; then + curl -fLO "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_${FLUTTER_VERSION}-stable.zip" + unzip -q "flutter_macos_${FLUTTER_VERSION}-stable.zip" -d ../ + rm "flutter_macos_${FLUTTER_VERSION}-stable.zip" + else + curl -fLO "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" + tar xf "flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" -C ../ + rm "flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" + fi +else + echo "../flutter already exists, skipping download." +fi