xcode 7 svn checkout subdirectory - ios

I'm using Xcode 7.2 and about to checkout subdirectory of a svn repository. For example, if a repository path is svn://mysvn.com/svn/trunk/ios/MyXcodeProject, I want to checkout ONLY 'MyXcodeProject' via Xcode and keep it under version control.
I don't want to checkout all of the subdirectories that I don't care under 'trunk', like android, web, documents etc..
I tried Xcode menu > Source Control > Checkout... by entering the whole repository path(svn://mysvn.com/svn/trunk/ios/MyXcodeProject), however it checked out all of the directories under trunk although those are under version control.
I remember the earlier version of Xcode provided subdirectory checkout but it seems Xcode 7.x~ does not.
Are there any person suffering this problem? Which is the best way I can choose?

I had the same problem, I imported it to to root of the repo, so not under /trunk/myapp but to /myapp.
After that I could checkout the project folder successfully.

Related

Save packages downloaded by SPM into project GIT using Xcode 11

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.

Back to Default Git or gitignore settings on XCode project

Because me and my team started playing with the files that were included and ignored on the XCode Commit panel, our project has become very hard to manage on git. Since we added some libraries that we installed through cocoapods into git and uploaded them with the project, we have consistently gotten errors with files that don't show up on the user that pushed it, or other that show as missing for the user that made the pull.
To solve this, I want to take the most up-to-date branch, and reset git or the gitignore file in order to reupload to another origin from scratch, and hopefully have an easier time with our collaboration.
I haven't found a way to do so easily and safely. Is there a way to do so?
Thanks in advance.
If you want to go back to a standard gitignore file for your Xcode project, go to gitignore.io and enter Xcode in the search field. That will generate a standard gitignore file for Xcode projects.
Open up your existing gitignore file in a text editor. Replace the contents with the contents of the file gitignore.io created for you. Commit the gitignore file and push it to your remote repository. Now your team will be working with a standard gitignore file.

XCodeproj empty after cloning from Git

I have an Swift project that utilizes two libraries: the SQLite and SwiftCSV project. They can be found on: https://github.com/stephencelis/SQLite.swift and https://github.com/naoty/SwiftCSV respectively. I followed the instructions on each respective Github README to incorporate the projects into my project which works fine, but when I push my project to Github and I have another teammate of mine clone the project, the SwiftCSV and SQLite projects turn up empty so my teammate has to re-add them into his project. I have been trying to google different responses but maybe I am looking for the wrong keywords. Any ideas on how to fix this?
You should (and may be) adding the above projects to your repo as submodules (if not, read up on them).
If you used submodules, they are not automatically checked out when you clone a repository. You can, however, use clone's --recursive flag to ensure submodules are checked out when someone first clones your project:
git clone --recursive git#github.com:your/project.git
If the project has already been cloned, one can check out the submodules by running the following incantation from within their project directory:
git submodule update --init
Note: Xcode is usually smart about letting you check out submodules from within Xcode itself. Check the Source Control menu and see if SQLite.swift or SwiftCSV show up under Working Copies.
If you merely downloaded the projects and dragged them into your Xcode project (rather than use submodules, as instructed above), they'll likely be referencing directories outside of your project. Make sure you move them to your project's directory before dragging them into your Xcode project. If you don't, the projects will appear red/unavailable on subsequent clones.
usually, xcodeproj is in gitignore, please remove it from .gitignore file

Xcode 6 Embedded Binaries

We are building an iOS 8 app on Xcode 6.1 that has the following project structure -
UI (Git Repo 1)
Framework (Git Repo 2)
Git Repo 2 is added as a submodule to Git Repo 1. The framework project is listed as a "Embedded Binary" under the UI project. We have a couple of problems with this -
The embedded binaries' path is specific to a developer's machine and every developer has to update the path after pulling the latest code from the repo.
If the path above is specific to a particular machine how can we build the code on Jenkins?
Is there a better approach to handle the above situation?
If you define your embedded binaries to be Relative to Build Products, then it doesn't matter what the dev's directory structures look like. This enables you to use Jenkins as you wish.
For one of the projects I'm working on, we are using a workspace versus sub-projects since our different libraries are different git repos than the application itself.
Although this is for swift, this link describes a bit about using the Relative To Build Products.
Swift iOS module not being deployed to expected debug directory

Xcode bot: cloning multiple repositories before build

I have three repositories for my current project. They contain some shareable core functionality and individualized components:
MainApp.git
Components.git
Controls.git
The xcworkspace lies in MainApp.git and links to its own xcodeproj file as well as the other xcodeprojs in the two other repositories.
When creating a bot in Xcode server, there's only the option to select one repository for cloning. This lets the build fail eventually, since it cannot find any resources needed from the Components.git and Controls.git.
How can I achieve a working build with my workspace configuration?
You could:
1) Add all the code to the main repo (I highly advise against it)
2) Use a dependency manager such as Cocoapods, where you would have to create podspecs for your dependencies. If they are open-source great they are probably already in GitHub in Specs. Integration between Xcode bots and Cocoapods is kind of broken right now. You could have a pre-build script running the command:
pod install
Amongst other things. See here
3) Use git submodules. They can give you some headaches but they usually do the job when it comes to managing enterprise dependencies. Once again, unfortunately, they are completely broken in Xcode bots:
Xcode bots with git submodules
Problems with Xcode Bots
The list is large, a mere search on twitter for problems related with git/cocoapods and Xcode bots will show you how frustrating it can be.
My personal opinion, if it is a small project and you want to see what Apple's been up to, Xcode bots are great, also the built-in integration inside the IDE is amazing and something to look for in the upcoming iterations.
However, if the project is complex, with some dependencies, maybe UI Automation, integration with Testflight/HockeyApp, etc, I would go with either Jenkins or Travis CI.
Stick with something that has a great community, years of development, plugins..
I was looking for this answer myself, but was not satisfied with the suggestions.
Turns out, it is possible to do everything inside Xcode with just a little helping from the Terminal.
I detailed it here: http://swiftrien.blogspot.com/2016/04/xcode-server-and-multiple-repositories.html
But will summarise here.
1) Create a workspace directory. None of the projects to-be in the workspace should be in this directory (or any of its subdirectories).
2) Using Xcode, create the workspace. You can add the projects now.
3) Exit Xcode.
4) In Terminal go to the workspace directory and do "$ git init"
5) Add a ".gitignore" file with ".DS_Store" and "xcuserdata".
6) Add the files with "$ git add ."
7) Commit the files with '$ git commit -m "Initial commit"'
8) Exit Terminal, start Xcode and open the workspace
9) Use the "Source Control" menu to verify that you now have a git repo for the workspace.
10) Use the "Source Control" menu to add a remote repo on the server.
11) For all projects, use the "Source Control -> Configure ..." menu to tell Xcode that that repo is necessary to include in the checkout.
You will need to create new bots or upgrade the old ones.
Good luck.

Resources