22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5+ import 'package:file/src/interface/file.dart' ;
56import 'package:file_testing/file_testing.dart' ;
67import 'package:flutter_tools/src/base/io.dart' ;
78
@@ -16,6 +17,40 @@ void main() {
1617 final String workingDirectory = fileSystem.path.join (getFlutterRoot (), 'dev' , 'integration_tests' , 'gradle_deprecated_settings' );
1718 final String flutterBin = fileSystem.path.join (getFlutterRoot (), 'bin' , 'flutter' );
1819
20+ final File settingsDotGradleFile = fileSystem.file (
21+ fileSystem.path.join (workingDirectory, 'android' , 'settings.gradle' ));
22+ const String expectedSettingsDotGradle = r"""
23+ // Copyright 2014 The Flutter Authors. All rights reserved.
24+ // Use of this source code is governed by a BSD-style license that can be
25+ // found in the LICENSE file.
26+
27+ // This is the `settings.gradle` file that apps were created with until Flutter
28+ // v1.22.0. This file has changed, so it must be migrated in existing projects.
29+
30+ include ':app'
31+
32+ def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
33+ def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
34+ def properties = new Properties()
35+
36+ def plugins = new Properties()
37+ def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
38+ if (pluginsFile.exists()) {
39+ pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
40+ }
41+
42+ plugins.each { name, path ->
43+ def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
44+ include ":$name"
45+ project(":$name").projectDir = pluginDirectory
46+ }
47+ """ ;
48+
49+ expect (
50+ settingsDotGradleFile.readAsStringSync ().trim ().replaceAll ('\r ' , '' ),
51+ equals (expectedSettingsDotGradle.trim ()),
52+ );
53+
1954 final ProcessResult result = await processManager.run (< String > [
2055 flutterBin,
2156 'build' ,
@@ -25,11 +60,7 @@ void main() {
2560 '--verbose' ,
2661 ], workingDirectory: workingDirectory);
2762
28- printOnFailure ('Output of flutter build apk:' );
29- printOnFailure (result.stdout.toString ());
30- printOnFailure (result.stderr.toString ());
31-
32- expect (result.exitCode, 0 );
63+ expect (result, const ProcessResultMatcher ());
3364
3465 final String apkPath = fileSystem.path.join (
3566 workingDirectory, 'build' , 'app' , 'outputs' , 'flutter-apk' , 'app-debug.apk' );
0 commit comments