Last active
March 16, 2022 13:22
-
-
Save yonat/2d0194220e02a44f0b8b4202994d8921 to your computer and use it in GitHub Desktop.
Change any Xcode build setting in fastlane
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Change a value in xcodeproj file." | |
desc "Usage: fastlane change_build_value xcodeproj:<file-name> name:<build-setting> from:<old-value> to:<new-value>" | |
lane :change_build_value do |options| | |
xcodeproj = options[:xcodeproj] | |
name = options[:name] | |
from = options[:from] | |
to = options[:to] | |
optional_quotes = '"\\{0,1\\}' | |
replacement_expression = "s/#{name} = #{optional_quotes}#{from}#{optional_quotes};/#{name} = #{to};/g" | |
sh("sed -i '' '#{replacement_expression}' ../#{xcodeproj}/project.pbxproj") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment