Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: Adding WorkspaceSettings.xcsettings to source control

In Xcode, changing settings in File > Workspace Settings... are stored for each Xcode user separately. I want workspace settings to be set the same for all users. My goal it to have the built targets to be copied in the same relative directory.

By default workspace settings are stored in:

[WorkspaceName].xcworkspace/xcuserdata/[UserName].xcuserdatad

I want the ability make this shared across all users so I can add it to version control.

like image 629
Nikolozi Avatar asked May 28 '12 02:05

Nikolozi


People also ask

How to Add remote repository Xcode?

Go to Source Control in Xcode and select Projectname -- master, then Configure... In the Address field, paste the Git clone URL for your repo copied in the previous step. Select Add Remote, then select Done to finish creating the origin remote for your local Git repo.

How to change Git remote in Xcode?

As mentioned in "Git XCode - change origin ", you simply can change the remote origin url, using git remote set-url (or in your case, rename+add). If that private repo is empty, you can push to the full history of your cloned repo.

Should .xcodeproj be in Git?

xcodeproj file, yes, you should include it in your repository.


1 Answers

We ended up writing a small bash script that performed four default write commands to set the correct settings

scriptPath="$(dirname "$0")"
cd "$scriptPath"
fullPath=$(pwd)
settingsFile="$fullPath"/<project>.xcworkspace/xcuserdata/$USER.xcuserdatad/WorkspaceSettings.xcsettings

cp -f "$settingsFile" "$settingsFile.plist"

defaults write "$settingsFile" BuildLocationStyle CustomLocation
defaults write "$settingsFile" CustomBuildLocationType RelativeToWorkspace
defaults write "$settingsFile" CustomBuildProductsPath "Build/Products"
defaults write "$settingsFile" CustomBuildIntermediatesPath "Build/Intermediates"

cp -f "$settingsFile.plist" "$settingsFile"
like image 132
Paul Delivett Avatar answered Oct 15 '22 21:10

Paul Delivett