How to manage external libraries in Xcode/git source control? - xcode

Okay, I'm trying to add Endpoints for Google App Engine to my app project.
The directions for the iOS client code say to download this svn project:
svn checkout \
http://google-api-objectivec-client.googlecode.com/svn/trunk/ \
google-api-objectivec-client-read-only
and then
The static library target should be dragged into your application project's Build Phases "Link Binary with Libraries" list.
As I understand it, for that to be possible, I should be basically following Apple's directions for static library child projects.
But now the Google code is not in my git repository, so when I attempt to clone my project to work on a different branch, it's not included and doesn't come along. And I can't add it to my project without causing an svn error.
What do I do about this? I could do a recursive copy of the code out of the svn working copy and explicitly check it into my git repository, but then it seems like updating to any future versions of that project from Google will be a nightmare. Or are child projects just a bad idea? I've never had good luck with Xcode trying to compile a separate static library and including the binary in my main project -- is that what I need to do?

It looks like you can do this trick to create a git copy of the svn repository, then create a submodule from the git copy:
Is it possible to have a Subversion repository as a Git submodule?

Related

Swift Package Manager - How to add checkouts to source control? [duplicate]

I started using new Xcode 11 which integrates SPM.
I added first dependency to my project:
but detected that files are not fetched into my project folder but into Xcode's cache:
I would like to commit all my dependencies files into my main project repository so my question is:
Is it possible to change location of fetched packages via SPM using Xcode 11?
It's somewhat possible, although the solution isn't necessarily a good or great practice, so I can't recommend.
Set the DerivedData in workspace settings to be relative to the workspace.
Add gitignore rules such that the workspace/WORKSPACE_NAME_DIR/SourcePackages/checkouts and related files are includes. Maybe best to ensure repositories directory is not included.
Add a Run Script phase to remove .git and .gitignore files in the checkouts directory.
Obviously, this is fragile largely through fighting the way SPM works. The workspace settings are per person so it's not great in teams.
SwiftPM integration has been setup to prevent this. It clones the files into a DerivedData/ProjectName-[RandomStuff]. You should commit your Package.resolved into the repo to ensure that you get the same version of each dependency across clones of the project.

Is it possible to include SPM checkouts in Git?

It's possible to store Checkout and Build directories when using CocoaPods and Carthage.
Is this possible using Xcode 11's SPM?
Or, if I could modify the location SPM uses for Checkouts, then I think this could work by setting this directory to somewhere in the workspace's directory structure.
(I'm in the camp that prefers to keep all assets required to build projects in the same Git repo as the project itself. Don't hate me :) )
You can't do this.
See my previous response to this question here.

How to really work in team on React Native project?

How do you work in team on react native projects?
I'm working in Team of 2 people and having a lot of issues with working on the same project.
I don't understand how to properly create an environment so we can sync our code between each other while working on the same project. Now, we create a git repo with /ios and /android folders, but the thing is: the /ios folder always needs to be changed, because it links to the computer that was last building the project.
For example: we are working at the same time on different .js files and add a new npm dependency and we wish to sync our changes, so we commit changes to the Git repo and try to sync, this is where our pains begin.
The one need downloading the changed has to go to Xcode and manually update all the Framework Search Paths, Header Search Paths, delete libraries that Xcode doesn't see and then add them again.
I know it's moreof an Xcode problem, but I didn't see any detailed guide about team syncing in projects. I know that at Facebook people are doing a lot of cooperative work and I'd appreciate some input over our issues!
If you are using git, you can configure your .gitignore-file to prevent committing xcode-specific stuff and other configuration files.
I can highly recommend gitignore.io, which is a "web service designed to help you create .gitignore files for your Git repositories" [Source].
You can for example type in XCode (or AndroidStudio, ReactNative, Gradle, etc.) and it will automagically generate a .gitignore file for you.

XCode 4.3 and SVN

I'm new to iOS developing, I haven't used earlier versions of XCode.
Yet I have stored my project on my local hd. Now I want to use some online subversion service.
I cannot seem to find the appropriate options in XCode. The hints that I googled all refer to a menu called SCM which I don't seem to have.
I created a new and empty repository online (webbased) and tried to configure XCode to use it by selecting the "Connect to a repository" menu when xcode starts. After some tweeking in the command line this "connect to a repository" succeeded but afterwards XCode simply closed itself again.
I tried copying the files that belong to my project to the path that I set up to be used with SVN manually. I opened the project in XCode from that path and after adding another file wanted to commit that change but couldn't find how to do that from within XCode.
Now I found that in XCode / Organizer / Repositories / MyProject is listed but has the type "GIT", which is wrong.
Do I have to change the repository type to SVN instead of GIT? If so, how can I?
When you created the project there was an option to put the project under source control. This option creates a git repository and is checked by default.
To use SVN you have to import your project into the SVN repository. (And you probably don't want it to be under git and svn at the same time, so you'll either delete the .git folder or recreate your project without the scm option selected.) Once the project is imported into your repository then you make sure Xcode knows about the repository and you can check the project out.
But really I'd recommend just using Git. It's a modern version control system with lots of nice features (though to do much of anything out of the ordinary requires using the command line) and there are nice project hosting sites for it like GitHub. I don't think SVN compares very well to git.

How to configure an xcode project to work nicely with SVN?

I'm just getting started with xcode. I created a sample new project, and would like to import it into my svn repository. I configured xcode to be aware of my repository, and xcode claims the it has successfully authenticated the connection.
I cannot, however, seem to figure out how to get my actual xcode project to manage its source in the repository. I select Project Settings -> SCM Repository -> "myrepository". But that doesn't seem to have accomplished anything. When I try to "commit entire project", xcode tells me: "/Users/me/Documents/test1" is not a working copy.
Any ideas? I'm probably missing something obvious, right?
Did you check out your subversion repository folder for your project to your local directory first?
If not, it's not really a working copy at all. A "working copy" is a local checkout of a repository folder, tracked using hidden .svn folders.
If you haven't checked out a repository folder, all you have is a folder. Subversion won't be able to handle that at all.
I suggest you read the Subversion e-book, and specifically the part about working copies.

Resources