Avoid duplicating Pods-Runner xcconfig #includes (#75822)
This commit is contained in:
parent
cc95c972b7
commit
ba5e237e24
@ -274,9 +274,10 @@ class CocoaPods {
|
||||
final File file = xcodeProject.xcodeConfigFor(mode);
|
||||
if (file.existsSync()) {
|
||||
final String content = file.readAsStringSync();
|
||||
final String include = '#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.${mode
|
||||
.toLowerCase()}.xcconfig"';
|
||||
if (!content.contains(include)) {
|
||||
final String includeFile = 'Pods/Target Support Files/Pods-Runner/Pods-Runner.${mode
|
||||
.toLowerCase()}.xcconfig';
|
||||
final String include = '#include? "$includeFile"';
|
||||
if (!content.contains(includeFile)) {
|
||||
file.writeAsStringSync('$include\n$content', flush: true);
|
||||
}
|
||||
}
|
||||
|
@ -260,6 +260,34 @@ void main() {
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testUsingContext('does not include Pod config in xcconfig files, if legacy non-option include present', () async {
|
||||
projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
|
||||
|
||||
const String legacyDebugInclude = '#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig';
|
||||
projectUnderTest.ios.xcodeConfigFor('Debug')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync(legacyDebugInclude);
|
||||
const String legacyReleaseInclude = '#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig';
|
||||
projectUnderTest.ios.xcodeConfigFor('Release')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync(legacyReleaseInclude);
|
||||
|
||||
final FlutterProject project = FlutterProject.fromPath('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('#include?')));
|
||||
expect(debugContents, equals(legacyDebugInclude));
|
||||
final String releaseContents = projectUnderTest.ios.xcodeConfigFor('Release').readAsStringSync();
|
||||
expect(releaseContents, isNot(contains('#include?')));
|
||||
expect(releaseContents, equals(legacyReleaseInclude));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
});
|
||||
|
||||
group('Update xcconfig', () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user