How to avoid build and lipo of Universal Framework everytime project is built? - ios

I have a project that uses a custom framework I've built. This framework provides a clean API based on Objective-c which hides c++ code.
The framework has a universal builder target that uses a Run Script to run xcodebuild and then lipo the binaries for the framework to include.
I realize that the project always wastes a lot of time calling the universal builder target which builds and lipos the binaries. My question is how can I avoid xcodebuild and re-lipo if the source files if they haven't changed?

Well, after much research and getting down and dirty I realized two things.
I did not need a universal build script target. The reason being that the framework project was included on the app I was working with. So xCode automatically is building the correct architecture for the framework. This speeds up the build process since now framework building will only happen when something changes.
So if you are still in need of using a universal build script use the Input Files and Output Files to define your script variables. This then allows xCode to check if the files need to be built and thus executing the script. More on that here: https://patrickbalestra.com/blog/2018/08/27/improving-your-build-time-in-xcode-10.html

Related

Slow compile times with react-native iOS app

I am currently working on a react-native iOS app. While developing I noticed that the compile times for the app are really slow. I got a CI hooked up which roughly does the following:
clean git checkout of the applications workspace
run unit tests
run UI tests build the app
Since this is a clean checkout the app always recompiles all of the react static libraries which come with the React.xcodeproj like libyoga.a, libReact.a, etc. This means that a clean CI build roughly takes ~8min only to build all of the react dependencies (~4min * 2 because the UI test target rebuilds React again).
I wondered whether it would be possible to speed up the compile times. I came up with the following idea but need your advice to tell me if it would work or if I am on the wrong track.
Compile all static libraries for iphoneos and iphonesimulator
Put them together in a single file via lipo
Move them to a folder
Put that folder into version control
Link the libraries in that folder into the Xcode project
This way it would only be necessary to build a new set of static libraries if I update the react-native version in the package.json, right ?
Another idea which came to my mind is to build a dynamic framework of react-native. The framework could be build only once and then added to the application via carthage or manually. The dynamic framework would link all the react static libraries and add the correct headers to the header search paths.
Does anyone can give me a hint if this could work or has an idea how to improve the build architecture in order to speed up the compile time ?
Check these two checkbox
1 Show environment variables in build log
2 Run script only when installing
but when you run first time then uncheck it because this load script for first time otherwise you can not open get loading script in packager.

Building and debugging static library in Xcode using external build system

I'm trying to embed a set of static libraries that are made by an external build system into a project. I can get the external build system to build the libraries just fine in Xcode and I can use them in another project.
However, the project I am compiling (ffmpeg) produces several static libraries and I'm not clear at all how I should set this up in Xcode such that it can be referenced by another project and when I change the ffmpeg source it is rebuilt and can be debugged. Any pointers?

In XCode 6 is there a simple way to build an iOS universal application and 32/64 static library subprojects?

The common wisdom seems to be that to build a subproject as a static library so that it will link and run on all iOS architectures it is necessary to build an Aggregate target for the library, by running a build script which includes a lipo call to package the various binaries.
Is this still necessary in XCode 6?
Setting "Build Active Architecture Only" to NO sounds like it should do this without the need for a separate lipo script or an explicit Aggregate target.

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