2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
+ import 'package:file/src/interface/file.dart' ;
5
6
import 'package:file_testing/file_testing.dart' ;
6
7
import 'package:flutter_tools/src/base/io.dart' ;
7
8
@@ -16,6 +17,40 @@ void main() {
16
17
final String workingDirectory = fileSystem.path.join (getFlutterRoot (), 'dev' , 'integration_tests' , 'gradle_deprecated_settings' );
17
18
final String flutterBin = fileSystem.path.join (getFlutterRoot (), 'bin' , 'flutter' );
18
19
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
+
19
54
final ProcessResult result = await processManager.run (< String > [
20
55
flutterBin,
21
56
'build' ,
@@ -25,11 +60,7 @@ void main() {
25
60
'--verbose' ,
26
61
], workingDirectory: workingDirectory);
27
62
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 ());
33
64
34
65
final String apkPath = fileSystem.path.join (
35
66
workingDirectory, 'build' , 'app' , 'outputs' , 'flutter-apk' , 'app-debug.apk' );
0 commit comments