podspec中引用父级目录的功能代码

遇到了一个问题,多平台共用一套功能代码,但是source_files 不支持..

🏷️ 第一种解决方案:将功能代码复制到podspec同级下

假设功能代码在internal目录下,且internalpodspec同级

只需在podspec文件中修改如下

s.source_files     = 'Classes/**/*', 'internal/*'

再执行pod install 即可

🏷️ 第二种解决方案:为功能代码创建podspec ,在需要的地方,直接引入功能代码的podspec

假设创建的podspeccommon_sharedcodes.podspec ,内容如下

#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint lscam_timeline_locator.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
  s.name             = 'common_sharedcodes'
  s.version          = '0.0.1'
  s.homepage         = 'http://www.example.com'
  s.source           = {
    :path => '.' }
  s.author           = {
    'example' => 'email@example.com' }
  s.summary          = 'A posepc for common shared codes.'
  s.description      = <<-DESC
A posepc for lscam_timeline shared codes.
                       DESC
  s.license          = {
    :file => 'LICENSE' }
  
  # s.dependency 'FlutterMacOS'
  # s.platform = :osx, '10.11'
  # s.swift_version = '5.0'
  
  s.source_files     = 'internal/*.{cpp,hpp}'
  s.public_header_files = 'internal/*.h'
  s.pod_target_xcconfig = {
   
    'HEADER_SEARCH_PATHS' => '$(inherited) "internal/*.h"',
  }
end

在需要的地方,引用方式如下

  • podfile
target 'Runner' do
  use_frameworks!
  use_modular_headers!
  
	# 此处 path 为common_sharedcodes.podspec所在的目录
  pod 'common_sharedcodes', :path => '/workspace/project'

  flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end
  • podspec
s.dependency 'common', '~> 0.0.1'

再执行pod install 即可

参考链接

https://github.com/CocoaPods/CocoaPods/issues/1259

相关推荐

  1. podspec引用目录功能代码

    2024-02-19 21:22:01       51 阅读
  2. rust 文件引用目录同级目录之间引用

    2024-02-19 21:22:01       47 阅读
  3. C++ 引用

    2024-02-19 21:22:01       62 阅读
  4. c++引用(&)

    2024-02-19 21:22:01       57 阅读
  5. C++引用

    2024-02-19 21:22:01       48 阅读
  6. C++引用

    2024-02-19 21:22:01       46 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-19 21:22:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-19 21:22:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-02-19 21:22:01       87 阅读
  4. Python语言-面向对象

    2024-02-19 21:22:01       96 阅读

热门阅读

  1. python 将普通文件转换为ts文件,用udp-ts 发送

    2024-02-19 21:22:01       60 阅读
  2. TP-LINK路由器的IPTV功能测试验证

    2024-02-19 21:22:01       224 阅读
  3. Linux 目录磁盘满了,怎么查找大文件

    2024-02-19 21:22:01       39 阅读
  4. python函数的定义和调用

    2024-02-19 21:22:01       50 阅读
  5. LeetCode 2824.统计和小于目标的下标对数目

    2024-02-19 21:22:01       53 阅读
  6. 力扣:139. 单词拆分

    2024-02-19 21:22:01       45 阅读
  7. rust的哈希表

    2024-02-19 21:22:01       48 阅读
  8. CSS background-size

    2024-02-19 21:22:01       56 阅读