-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust the position of require File.expand_path #141521
Conversation
@@ -112,6 +110,8 @@ def flutter_root | |||
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why this shouldn't be at the top of the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line of code must be placed after the flutter_root
method, otherwise the following error will be reported.
❯ pod install
[!] Invalid `Podfile` file: undefined local variable or method `flutter_root' for main:Object
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
^^^^^^^^^^^^.
It is also used like this in Podfile-ios-objc
.
flutter/packages/flutter_tools/templates/cocoapods/Podfile-ios-objc
Lines 13 to 26 in 67457e6
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I see, makes sense
@jmagman this code change seems ok to me, but probably more important, is this a supported workflow? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes we only need to use the install_flutter_plugin_pods method in podhelper.rb. For example, using Shorebird in an iOS hybird app scenario, we need to build Flutter.xcframework and App.xcframework and embed them into the iOS native project. In order to avoid unnecessary conflicts, use install_flutter_plugin_pods method to install Flutter plugin pods.
@LinXunFeng can you explain this a bit more, I'm curious. Is the scenario that your hybrid app uses CocoaPods and needs the same pods between the native app and the Flutter module? So you'd rather pod install
run only once and deal with all the version solving so they don't conflict? Or is there something else going on?
is this a supported workflow?
It's not "supported" but I wouldn't go out of my way to break it. This change LGTM.
|
||
podfileContent = podfileContent.replaceFirst(''' | ||
install_all_flutter_pods flutter_application_path | ||
''', ''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, thank you so much for the test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jmagman According to the various ways to integrate the Flutter module introduced in the document, our app initially used
When using the above command, Shorebird will use its own modified Flutter framework and engine to build In my Flutter module, I use some Flutter plugins based on native third packages, such as Pod::Spec.new do |s|
s.name = 'sqflite'
...
s.dependency 'FMDB', '>= 2.7.5'
...
end When using The following error will occur when compiling. Showing Recent Messages
Multiple commands produce '/Users/lxf/.../xxx.app/Frameworks/FMDB.framework' And the Pod::Spec.new do |s|
s.name = 'realm'
...
s.vendored_frameworks = 'realm_dart.xcframework'
...
end Related feedback: #125530 I also tried to embed these I have tried putting the Even if the above problem was solved, our app would crash as soon as it started. After investigation, I found that it was because dyld[31764]: Symbol not found: _$s12ReachabilityAAC10ConnectionO4wifiyA2DmFWC
Referenced from: <8142F86E-4C9C-3513-AD29-D3522FC6677F> /Users/lxf/.../connectivity_plus.framework/connectivity_plus
Expected in: <DA318000-9A97-35AD-87EA-7C5B635DE010> /Users/lxf/.../Frameworks/Reachability.framework/Reachability In addition, we also need to determine whether each Related feedback: #122183 Based on so many problems mentioned above, I finally chose to create a |
ad3d363
to
fd8b6bc
Compare
flutter/flutter@ddf60fb...5dea6b9 2024-01-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 2b31ad2fb819 to a7b207d5a1fe (1 revision) (flutter/flutter#141945) 2024-01-21 christopherfujino@gmail.com [flutter_tools] update analyze_once_test.dart to be null-safe (flutter/flutter#141790) 2024-01-21 linxunfeng@yeah.net Adjust the position of require File.expand_path (flutter/flutter#141521) 2024-01-21 yjbanov@google.com Add RadioListItem use-case to a11y_assessments (flutter/flutter#140984) 2024-01-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 704ef3399012 to 2b31ad2fb819 (1 revision) (flutter/flutter#141937) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC dit@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…#5951) flutter/flutter@ddf60fb...5dea6b9 2024-01-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 2b31ad2fb819 to a7b207d5a1fe (1 revision) (flutter/flutter#141945) 2024-01-21 christopherfujino@gmail.com [flutter_tools] update analyze_once_test.dart to be null-safe (flutter/flutter#141790) 2024-01-21 linxunfeng@yeah.net Adjust the position of require File.expand_path (flutter/flutter#141521) 2024-01-21 yjbanov@google.com Add RadioListItem use-case to a11y_assessments (flutter/flutter#140984) 2024-01-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from 704ef3399012 to 2b31ad2fb819 (1 revision) (flutter/flutter#141937) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC dit@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
On
Podfile
:Encountering the following error after executing
pod install
:The
flutter_relative_path_from_podfile
method is influtter_tools/bin/podhelper.rb
, but nowflutter_tools/bin/podhelper.rb
is only required ininstall_all_flutter_pods
inpodhelper.rb.tmpl
.Sometimes we only need to use the
install_flutter_plugin_pods
method in podhelper.rb. For example, usingShorebird
in an iOS hybird app scenario, we need to buildFlutter.xcframework
andApp.xcframework
and embed them into the iOS native project. In order to avoid unnecessary conflicts, useinstall_flutter_plugin_pods
method to install Flutter plugin pods.Shorebird - Code Push In Hybrid Apps
So I adjust the position of
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
.Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.