Stop generate both .kts
and non-.kts
gradle files for a test project. (#158965)
Closes https://github.com/flutter/flutter/issues/158962.
This commit is contained in:
parent
6a145094ab
commit
eaa99f28b1
@ -8,6 +8,7 @@ import 'package:flutter_tools/src/base/io.dart';
|
|||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
|
import 'test_data/deferred_components_config.dart';
|
||||||
import 'test_data/plugin_each_settings_gradle_project.dart';
|
import 'test_data/plugin_each_settings_gradle_project.dart';
|
||||||
import 'test_data/plugin_project.dart';
|
import 'test_data/plugin_project.dart';
|
||||||
import 'test_data/project.dart';
|
import 'test_data/project.dart';
|
||||||
@ -114,12 +115,34 @@ void main() {
|
|||||||
test(
|
test(
|
||||||
'skip plugin with android folder if it does not support the Android platform',
|
'skip plugin with android folder if it does not support the Android platform',
|
||||||
() async {
|
() async {
|
||||||
final Project project = PluginWithPathAndroidProject();
|
final Project project = PluginWithPathAndroidProjectWithoutDeferred();
|
||||||
final ProcessResult buildApkResult = await testUnsupportedPlugin(
|
final ProcessResult buildApkResult = await testUnsupportedPlugin(
|
||||||
project: project, createAndroidPluginFolder: true);
|
project: project, createAndroidPluginFolder: true);
|
||||||
expect(buildApkResult.stderr.toString(),
|
expect(buildApkResult.stderr.toString(),
|
||||||
isNot(contains('Please fix your settings.gradle')));
|
isNot(contains('Please fix your settings.gradle')));
|
||||||
expect(buildApkResult, const ProcessResultMatcher());
|
expect(buildApkResult, const ProcessResultMatcher());
|
||||||
|
|
||||||
|
// Regression check for https://github.com/flutter/flutter/issues/158962.
|
||||||
|
{
|
||||||
|
final Directory androidDir = project.dir.childDirectory('android');
|
||||||
|
expect(
|
||||||
|
androidDir.childFile('settings.gradle.kts'),
|
||||||
|
exists,
|
||||||
|
reason:
|
||||||
|
'Modern flutter create --platforms android template creates this',
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
androidDir.childFile('settings.gradle'),
|
||||||
|
isNot(exists),
|
||||||
|
reason: ''
|
||||||
|
'flutter create should have created a settings.gradle.kts file '
|
||||||
|
'but not a settings.gradle file. Prior to the change in the PR '
|
||||||
|
'addressing https://github.com/flutter/flutter/issues/158962 '
|
||||||
|
'both files were created, which means that tooling picked one '
|
||||||
|
'and not the other, which causes ambiguity for debugging test '
|
||||||
|
'flakes.',
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO(54566): Remove test when issue is resolved.
|
// TODO(54566): Remove test when issue is resolved.
|
||||||
@ -186,13 +209,31 @@ dependencies:
|
|||||||
path: ../
|
path: ../
|
||||||
''';
|
''';
|
||||||
|
|
||||||
|
/// Project that load's a plugin from the specified path.
|
||||||
|
class PluginWithPathAndroidProjectWithoutDeferred extends PluginProject {
|
||||||
|
// Intentionally omit; this test case has nothing to do with deferred
|
||||||
|
// components and a DefererdComponentsConfig will cause duplicates of files
|
||||||
|
// such as build.gradle{.kts}, settings.gradle{kts} and related to be
|
||||||
|
// generated, which in turn adds ambiguity to how the tests are built and
|
||||||
|
// executed.
|
||||||
|
//
|
||||||
|
// See https://github.com/flutter/flutter/issues/158962.
|
||||||
|
@override
|
||||||
|
DeferredComponentsConfig? get deferredComponents => null;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get pubspec => pubspecWithPluginPath;
|
||||||
|
}
|
||||||
|
|
||||||
/// Project that load's a plugin from the specified path.
|
/// Project that load's a plugin from the specified path.
|
||||||
class PluginWithPathAndroidProject extends PluginProject {
|
class PluginWithPathAndroidProject extends PluginProject {
|
||||||
@override
|
@override
|
||||||
String get pubspec => pubspecWithPluginPath;
|
String get pubspec => pubspecWithPluginPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(54566): Remove class when issue is resolved.
|
// TODO(matanlurey): Remove class when `.flutter-plugins` is no longer emitted.
|
||||||
|
// See https://github.com/flutter/flutter/issues/48918.
|
||||||
|
|
||||||
/// [PluginEachSettingsGradleProject] that load's a plugin from the specified
|
/// [PluginEachSettingsGradleProject] that load's a plugin from the specified
|
||||||
/// path.
|
/// path.
|
||||||
class PluginEachWithPathAndroidProject extends PluginEachSettingsGradleProject {
|
class PluginEachWithPathAndroidProject extends PluginEachSettingsGradleProject {
|
||||||
@ -200,7 +241,9 @@ class PluginEachWithPathAndroidProject extends PluginEachSettingsGradleProject {
|
|||||||
String get pubspec => pubspecWithPluginPath;
|
String get pubspec => pubspecWithPluginPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(54566): Remove class when issue is resolved.
|
// TODO(matanlurey): Remove class when `.flutter-plugins` is no longer emitted.
|
||||||
|
// See https://github.com/flutter/flutter/issues/48918.
|
||||||
|
|
||||||
/// [PluginCompromisedEachSettingsGradleProject] that load's a plugin from the
|
/// [PluginCompromisedEachSettingsGradleProject] that load's a plugin from the
|
||||||
/// specified path.
|
/// specified path.
|
||||||
class PluginCompromisedEachWithPathAndroidProject
|
class PluginCompromisedEachWithPathAndroidProject
|
||||||
|
Loading…
x
Reference in New Issue
Block a user