Unverified Commit aff69e43 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Add integration_test to flavor test project (#92520)

parent b78505d9
// This xcconfig used for both the paid and free flavor, but the plugins are not different between
// them. Pick one.
#include? "Pods/Target Support Files/Pods-Free App/Pods-Free App.debug free.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"
// This xcconfig used for both the paid and free flavor, but the plugins are not different between
// them. Pick one.
#include? "Pods/Target Support Files/Pods-Free App/Pods-Free App.release free.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug Free' => :debug,
'Debug Paid' => :release,
'Release Free' => :release,
'Release Paid' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Free App' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
target 'Paid App' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
...@@ -4,4 +4,7 @@ ...@@ -4,4 +4,7 @@
<FileRef <FileRef
location = "group:Runner.xcodeproj"> location = "group:Runner.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace> </Workspace>
...@@ -9,6 +9,8 @@ dependencies: ...@@ -9,6 +9,8 @@ dependencies:
sdk: flutter sdk: flutter
flutter_driver: flutter_driver:
sdk: flutter sdk: flutter
integration_test:
sdk: flutter
test: 1.17.12 test: 1.17.12
_fe_analyzer_shared: 29.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" _fe_analyzer_shared: 29.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
...@@ -64,6 +66,10 @@ dependencies: ...@@ -64,6 +66,10 @@ dependencies:
webkit_inspection_protocol: 1.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" webkit_inspection_protocol: 1.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
yaml: 3.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" yaml: 3.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
flutter_test:
sdk: flutter
flutter: flutter:
uses-material-design: true uses-material-design: true
......
...@@ -275,7 +275,7 @@ class CocoaPods { ...@@ -275,7 +275,7 @@ class CocoaPods {
final String includeFile = 'Pods/Target Support Files/Pods-Runner/Pods-Runner.${mode final String includeFile = 'Pods/Target Support Files/Pods-Runner/Pods-Runner.${mode
.toLowerCase()}.xcconfig'; .toLowerCase()}.xcconfig';
final String include = '#include? "$includeFile"'; final String include = '#include? "$includeFile"';
if (!content.contains(includeFile)) { if (!content.contains('Pods/Target Support Files/Pods-')) {
file.writeAsStringSync('$include\n$content', flush: true); file.writeAsStringSync('$include\n$content', flush: true);
} }
} }
......
...@@ -287,6 +287,32 @@ void main() { ...@@ -287,6 +287,32 @@ void main() {
expect(releaseContents, isNot(contains('#include?'))); expect(releaseContents, isNot(contains('#include?')));
expect(releaseContents, equals(legacyReleaseInclude)); 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', () { group('Update xcconfig', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment