From e6d94ee40fa55e7875c95071e3431e7266d5bd92 Mon Sep 17 00:00:00 2001 From: jmagman Date: Wed, 7 Aug 2019 12:59:11 -0700 Subject: [PATCH] Use relative paths when installing module pods (#37738) --- .../library/Flutter.tmpl/podhelper.rb.tmpl | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb.tmpl b/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb.tmpl index fb48b0ca3a..a28ae77f0e 100644 --- a/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb.tmpl +++ b/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb.tmpl @@ -32,7 +32,13 @@ def install_flutter_engine_pod FileUtils.cp(File.join(debug_framework_dir, 'Flutter.podspec'), engine_dir) end - pod 'Flutter', :path => engine_dir, :inhibit_warnings => true + # Keep pod path relative so it can be checked into Podfile.lock. + # Process will be run from project directory. + engine_pathname = Pathname.new engine_dir + project_directory_pathname = Pathname.new Dir.pwd + relative = engine_pathname.relative_path_from project_directory_pathname + + pod 'Flutter', :path => relative.to_s, :inhibit_warnings => true end # Install Flutter plugin pods. @@ -46,9 +52,15 @@ end # MyApp/my_flutter/.ios/Flutter/../.. def install_flutter_plugin_pods(flutter_application_path) flutter_application_path ||= File.join('..', '..') - pod 'FlutterPluginRegistrant', :path => File.join(__dir__, 'FlutterPluginRegistrant'), :inhibit_warnings => true - symlinks_dir = File.join(__dir__, '.symlinks') + # Keep pod path relative so it can be checked into Podfile.lock. + # Process will be run from project directory. + current_directory_pathname = Pathname.new __dir__ + project_directory_pathname = Pathname.new Dir.pwd + relative = current_directory_pathname.relative_path_from project_directory_pathname + pod 'FlutterPluginRegistrant', :path => File.join(relative, 'FlutterPluginRegistrant'), :inhibit_warnings => true + + symlinks_dir = File.join(relative, '.symlinks') FileUtils.mkdir_p(symlinks_dir) plugin_pods = parse_KV_file(File.join(flutter_application_path, '.flutter-plugins')) plugin_pods.map do |r| @@ -79,13 +91,12 @@ def install_flutter_application_pod(flutter_application_path) `echo "static const int Moo = 88;" | xcrun clang -x c -dynamiclib -o "#{app_framework_dylib}" -` end - pod '{{projectName}}', :path => __dir__, :inhibit_warnings => true - - # Use relative paths for script phase paths since these strings will likely be checked into source controls. + # Keep pod and script phase paths relative so they can be checked into source control. # Process will be run from project directory. - current_directory_pathname = Pathname.new __dir__.to_s + current_directory_pathname = Pathname.new __dir__ project_directory_pathname = Pathname.new Dir.pwd relative = current_directory_pathname.relative_path_from project_directory_pathname + pod '{{projectName}}', :path => relative.to_s, :inhibit_warnings => true flutter_export_environment_path = File.join('${SRCROOT}', relative, 'flutter_export_environment.sh'); script_phase :name => 'Run Flutter Build Script',