简体   繁体   中英

Ignoring library .xcodeproj file changes

In my iOs app i'm using a static library from google. I have the source pulled from their git repository and i've linked the project as a subproject of my App.

I needed to change some build flags and settings on the library project settings about skipping install. But now the entire project won't commit because i cannot commit the library project file. I want to keep the library connected to their repository to be able to get new updates.

Of course i can uncheck the checkbox mark, but are there other solutions?

You need to fork the lib project and add it like a submodule, so you can make changes to the lib, ad adding an upstream from the original repo you can fetch changes from it and keep the lib updated. Here the github help page about fork a repo , and here an article about submodules

After that you forked the lib as explained in the github page it's easy...

if your projet is a git project, add a submodule, in the shell from your git porject root

// git submodule add git://forkPath.git destinationFolder
// like this
git submodule add git://github.com/chneukirchen/rack.git rack

now you need to init and update your project submodule, just like this

git submodule init
git submodule update

if your project is a SVN project or something similar, clone the fork somewhere outside the root of your project (maybe at the same level) :

// git clone git://forkPath.git
git clone git://github.com/chneukirchen/rack.git

and now you just need to link the forked project to your project, importing classes etc...

UPDATE A FORK:

from the submodule project folder...

entering the root of the submodule you are into a different git repo, to add the remote upstream that is the original repo:

// git remote add upstream https://originalRepo.git
git remote add upstream https://github.com/octocat/Spoon-Knife.git

now you have to pull the changes from the upstream and merge the changes

git fetch upstream
git merge upstream/master

now make you can make all the changes that you want and just commit

git commit fileToCommit.m -m 'a comment'

and push to the fork project

git push 

or if you are working in a specific branch

git push origin/master

Build scripts can probably help you out:

  • leave the location of your current google library project as is

  • write a script that git updates that folder, and is run on every build. With a dated "flag" file, the script can be written to only really update the folder once a day

  • write another script that for every import file other than the the project file, copies it to a second folder

  • put the project file you want to use in this second folder

  • remove the original references to the master library folder, then import the new second folder.

Voila, now you have updated source files and the modified project file. If the build ever breaks due to say a new file getting added, you can then copy the modified original to your second folder, change the settings as you want.

For tracking changes, you can use git submodules, or even better - Cocoapods (if possible). Also, you can use XCode workspaces and keep the library as a "parallel" project inside the workspace, instead of making it a subproject - this made things simpler in my case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM