diff --git a/.appveyor.yml b/.appveyor.yml index f92ea68fe..52efa1940 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,7 +17,10 @@ image: Visual Studio 2017 platform: x64 install: - - ps: build\ci\install_flutter.ps1 $env:APPVEYOR_BUILD_FOLDER\.. + # None of the packaged channels are new enough for the current state + # of FDE, so for now clone master instead. + #- ps: build\ci\install_flutter.ps1 $env:APPVEYOR_BUILD_FOLDER\.. + - git clone -b master https://github.com/flutter/flutter.git %APPVEYOR_BUILD_FOLDER%\..\flutter build_script: - msbuild "example\windows_fde\Example Embedder.sln" diff --git a/build/ci/install_flutter b/build/ci/install_flutter index 9c569fa22..5116aa53b 100755 --- a/build/ci/install_flutter +++ b/build/ci/install_flutter @@ -16,8 +16,8 @@ set -e -readonly CHANNEL="stable" -readonly VERSION="1.0.0" +readonly CHANNEL="dev" +readonly VERSION="1.1.8" if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then readonly FLUTTER_OS="linux" diff --git a/tools/dart_tools/bin/update_flutter_engine.dart b/tools/dart_tools/bin/update_flutter_engine.dart index 3dd08f056..bdb2189da 100644 --- a/tools/dart_tools/bin/update_flutter_engine.dart +++ b/tools/dart_tools/bin/update_flutter_engine.dart @@ -23,6 +23,7 @@ import 'package:path/path.dart' as path; import 'package:archive/archive.dart'; import '../lib/flutter_utils.dart'; +import '../lib/git_utils.dart'; /// The filename stored next to a downloaded engine library to indicate its /// version. @@ -84,6 +85,9 @@ Future main(List arguments) async { 'is present.\n' 'Defaults to a "flutter" directory next to this repository.', defaultsTo: getDefaultFlutterRoot()) + ..addFlag('skip_min_version_check', + help: 'If set, skips the initial check that the Flutter tree whose ' + 'engine version is being fetched is new enough for the framework.') ..addOption( 'hash', // Note: engine_override takes precedence over this flag so that @@ -112,6 +116,22 @@ Future main(List arguments) async { final String flutterRoot = parsedArguments['flutter_root']; final outputRoot = path.canonicalize(path.absolute(parsedArguments.rest[0])); + // TODO: Consider making a setup script that should be run after any update, + // which checks/fetches dependencies, and moving this check there. For now, + // do it here since it's a hook that's run on every build. + if (!parsedArguments['skip_min_version_check']) { + bool containsRequiredCommit = await gitHeadContainsCommit( + flutterRoot, lastKnownRequiredFlutterCommit); + if (!containsRequiredCommit) { + print('Flutter engine update aborted: Your Flutter tree is too ' + 'old for use with this project. Please update to a newer version of ' + 'Flutter, then try again.\n\n' + 'Note that this may require switching to Flutter master. See:\n' + 'https://github.com/flutter/flutter/wiki/Flutter-build-release-channels'); + exit(1); + } + } + final engineOverrideBuildType = await getEngineOverrideBuildType(); if (engineOverrideBuildType == null) { final String targetHash = diff --git a/tools/dart_tools/lib/flutter_utils.dart b/tools/dart_tools/lib/flutter_utils.dart index 3941980b5..509db89b8 100644 --- a/tools/dart_tools/lib/flutter_utils.dart +++ b/tools/dart_tools/lib/flutter_utils.dart @@ -19,6 +19,14 @@ import 'dart:io'; import 'package:path/path.dart' as path; +/// The last Flutter hash that's known to be required; a branch that doesn't +/// contain this commit will either fail to build, or fail to run. +/// +/// This should be updated whenever a new dependency is introduced (e.g., a +/// required embedder API addition or implementation fix). +const String lastKnownRequiredFlutterCommit = + '390ded9340e529b8475fefd1afdbe59c5b8d4081'; + /// Returns the path to the root of this repository. /// /// Relies on the known location of dart_tools/bin within the repo, and the fact diff --git a/tools/dart_tools/lib/git_utils.dart b/tools/dart_tools/lib/git_utils.dart new file mode 100644 index 000000000..553632a38 --- /dev/null +++ b/tools/dart_tools/lib/git_utils.dart @@ -0,0 +1,33 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the 'License'); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Wrappers for git commands used by the tools. + +import 'run_command.dart'; + +/// Returns true if the current +Future gitHeadContainsCommit( + String repositoryRoot, String commitHash) async { + final exitCode = await runCommand( + 'git', + [ + 'merge-base', + '--is-ancestor', + commitHash, + 'HEAD', + ], + workingDirectory: repositoryRoot, + allowFail: true); + return exitCode == 0; +}