mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Revert automated changes made to deprecated settings.gradle (plugins.each) (#140037)
Restore testing deprecated settings.gradle (plugins.each). Updated presumably by accident in #83067 Split from #137115 See also https://github.com/flutter/flutter/pull/137115#issuecomment-1781909865
This commit is contained in:
parent
62d699961f
commit
da0cd69659
@ -1,7 +1,7 @@
|
|||||||
# Deprecated settings.gradle
|
# Deprecated settings.gradle
|
||||||
|
|
||||||
This project is meant to test that apps using the current `android/settings.gradle`
|
This project is meant to test that apps using the deprecated
|
||||||
can still be built. This project can be removed once apps have been migrated to
|
`android/settings.gradle` (_PluginEach_ used until Flutter v1.22.0) can still be built.
|
||||||
this new file.
|
This project can be removed once apps have been migrated to this new file.
|
||||||
|
|
||||||
Issue: https://github.com/flutter/flutter/issues/54566
|
Issue: https://github.com/flutter/flutter/issues/54566
|
||||||
|
@ -2,27 +2,23 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// This file is auto generated.
|
// This is the `settings.gradle` file that apps were created with until Flutter
|
||||||
// To update all the settings.gradle files in the Flutter repo,
|
// v1.22.0. This file has changed, so it must be migrated in existing projects.
|
||||||
// See dev/tools/bin/generate_gradle_lockfiles.dart.
|
|
||||||
|
|
||||||
pluginManagement {
|
include ':app'
|
||||||
def flutterSdkPath = {
|
|
||||||
|
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||||
|
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
||||||
def properties = new Properties()
|
def properties = new Properties()
|
||||||
file("local.properties").withInputStream { properties.load(it) }
|
|
||||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
|
||||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
|
||||||
return flutterSdkPath
|
|
||||||
}
|
|
||||||
settings.ext.flutterSdkPath = flutterSdkPath()
|
|
||||||
|
|
||||||
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
|
def plugins = new Properties()
|
||||||
|
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||||
plugins {
|
if (pluginsFile.exists()) {
|
||||||
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
|
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
include ":app"
|
plugins.each { name, path ->
|
||||||
|
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||||
apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
include ":$name"
|
||||||
|
project(":$name").projectDir = pluginDirectory
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:file/src/interface/file.dart';
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
@ -16,6 +17,40 @@ void main() {
|
|||||||
final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'dev', 'integration_tests', 'gradle_deprecated_settings');
|
final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'dev', 'integration_tests', 'gradle_deprecated_settings');
|
||||||
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
|
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
|
||||||
|
|
||||||
|
final File settingsDotGradleFile = fileSystem.file(
|
||||||
|
fileSystem.path.join(workingDirectory, 'android', 'settings.gradle'));
|
||||||
|
const String expectedSettingsDotGradle = r"""
|
||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
// This is the `settings.gradle` file that apps were created with until Flutter
|
||||||
|
// v1.22.0. This file has changed, so it must be migrated in existing projects.
|
||||||
|
|
||||||
|
include ':app'
|
||||||
|
|
||||||
|
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||||
|
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
||||||
|
def properties = new Properties()
|
||||||
|
|
||||||
|
def plugins = new Properties()
|
||||||
|
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||||
|
if (pluginsFile.exists()) {
|
||||||
|
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins.each { name, path ->
|
||||||
|
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||||
|
include ":$name"
|
||||||
|
project(":$name").projectDir = pluginDirectory
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
|
||||||
|
expect(
|
||||||
|
settingsDotGradleFile.readAsStringSync().trim().replaceAll('\r', ''),
|
||||||
|
equals(expectedSettingsDotGradle.trim()),
|
||||||
|
);
|
||||||
|
|
||||||
final ProcessResult result = await processManager.run(<String>[
|
final ProcessResult result = await processManager.run(<String>[
|
||||||
flutterBin,
|
flutterBin,
|
||||||
'build',
|
'build',
|
||||||
@ -25,11 +60,7 @@ void main() {
|
|||||||
'--verbose',
|
'--verbose',
|
||||||
], workingDirectory: workingDirectory);
|
], workingDirectory: workingDirectory);
|
||||||
|
|
||||||
printOnFailure('Output of flutter build apk:');
|
expect(result, const ProcessResultMatcher());
|
||||||
printOnFailure(result.stdout.toString());
|
|
||||||
printOnFailure(result.stderr.toString());
|
|
||||||
|
|
||||||
expect(result.exitCode, 0);
|
|
||||||
|
|
||||||
final String apkPath = fileSystem.path.join(
|
final String apkPath = fileSystem.path.join(
|
||||||
workingDirectory, 'build', 'app', 'outputs', 'flutter-apk', 'app-debug.apk');
|
workingDirectory, 'build', 'app', 'outputs', 'flutter-apk', 'app-debug.apk');
|
||||||
|
Loading…
Reference in New Issue
Block a user