• 林洵锋's avatar
    Adjust the position of require File.expand_path (#141521) · f340d207
    林洵锋 authored
    On `Podfile`:
    
    ```ruby
    flutter_application_path = '../flutter_module'
    load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
    
    target 'OCProject' do
      # Comment the next line if you don't want to use dynamic frameworks
      use_frameworks!
    
      # Pods for OCProject
      # install_all_flutter_pods(flutter_application_path)
      # install_flutter_engine_pod(flutter_application_path)
      # install_flutter_application_pod(flutter_application_path)
      install_flutter_plugin_pods(flutter_application_path)
    
    end
    
    post_install do |installer|
      flutter_post_install(installer)
    end
    ```
    Encountering the following error after executing `pod install`:
    
    ```shell
    pod install
    
    [!] Invalid `Podfile` file: undefined method `flutter_relative_path_from_podfile' for #<Pod::Podfile:0x000000010e74c520 @defined_in_file=#<Pathname:/Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile>, @internal_hash={}, @root_target_definitions=[#<Pod::Podfile::TargetDefinition label=Pods>], @current_target_definition=#<Pod::Podfile::TargetDefinition label=Pods>>
    
      relative = flutter_relative_path_from_podfile(export_script_directory)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
    
     #  from /Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile:17
     #  -------------------------------------------
     #    # install_flutter_plugin_pods(flutter_application_path)
     >    install_flutter_application_pod(flutter_application_path)
     #
     #  -------------------------------------------
    ```
    
    The `flutter_relative_path_from_podfile` method is in `flutter_tools/bin/podhelper.rb`, but now `flutter_tools/bin/podhelper.rb` is only required in `install_all_flutter_pods` in `podhelper.rb.tmpl`.
    
    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.
    
    [Shorebird - Code Push In Hybrid Apps](https://docs.shorebird.dev/guides/hybrid-app/ios)
    
    So I adjust the position of `require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)`.
    f340d207
Name
Last commit
Last update
.github Loading commit data...
.vscode Loading commit data...
bin Loading commit data...
dev Loading commit data...
examples Loading commit data...
packages Loading commit data...
.ci.yaml Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CODEOWNERS Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
PATENT_GRANT Loading commit data...
README.md Loading commit data...
TESTOWNERS Loading commit data...
analysis_options.yaml Loading commit data...
dartdoc_options.yaml Loading commit data...
flutter_console.bat Loading commit data...