Add integration_test to flavor test project (#92520)

This commit is contained in:
Jenn Magder
2021-10-27 12:53:05 -07:00
committed by GitHub
parent b78505d9b1
commit aff69e43ef
10 changed files with 304 additions and 10 deletions

View File

@@ -275,7 +275,7 @@ class CocoaPods {
final String includeFile = 'Pods/Target Support Files/Pods-Runner/Pods-Runner.${mode
.toLowerCase()}.xcconfig';
final String include = '#include? "$includeFile"';
if (!content.contains(includeFile)) {
if (!content.contains('Pods/Target Support Files/Pods-')) {
file.writeAsStringSync('$include\n$content', flush: true);
}
}

View File

@@ -287,6 +287,32 @@ void main() {
expect(releaseContents, isNot(contains('#include?')));
expect(releaseContents, equals(legacyReleaseInclude));
});
testUsingContext('does not include Pod config in xcconfig files, if flavor include present', () async {
final FlutterProject projectUnderTest = setupProjectUnderTest();
projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
const String flavorDebugInclude = '#include? "Pods/Target Support Files/Pods-Free App/Pods-Free App.debug free.xcconfig"';
projectUnderTest.ios.xcodeConfigFor('Debug')
..createSync(recursive: true)
..writeAsStringSync(flavorDebugInclude);
const String flavorReleaseInclude = '#include? "Pods/Target Support Files/Pods-Free App/Pods-Free App.release free.xcconfig"';
projectUnderTest.ios.xcodeConfigFor('Release')
..createSync(recursive: true)
..writeAsStringSync(flavorReleaseInclude);
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.directory('project'));
await cocoaPodsUnderTest.setupPodfile(project.ios);
final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync();
// Redundant contains check, but this documents what we're testing--that the optional
// #include? doesn't get written in addition to the previous style #include.
expect(debugContents, isNot(contains('Pods-Runner/Pods-Runner.debug')));
expect(debugContents, equals(flavorDebugInclude));
final String releaseContents = projectUnderTest.ios.xcodeConfigFor('Release').readAsStringSync();
expect(releaseContents, isNot(contains('Pods-Runner/Pods-Runner.release')));
expect(releaseContents, equals(flavorReleaseInclude));
});
});
group('Update xcconfig', () {