fastlane を介してプリプロセッサ マクロを動的に追加/削除する必要があります。カスタム値をカスタム フィールド (ユーザー定義) に追加することはできますが、フラグを に追加することはできませんでしたActive Compilation Conditions
。
ここに私の関連レーンがあります - >
fastlane_version "2.6.0"
fastlane_require "xcodeproj"
lane :write_to_build_settings do |options|
project = Xcodeproj::Project.open(
File.join(File.expand_path('..'), ENV["XCODEPROJ_NAME"])
)
target = project.targets.find { |t| t.name == options[:target] }
if options[:configuration].nil?
target.build_configurations.each do |c|
c.build_settings[options[:field]] = options[:value]
# This is what I've tried and I want!!
# Maybe I should use `build_configuration` instead of `build_settings`
c.build_settings[options["CUSTOM_FIELD"]] = "CUSTOM_VALUE"
end
else
configuration = target.build_configurations.find { |c|
c.name == options[:configuration]
}
configuration.build_settings[options[:field]] = options[:value]
# This is what I've tried and I want!!
# Maybe I should use `build_configuration` instead of `build_settings`
if options[:option_to_add_flag]
puts "option_to_add_flag: true"
configuration.build_settings[options["CUSTOM_FIELD"]] = "CUSTOM_VALUE"
end
###
end
project.save
end