Cocoapods 编译条件数组处理

2021-08-26  本文已影响0人  Ian_

为什么非要定义一个变量,直接使用config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] += ,说是个String,
直接拼接到 string 上了,很奇怪!

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|

      conditions = ['$(inherited)']

      if config.name.include?("Test")
        conditions += ['TEST']
      end
      
      if config.name.include?("Debug") && config.name != 'Debug'
        conditions += ['DEBUG']
      end

      if target == 'WidgetExtension'
        conditions += ['WIDGET']
      end
      
      config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = conditions
      
    end
  end
end

上一篇 下一篇

猜你喜欢

热点阅读