I\'m setting up Jenkins to automate the build process. In particular, for my needs, I\'d like to be able to set different bundle identifiers.
I\'m using the Xcode J
Refer to this for a simple solution to replace $PRODUCT_BUNDLE_IDENTIFIER using shell command like -
sed -i '' 's/com.example.oldbundleid/com.example.newbundleid/g' project.pbxproj
You can pass your variables accordingly using Jenkins/Shell.
Alternative approach to do this is using mod-pbxproj.
python -m mod_pbxproj -b -af PRODUCT_BUNDLE_IDENTIFIER=com.example.newbundleid -rf PRODUCT_BUNDLE_IDENTIFIER=com.example.oldbundleid project.pbxproj All
//edit
Old bundle id can be fetched by -
awk -F '=' '/PRODUCT_BUNDLE_IDENTIFIER/ {print $2; exit}' project.pbxproj
This can be stored in a string variable and used in place of com.example.oldbundleid