xcodebuild default build path - ios

I'm trying to make a FAT framework following this guide
What I'd like to understand is the xcodebuild build path. Based on that tutorial, this is created at the beginning:
BUILD_PATH="${SRCROOT}/build"
Now when I make a build, the builds for Release-iphoneos and Release-iphonesimulator go into that build folder. Is this a predefined variable that can be set to tell Xcode where your builds can go? Because based on this other tutorial: BUILD_DIR gets passed to xcodebuild.
I was wondering what the difference is here and how Xcode handles these arguments.
How does setting this directory work with DerivedData?
Also on the topics of building, does Xcode cache builds? Sometimes after I build and do a ls -al on my frameworks, they don't have current timestamps. But once I delete the build directory, it seems to force Xcode to build again and then I get "fresh" frameworks created. Is Xcode caching the build and not replacing the build? Is there a way to force it?

Related

There are missing files when I archived from custom build configuration

We have different build configurations in our project, like the release, debug, sandbox, etc. The interesting case is when I archived from the release or debug build configuration, all archive files extracted as expected as shown in Image 1, but If I change build configuration to sandbox, some files and folders are missing as shown in Image 2.
Although we created custom build configurations by duplicating from debug or release, the archive doesn't contain all files or folders like in Image 1.
We use carthage(for internal network) and cocoapods(for others) as a dependency manager.
I tried many suggestions but couldn't find a solution.
Like,
setting skip install to NO in build settings,
removing all archive and derived data files, clean and re-archive,
giving the archive folder to read & write permission
Thank you all
If you're using Carthage for internal frameworks you should have same custom build configurations for them, too. Otherwise, it will bootstrap with Release configuration automatically which won't generate SwiftSupport files etc.
You also can avoid this by adding below before archiving in your custom configurations.
carthage bootstrap --configuration Debug
You should make sure that those files are included in Build Phases -> Copy Bundle Resources

Force copy bundle resource of a file in Xcode's new build system

I'm using the Xcode new build system and within the build system, I have a script that creates a file.plist with it as the explicit output and another script that takes in file.plist as input and modifies the file.plist. Then I put file.plist into the Copy Bundle Resources Phase.
This way works generally for clean builds and in Xcode builds. But it doesn't work in fastlane because the script to modify file.plist runs but the changes do not get copied over into the build directory. Making it run in fastlane requires a clean to occur before building.
Does anyone have experience with this issue and how did you go about solving this problem?

`xcodebuild archive` always performs a clean build

Every time I run xcodebuild ...params... archive it performs a clean build without reusing the cache from a previous build.
While I understand the motivation behind it, it has serious consequences on my CI build times because I generate an IPA for every push. Since my workspace has a Pods project (unlikely to change between commits) and an App project (changing all the time) I'm looking for a way to cache the Pods compilation phase somehow – which xcodebuild archive doesn't seem to allow.
Is there a way to force using the cache when archiving? Is there any other way to cache the archived version of Pods?

Xcode commandline building with dependent project

I'm building a iOS application that uses a library that I've built using jverkoey's framework structure. All is well and good, until I try to let my CI environment (Jenkins) build my project. Jenkins builds using the commandline and when it does so my dependent framework gets built in it's own build directory, and when my main application builds in it's own directory it can't find the framework.
As a test I copied the output from my dependent frameworks build directory into the main apps build directory and re-ran my commandline build and everything works fine. So what I think I have to do is update my Jenkins build scripts to be able to move the dependent build output before building the main app, or change them to all build in the same directory as XCode does from the IDE with it's DerivedData directory.
The question is, how? I'm no expert when it comes to building from the commandline and I could really use some help here.
Ok, I figured this out. Just incase anyone else has a similar problem you can set the SYMROOT setting to whatever directory you want when running xcodebuild.
xcodebuild -target MyTarget SYMROOT=/Build/MyProj/Sym.root

How do you determine the build options that XCode uses so you can use them with xcodebuild?

I want to build my iOS projects with xcodebuild, but to do so I need to figure out all the flags and options that XCode is using to build my project when I build and run in XCode.
How can I find out what compilation flags and such XCode is using during the build process, so that I can figure out the equivalent xcodebuild command? I'm especially interested in getting this to work when I'm including external libraries like RestKit in my project.
All you need to do is tell xcodebuild the target and the configuration; everything else is contained in the project relating to the configuration.
See the manpage.

Resources