Ios 颤振中的新Podfile格式-如何实现与以前相同的效果?

Ios 颤振中的新Podfile格式-如何实现与以前相同的效果?,ios,flutter,dart,podfile,Ios,Flutter,Dart,Podfile,自从最新的颤振版本以来,Podfile有了新的结构。对于ffmpeg包,我必须向pod文件添加一些附加包。但对于新版本,我不知道如何处理这个问题 这是所需零件的旧结构 # Plugin Pods # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # referring to absolute paths on developers' machines. system('rm -rf .

自从最新的颤振版本以来,
Podfile
有了新的结构。对于
ffmpeg
包,我必须向pod文件添加一些附加包。但对于新版本,我不知道如何处理这个问题

这是所需零件的旧结构

  # Plugin Pods

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.each do |name, path|
    symlink = File.join('.symlinks', 'plugins', name)
    File.symlink(path, symlink)
    if name == 'flutter_ffmpeg'
        pod name+'/full-gpl-lts', :path => File.join(symlink, 'ios') // I need this!
    else
        pod name, :path => File.join(symlink, 'ios')
    end
  end
我是如何尝试将其放入新结构的

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  symlink = File.join('.symlinks', 'plugins', 'flutter_ffmpeg')
  File.symlink(path, symlink)
  pod 'flutter_ffmpeg/https-gpl', :path => File.join(symlink, 'ios')
end
但是我不能让它工作。我得到的错误
[!]无效
Podfile
file:file存在@syserr\u fail2\u in-.symlinks/plugins/flatter\u ffmpeg.

您知道如何以新的
Podfile
格式编写此文件吗?

似乎改变了flatter工具中的Podfile结构。 它介绍

def flutter_install_all_ios_pods(ios_application_path = nil)
  flutter_install_ios_engine_pod(ios_application_path)
  flutter_install_ios_plugin_pods(ios_application_path)
end
发生的是您的代码

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  symlink = File.join('.symlinks', 'plugins', 'flutter_ffmpeg')
  File.symlink(path, symlink)
  pod 'flutter_ffmpeg/https-gpl', :path => File.join(symlink, 'ios')
end
flatter\u ffmpeg的符号链接已经由flatter\u install\u all\u ios\u pods和pod创建

我会做什么

我不知道移除豆荚的方法,也不想使用fork Flitter的podhelper,所以我会复制他们的方法,如下所示:

# Create this "fork" of flutter_install_ios_plugin_pods
def install_plugin_pods(ios_application_path = nil)
 # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
  ios_application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file)
  raise 'Could not find iOS application path' unless ios_application_path

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.

  symlink_dir = File.expand_path('.symlinks', ios_application_path)
  system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.

  symlink_plugins_dir = File.expand_path('plugins', symlink_dir)
  system('mkdir', '-p', symlink_plugins_dir)

  plugins_file = File.join(ios_application_path, '..', '.flutter-plugins')
  plugin_pods = flutter_parse_plugins_file(plugins_file)
  plugin_pods.each do |name, path|
    symlink = File.join(symlink_plugins_dir, name)
    File.symlink(path, symlink)

    # Changes relative to flutter_ffmpeg
    if name == 'flutter_ffmpeg'
        pod name+'/https-gpl', :path => File.join('.symlinks', 'plugins', name, 'ios')
    else
        pod name, :path => File.join('.symlinks', 'plugins', name, 'ios')
    end
  end
end

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  # Remove this line
  # flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  flutter_install_ios_engine_pod(File.realpath(__FILE__))
  install_plugin_pods(File.realpath(__FILE__))
end
我明天才能测试,到时候我会更新这篇文章。

似乎就是那个改变了颤振工具中podfile结构的人。 它介绍

def flutter_install_all_ios_pods(ios_application_path = nil)
  flutter_install_ios_engine_pod(ios_application_path)
  flutter_install_ios_plugin_pods(ios_application_path)
end
发生的是您的代码

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  symlink = File.join('.symlinks', 'plugins', 'flutter_ffmpeg')
  File.symlink(path, symlink)
  pod 'flutter_ffmpeg/https-gpl', :path => File.join(symlink, 'ios')
end
flatter\u ffmpeg的符号链接已经由flatter\u install\u all\u ios\u pods和pod创建

我会做什么

我不知道移除豆荚的方法,也不想使用fork Flitter的podhelper,所以我会复制他们的方法,如下所示:

# Create this "fork" of flutter_install_ios_plugin_pods
def install_plugin_pods(ios_application_path = nil)
 # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
  ios_application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file)
  raise 'Could not find iOS application path' unless ios_application_path

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.

  symlink_dir = File.expand_path('.symlinks', ios_application_path)
  system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.

  symlink_plugins_dir = File.expand_path('plugins', symlink_dir)
  system('mkdir', '-p', symlink_plugins_dir)

  plugins_file = File.join(ios_application_path, '..', '.flutter-plugins')
  plugin_pods = flutter_parse_plugins_file(plugins_file)
  plugin_pods.each do |name, path|
    symlink = File.join(symlink_plugins_dir, name)
    File.symlink(path, symlink)

    # Changes relative to flutter_ffmpeg
    if name == 'flutter_ffmpeg'
        pod name+'/https-gpl', :path => File.join('.symlinks', 'plugins', name, 'ios')
    else
        pod name, :path => File.join('.symlinks', 'plugins', name, 'ios')
    end
  end
end

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  # Remove this line
  # flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  flutter_install_ios_engine_pod(File.realpath(__FILE__))
  install_plugin_pods(File.realpath(__FILE__))
end
我明天才能测试,到时候我会更新这篇文章