Skip to content

Commit cf708ce

Browse files
committed
👽 Migrate files to compatible with Flutter 1.20.0 .
1 parent de829b8 commit cf708ce

File tree

3 files changed

+35
-67
lines changed

3 files changed

+35
-67
lines changed

example/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
# Flutter/Dart/Pub related
2424
**/doc/api/
25+
**/ios/Flutter/.last_build_id
2526
.dart_tool/
2627
.flutter-plugins
2728
.flutter-plugins-dependencies
@@ -33,5 +34,11 @@
3334
# Web related
3435
lib/generated_plugin_registrant.dart
3536

37+
# Symbolication related
38+
app.*.symbols
39+
40+
# Obfuscation related
41+
app.*.map.json
42+
3643
# Exceptions to above rules.
3744
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

example/ios/Podfile

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -10,81 +10,32 @@ project 'Runner', {
1010
'Release' => :release,
1111
}
1212

13-
def parse_KV_file(file, separator='=')
14-
file_abs_path = File.expand_path(file)
15-
if !File.exists? file_abs_path
16-
return [];
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
1717
end
18-
generated_key_values = {}
19-
skip_line_start_symbols = ["#", "/"]
20-
File.foreach(file_abs_path) do |line|
21-
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22-
plugin = line.split(pattern=separator)
23-
if plugin.length == 2
24-
podname = plugin[0].strip()
25-
path = plugin[1].strip()
26-
podpath = File.expand_path("#{path}", file_abs_path)
27-
generated_key_values[podname] = podpath
28-
else
29-
puts "Invalid plugin specification: #{line}"
30-
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
3122
end
32-
generated_key_values
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
3324
end
3425

26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
3530
target 'Runner' do
3631
use_frameworks!
3732
use_modular_headers!
38-
39-
# Flutter Pod
4033

41-
copied_flutter_dir = File.join(__dir__, 'Flutter')
42-
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
43-
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
44-
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
45-
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
46-
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
47-
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
48-
49-
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
50-
unless File.exist?(generated_xcode_build_settings_path)
51-
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
52-
end
53-
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
54-
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
55-
56-
unless File.exist?(copied_framework_path)
57-
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
58-
end
59-
unless File.exist?(copied_podspec_path)
60-
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
61-
end
62-
end
63-
64-
# Keep pod path relative so it can be checked into Podfile.lock.
65-
pod 'Flutter', :path => 'Flutter'
66-
67-
# Plugin Pods
68-
69-
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
70-
# referring to absolute paths on developers' machines.
71-
system('rm -rf .symlinks')
72-
system('mkdir -p .symlinks/plugins')
73-
plugin_pods = parse_KV_file('../.flutter-plugins')
74-
plugin_pods.each do |name, path|
75-
symlink = File.join('.symlinks', 'plugins', name)
76-
File.symlink(path, symlink)
77-
pod name, :path => File.join(symlink, 'ios')
78-
end
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
7935
end
8036

81-
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
82-
install! 'cocoapods', :disable_input_output_paths => true
83-
8437
post_install do |installer|
8538
installer.pods_project.targets.each do |target|
86-
target.build_configurations.each do |config|
87-
config.build_settings['ENABLE_BITCODE'] = 'NO'
88-
end
39+
flutter_additional_ios_build_settings(target)
8940
end
9041
end

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,22 @@
240240
files = (
241241
);
242242
inputPaths = (
243+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
244+
"${PODS_ROOT}/../Flutter/Flutter.framework",
245+
"${BUILT_PRODUCTS_DIR}/camera/camera.framework",
246+
"${BUILT_PRODUCTS_DIR}/device_info/device_info.framework",
247+
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
248+
"${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework",
249+
"${BUILT_PRODUCTS_DIR}/video_player/video_player.framework",
243250
);
244251
name = "[CP] Embed Pods Frameworks";
245252
outputPaths = (
253+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
254+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/camera.framework",
255+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework",
256+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
257+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework",
258+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player.framework",
246259
);
247260
runOnlyForDeploymentPostprocessing = 0;
248261
shellPath = /bin/sh;
@@ -307,7 +320,6 @@
307320
/* Begin XCBuildConfiguration section */
308321
249021D3217E4FDB00AE95B9 /* Profile */ = {
309322
isa = XCBuildConfiguration;
310-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
311323
buildSettings = {
312324
ALWAYS_SEARCH_USER_PATHS = NO;
313325
CLANG_ANALYZER_NONNULL = YES;
@@ -384,7 +396,6 @@
384396
};
385397
97C147031CF9000F007C117D /* Debug */ = {
386398
isa = XCBuildConfiguration;
387-
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
388399
buildSettings = {
389400
ALWAYS_SEARCH_USER_PATHS = NO;
390401
CLANG_ANALYZER_NONNULL = YES;
@@ -440,7 +451,6 @@
440451
};
441452
97C147041CF9000F007C117D /* Release */ = {
442453
isa = XCBuildConfiguration;
443-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
444454
buildSettings = {
445455
ALWAYS_SEARCH_USER_PATHS = NO;
446456
CLANG_ANALYZER_NONNULL = YES;

0 commit comments

Comments
 (0)