@@ -2,3 +2,6 @@ This directory contains tools and resources that the Flutter team uses
|
||||
during development of the framework. The tools in this directory
|
||||
should not be necessary for developing Flutter applications, though of
|
||||
course they may be interesting if you are curious.
|
||||
|
||||
The tests in this directory are run in the `framework_tests_misc-*`
|
||||
shards.
|
||||
|
||||
@@ -1,31 +1,19 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# This script is only meant to be run by the Cirrus CI system, not locally.
|
||||
# It must be run from the root of the Flutter repo.
|
||||
|
||||
function error() {
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
# This script is only meant to be run by the Cirrus CI system, not locally.
|
||||
# It must be run from the root of the Flutter repo.
|
||||
|
||||
function accept_android_licenses() {
|
||||
yes "y" | flutter doctor --android-licenses > /dev/null 2>&1
|
||||
}
|
||||
|
||||
echo "Flutter SDK directory is: $PWD"
|
||||
|
||||
# Run flutter to download dependencies and precompile things, and to disable
|
||||
# analytics on the bots.
|
||||
echo "Downloading build dependencies and pre-compiling Flutter snapshot"
|
||||
./bin/flutter config --no-analytics
|
||||
|
||||
# Run doctor, to print it to the log for debugging purposes.
|
||||
./bin/flutter doctor -v
|
||||
|
||||
# Accept licenses.
|
||||
echo "Accepting Android licenses."
|
||||
accept_android_licenses || (error "Accepting Android licenses failed." && false)
|
||||
|
||||
# Run pub get in all the repo packages.
|
||||
echo "Updating packages for Flutter."
|
||||
./bin/flutter update-packages
|
||||
@@ -24,88 +24,90 @@ set -x
|
||||
|
||||
cd "$FLUTTER_ROOT"
|
||||
|
||||
if [[ "$SHARD" = "deploy_gallery" ]]; then
|
||||
version="$(<version)"
|
||||
if [[ "$OS" == "linux" ]]; then
|
||||
echo "Building Flutter Gallery $version for Android..."
|
||||
|
||||
# ANDROID_SDK_ROOT must be set in the env.
|
||||
version="$(<version)"
|
||||
if [[ "$OS" == "linux" ]]; then
|
||||
echo "Building Flutter Gallery $version for Android..."
|
||||
# ANDROID_SDK_ROOT must be set in the env.
|
||||
(
|
||||
cd examples/flutter_gallery
|
||||
flutter build apk --release -t lib/main_publish.dart
|
||||
)
|
||||
echo "Android Flutter Gallery built"
|
||||
if [[ -z "$CIRRUS_PR" && "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then
|
||||
echo "Deploying Flutter Gallery $version to Play Store..."
|
||||
set +x # Don't echo back the below.
|
||||
if [ -n "$ANDROID_GALLERY_UPLOAD_KEY" ]; then
|
||||
echo "$ANDROID_GALLERY_UPLOAD_KEY" | base64 --decode > /root/.android/debug.keystore
|
||||
fi
|
||||
set -x
|
||||
(
|
||||
cd examples/flutter_gallery
|
||||
flutter build apk --release -t lib/main_publish.dart
|
||||
cd examples/flutter_gallery/android
|
||||
fastlane deploy_play_store
|
||||
)
|
||||
echo "Android Flutter Gallery built"
|
||||
if [[ -z "$CIRRUS_PR" && "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then
|
||||
echo "Deploying Flutter Gallery $version to Play Store..."
|
||||
set +x # Don't echo back the below.
|
||||
if [ -n "$ANDROID_GALLERY_UPLOAD_KEY" ]; then
|
||||
echo "$ANDROID_GALLERY_UPLOAD_KEY" | base64 --decode > /root/.android/debug.keystore
|
||||
fi
|
||||
set -x
|
||||
else
|
||||
echo "(Not deploying; Flutter Gallery is only deployed to Play store for tagged dev branch commits.)"
|
||||
fi
|
||||
elif [[ "$OS" == "darwin" ]]; then
|
||||
echo "Building Flutter Gallery $version for iOS..."
|
||||
(
|
||||
cd examples/flutter_gallery
|
||||
flutter build ios --release --no-codesign -t lib/main_publish.dart
|
||||
|
||||
# flutter build ios will run CocoaPods script. Check generated locations.
|
||||
if [[ ! -d "ios/Pods" ]]; then
|
||||
echo "Error: pod install failed to setup plugins"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "ios/.symlinks/plugins" ]]; then
|
||||
echo "Error: pod install failed to setup plugin symlinks"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d "ios/.symlinks/flutter" ]]; then
|
||||
echo "Error: pod install created flutter symlink"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets" ]]; then
|
||||
echo "Error: flutter_assets not assembled"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[
|
||||
-d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/isolate_snapshot_data" ||
|
||||
-d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin" ||
|
||||
-d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/vm_snapshot_data"
|
||||
]]; then
|
||||
echo "Error: compiled debug version of app with --release flag"
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
echo "iOS Flutter Gallery built"
|
||||
if [[ -z "$CIRRUS_PR" ]]; then
|
||||
if [[ "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then
|
||||
echo "Archiving with distribution profile and deploying to TestFlight..."
|
||||
(
|
||||
cd examples/flutter_gallery/android
|
||||
fastlane deploy_play_store
|
||||
cd examples/flutter_gallery/ios
|
||||
export DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS="-t DAV"
|
||||
fastlane build_and_deploy_testflight upload:true
|
||||
)
|
||||
else
|
||||
echo "Not deployed: Flutter Gallery is only deployed to the Play Store on merged and tagged dev branch commits"
|
||||
fi
|
||||
elif [[ "$OS" == "darwin" ]]; then
|
||||
echo "Building Flutter Gallery $version for iOS..."
|
||||
(
|
||||
cd examples/flutter_gallery
|
||||
flutter build ios --release --no-codesign -t lib/main_publish.dart
|
||||
|
||||
# flutter build ios will run CocoaPods script. Check generated locations.
|
||||
if [[ ! -d "ios/Pods" ]]; then
|
||||
echo "Error: pod install failed to setup plugins"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "ios/.symlinks/plugins" ]]; then
|
||||
echo "Error: pod install failed to setup plugin symlinks"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d "ios/.symlinks/flutter" ]]; then
|
||||
echo "Error: pod install created flutter symlink"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets" ]]; then
|
||||
echo "Error: flutter_assets not assembled"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[
|
||||
-d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/isolate_snapshot_data" ||
|
||||
-d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin" ||
|
||||
-d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/vm_snapshot_data"
|
||||
]]; then
|
||||
echo "Error: compiled debug version of app with --release flag"
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
echo "iOS Flutter Gallery built"
|
||||
if [[ -z "$CIRRUS_PR" ]]; then
|
||||
if [[ "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then
|
||||
echo "Archiving with distribution profile and deploying to TestFlight..."
|
||||
(
|
||||
cd examples/flutter_gallery/ios
|
||||
export DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS="-t DAV"
|
||||
fastlane build_and_deploy_testflight upload:true
|
||||
)
|
||||
else
|
||||
echo "Archiving with distribution profile..."
|
||||
(
|
||||
cd examples/flutter_gallery/ios
|
||||
fastlane build_and_deploy_testflight
|
||||
)
|
||||
echo "Archive is only deployed to TestFlight on tagged dev branch commits"
|
||||
fi
|
||||
else
|
||||
echo "Not deployed: Flutter Gallery is only deployed to TestFlight on merged and tagged dev branch commits"
|
||||
# On iOS the signing can break as well, so we verify this regularly (not just
|
||||
# on tagged dev branch commits). We can only do this post-merge, though, because
|
||||
# the secrets aren't available on PRs.
|
||||
echo "Testing archiving with distribution profile..."
|
||||
(
|
||||
cd examples/flutter_gallery/ios
|
||||
fastlane build_and_deploy_testflight
|
||||
)
|
||||
echo "(Not deploying; Flutter Gallery is only deployed to TestFlight for tagged dev branch commits.)"
|
||||
fi
|
||||
else
|
||||
echo "(Not archiving or deploying; Flutter Gallery archiving is only tested post-commit.)"
|
||||
fi
|
||||
else
|
||||
echo "Doing nothing: not on the 'deploy_gallery' SHARD."
|
||||
echo "Unknown OS: $OS"
|
||||
echo "Aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -95,7 +95,6 @@ Future<void> runCommand(String executable, List<String> arguments, {
|
||||
OutputMode outputMode = OutputMode.print,
|
||||
CapturedOutput output,
|
||||
bool skip = false,
|
||||
bool expectFlaky = false,
|
||||
bool Function(String) removeLine,
|
||||
}) async {
|
||||
assert((outputMode == OutputMode.capture) == (output != null),
|
||||
@@ -145,10 +144,6 @@ Future<void> runCommand(String executable, List<String> arguments, {
|
||||
output.stderr = _flattenToString(await savedStderr);
|
||||
}
|
||||
|
||||
// If the test is flaky we don't care about the actual exit.
|
||||
if (expectFlaky)
|
||||
return;
|
||||
|
||||
if ((exitCode == 0) == expectNonZeroExit || (expectedExitCode != null && exitCode != expectedExitCode)) {
|
||||
if (failureMessage != null) {
|
||||
print(failureMessage);
|
||||
|
||||
1099
dev/bots/test.dart
1099
dev/bots/test.dart
File diff suppressed because it is too large
Load Diff
13
dev/bots/test/bot_test.dart
Normal file
13
dev/bots/test/bot_test.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'common.dart';
|
||||
|
||||
void main() {
|
||||
test('BOT variable is set on bots', () {
|
||||
expect(Platform.environment['BOT'], 'true');
|
||||
});
|
||||
}
|
||||
21
dev/bots/test/sdk_directory_has_space_test.dart
Normal file
21
dev/bots/test/sdk_directory_has_space_test.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import 'common.dart';
|
||||
|
||||
void main() {
|
||||
test('We are in a directory with a space in it', () async {
|
||||
// The Flutter SDK should be in a directory with a space in it, to make sure
|
||||
// our tools support that.
|
||||
final String expectedName = Platform.environment['FLUTTER_SDK_PATH_WITH_SPACE'];
|
||||
expect(expectedName, 'flutter sdk');
|
||||
expect(expectedName, contains(' '));
|
||||
final List<String> parts = path.split(Directory.current.absolute.path);
|
||||
expect(parts.reversed.take(3), <String>['bots', 'dev', expectedName]);
|
||||
});
|
||||
}
|
||||
@@ -29,7 +29,11 @@ void main() {
|
||||
];
|
||||
for (String version in valid_versions) {
|
||||
when(file.readAsString()).thenAnswer((Invocation invocation) => Future<String>.value(version));
|
||||
expect(await verifyVersion(version, file), isTrue, reason: '$version is invalid');
|
||||
expect(
|
||||
await verifyVersion(file),
|
||||
isNull,
|
||||
reason: '$version is valid but verifyVersionFile said it was bad',
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -41,10 +45,15 @@ void main() {
|
||||
'1.2.3-pre',
|
||||
'1.2.3-pre.1+hotfix.1',
|
||||
' 1.2.3',
|
||||
'1.2.3-hotfix.1',
|
||||
];
|
||||
for (String version in invalid_versions) {
|
||||
when(file.readAsString()).thenAnswer((Invocation invocation) => Future<String>.value(version));
|
||||
expect(await verifyVersion(version, file), isFalse);
|
||||
expect(
|
||||
await verifyVersion(file),
|
||||
'The version logic generated an invalid version string: "$version".',
|
||||
reason: '$version is invalid but verifyVersionFile said it was fine',
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user