Skip to content

Commit dbdfa8f

Browse files
authored
Flutter setup: use http archive for stable/beta version, use git only for master. (#7834)
1 parent ff9f6f0 commit dbdfa8f

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Important changes to data models, configuration, and migrations between each
22
AppEngine version, listed here to ease deployment and troubleshooting.
33

44
## Next Release (replace with git tag when deployed)
5+
* Note: `setup-flutter.sh` uses http archives for stable/beta channel.
56

67
## `20240627t084200-all`
78
* Bumped runtimeVersion to `2024.06.25`.

Dockerfile.worker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM gcr.io/google-containers/debian-base-amd64:v2.0.0
22

33
RUN apt-get update && \
44
apt-get upgrade -y && \
5-
apt-get install -y unzip ca-certificates curl bash git && \
5+
apt-get install -y unzip ca-certificates curl bash git xz-utils && \
66
rm -rf /var/lib/apt/lists/*
77

88
ENV PUB_ENVIRONMENT="bot.pub_dev.pub_worker"

pkg/pub_worker/lib/src/bin/pana_wrapper.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,13 @@ Future<({String configKind, String? dartSdkPath, String? flutterSdkPath})>
255255
sdkKind: 'dart',
256256
configKind: bundle.configKind,
257257
version: bundle.dart,
258+
channel: bundle.channel,
258259
);
259260
final flutterSdkPath = await _installSdk(
260261
sdkKind: 'flutter',
261262
configKind: bundle.configKind,
262263
version: bundle.flutter,
264+
channel: bundle.channel,
263265
);
264266

265267
return (
@@ -280,6 +282,7 @@ Future<({String configKind, String? dartSdkPath, String? flutterSdkPath})>
280282

281283
Future<String?> _installSdk({
282284
required String sdkKind,
285+
required String channel,
283286
required String configKind,
284287
required String version,
285288
}) async {
@@ -300,6 +303,7 @@ Future<String?> _installSdk({
300303
'tool/setup-$sdkKind.sh',
301304
sdkPath,
302305
version,
306+
channel,
303307
],
304308
workingDirectory: '/home/worker/pub-dev',
305309
environment: {
@@ -322,11 +326,13 @@ Future<String?> _installSdk({
322326
}
323327

324328
class _SdkBundle {
329+
final String channel;
325330
final String configKind;
326331
final String dart;
327332
final String flutter;
328333

329334
_SdkBundle({
335+
required this.channel,
330336
required this.configKind,
331337
required this.dart,
332338
required this.flutter,
@@ -352,17 +358,20 @@ Future<List<_SdkBundle>> _detectSdkBundles() async {
352358
if (latestStableDartSdkVersion != null &&
353359
latestStableFlutterSdkVersion != null)
354360
_SdkBundle(
361+
channel: 'stable',
355362
configKind: 'latest-stable',
356363
dart: latestStableDartSdkVersion,
357364
flutter: latestStableFlutterSdkVersion,
358365
),
359366
if (latestBetaDartSdkVersion != null && latestBetaFlutterSdkVersion != null)
360367
_SdkBundle(
368+
channel: 'beta',
361369
configKind: 'latest-beta',
362370
dart: latestBetaDartSdkVersion,
363371
flutter: latestBetaFlutterSdkVersion,
364372
),
365373
_SdkBundle(
374+
channel: 'master',
366375
configKind: 'master',
367376
dart: 'master',
368377
flutter: 'master',

pkg/pub_worker/test/dockerized_end2end_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ void main() {
7676
final result = await server.waitForResult(package, version);
7777

7878
final docIndex = result.index.lookup('doc/index.html');
79-
expect(docIndex, isNotNull);
79+
expect(docIndex, isNotNull,
80+
reason: '$package must have documentation');
8081

8182
final panaSummaryBytes = result.lookup('summary.json');
8283
expect(panaSummaryBytes, isNotNull);

tool/setup-flutter.sh

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,34 @@ then
1515
fi
1616

1717
# Download and extract Flutter SDK into the target directory.
18-
git clone -b "$2" --single-branch https://github.com/flutter/flutter.git "$1"
18+
if [[ "$2" == "master" ]]
19+
then
20+
git clone -b "$2" --single-branch https://github.com/flutter/flutter.git "$1"
21+
else
22+
CHANNEL=${3:-stable}
23+
24+
# Create a temporary directory to extract the archive to.
25+
WORK_DIR=`mktemp -d`
26+
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
27+
echo "Could not create temporary directory."
28+
exit 1
29+
fi
30+
31+
# Download and extract Flutter SDK
32+
cd "$WORK_DIR"
33+
curl -sS "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_$2-${CHANNEL}.tar.xz" >flutter.tar.xz
34+
tar xf flutter.tar.xz
35+
rm flutter.tar.xz
36+
37+
# Move from temp to destination.
38+
DEST_PARENT=`dirname "$1"`
39+
mkdir -p "$DEST_PARENT"
40+
mv "$WORK_DIR/flutter" "$1"
41+
fi
1942

20-
# Downloads the Dart SDK and disables analytics tracking – which we always want.
21-
# This will add 400 MB.
43+
# When using `git clone` above, the first command downloads the Dart SDK (adds ~400MB),
44+
# which should be already included in the tar archive. However, the tar archive requires
45+
# to run `flutter doctor` to work properly.
2246
cd "$1"
2347
./bin/flutter --no-version-check config --no-analytics
48+
./bin/flutter --no-version-check doctor

0 commit comments

Comments
 (0)