How do I prevent xcodebuild in Xcode 9 from creating extraneous metadata files? - xcodebuild

After the upgrade to Xcode 9 on our TeamCity-based CI Server, xcodebuild no longer exports ONLY the .ipa artifact. It now also creates three meta-data files that I'd prefer it not create.
com.mycompany.ourapp.ipa
DistributionSummary.plist
ExportOptions.plist
Packaging.log
Is there a way to tell xcodebuild I only want the .ipa? I could of course delete the three meta-data files in a post-build shell script, but it'd be cleaner if xcodebuild never created them in the first place.

Related

Built two different Debian packages for different Build Types using CMake

I have a small CMake project with different Build Types debug and release. I'm also providing a Debian package for this project. Building the Debian Package for release and providing it on my own Debian repository works perfect.
Now I also want to provide another Debian package for debug, due to debugging purposes, with a different package name. For example, my project is called myproject, and the debugging package should be myproject-debug.
I already read documentation about how to solve this in the debian/control file. I want to use Replaces: ... on each package vice versa, so that you can install only one of the both packages at a time. So either myproject or myproject-debug, but not both at the same time, to use the exact same files and filenames but only the binary has more debugging informations and debug prints in the myproject-debug package. Everything else should be the same. Same filename, same paths, etc.
Now the problem is that I don't know how the debian/rules file should look like, to first build the myproject package in a folder and then build the myproject-debug with different CMake options (-DCMAKE_BUILD_TYPE=debug) in a different folder, so the filenames can and should stay the same.
There is this CMake tutorial in the Debian documentation, but this doesn't fit my requirements. Because in this tutorial everything will be built in only one folder, and in this one folder there are different files. Then different .install files will be used to copy the needed files to each package. But since I have the same binary filename for each package myproject and myproject-debug this tutorial does not really fit my needs.
I already have the following lines in my debian/rules file:
override_dh_auto_configure:
dh_auto_configure -- -DCMAKE_BUILD_TYPE=release
But how can I run two different builds with two different build types?
For example, something like this, to split it up:
override_dh_auto_configure_release:
dh_auto_configure -- -DCMAKE_BUILD_TYPE=release
override_dh_auto_configure_debug:
dh_auto_configure -- -DCMAKE_BUILD_TYPE=debug
And run both in different folders so I can add both folders to two different packages.
Or maybe there is even a better solution I cannot imagine yet?

xcodebuild setting parameter equivalent in Xcode GUI build?

I have an Xcode workspace. The workspace has multiple projects. Each project has at least 1 target.
The command xcodebuild allows you to add setting parameters on the command line. These settings are passed to all targets.
For example, I can build everything in the workspace by doing this:
xcodebuild -scheme KitchenSink build BOB=newhart
And the setting BOB=newhart will be passed to every project.
What is the equivalent of this when choosing Product | Build from the Xcode menu bar (pressing Command+B)?
Some points:
I would prefer not to edit every project.
I created an xcconfig file named "Global", but how do I get the Xcode build process to use it for all targets?
The Build section when editing a scheme does not contain a way to attach xcconfig files.
When I select Global.xcconfig in the Navigator pane, and look at the File Inspector in the Utilities pane, I do not see a way to add that file to any targets.
The xcconfig file is only part of the workspace. It is not part of any 1 project.
I'm not certain the use of xcconfig files is how to accomplish what I want; I'm just explaining what I've tried.

Xcode custom shell scripts are slowing down the compiling time

Testing any changes to my Xcode project has become an exercise in patience whenever I build. After all the source files have compiled, I get the following message in the activity window at the top of Xcode:
"Running 3 of 3 Custom Shell Scripts"
I have not added any of my own custom shell scripts but I am using quite a few dependencies via Cocoapods and I am using 2 frameworks for the build environment, Crashlytics and Tapstream. Crashlytics requires you add a run script in the build phases, other than that I don't know where the other ones are coming from and they appear to be the bottleneck in my build time.
Can anyone enlighten me as to what is going on and how i possibly speed it up?
I can't enlighten you but I can tell you how I stopped mine from running. This also happened after installing Cocoapods. In my main project's Target, under Build Phases, I noticed two entries entitled Check Pods Manifest.lock and another called Copy Pods Resources.
Under both there was an unchecked option Run script only when installing. I checked both and at least for now my projects build and run fine without running the scripts.
This is kind of a crappy answer because I can't really give you any more information, and it might not even work for your case, so hopefully someone comes along and enlightens us.
POSSIBLE EXTERNAL BUNDLE ISSUES
So I just had a frustrating experience debugging an issue where a pod installed library's NSLocalized strings file weren't working. Turns out it was because I checked the option mentioned above. Pods-resources.sh, which had the lines to install the bundle, wasn't running in debug mode. It was only running when installing - of course! Something to watch out for.
More info in this question:
NSLocalizedStringFromTable not working in CocoaPod dependency
To fix the slow "Copy pods resources" problem I figured out a solution to only copy the resources if they haven't been copied before.
For this purpose we have to patch the *-resources.sh files that are created by cocoapods such that the copy procedure only happens if a generated file in the target directory doesn't exist (it is created upon first copy). As long as this target directory exists and includes this autogenerated file, the copy resources phase is skipped. This saves me about 30 seconds in my project (of course depends on your project size). To accomplish this do the following:
Create a patch file called 'copy_pod_resources_once.patch' in your project root dir with the following contents:
5a6,13
> NONCE_FILE="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/copyresources-done.nonce"
> if [ -f "$NONCE_FILE" ]; then
> echo "already copied resources"
> exit 0
> else
> touch "$NONCE_FILE"
> fi
>
In the Podfile for your project add the following post install hook:
post_install do |installer_representation|
system('find "./Pods/Target Support Files" -name "*-resources.sh" | xargs -I{} patch -p0 {} -i ./copy_pod_resources_once.patch')
<other post install stuff>
end
For me, it was Crashlytics. There were some outstanding changes, as Crashlytics does auto-updating of its files. I reset/removed them and rebuilt and got past it.
So the general answer may be to check any third party components and make sure they're working properly.
As Ramsel has said in this answer,
https://stackoverflow.com/a/21318086/1752988
I also went to Build Phases and cleared out all the possible links to PODs, after trying most of the other solutions and the three build issues shown regarding Pods were cleared out.
But then one file which was not list under the XCode Project navigator was missing, but they were in the Downloaded Git Zip folder! Obviously, I copied it and put into the XCode project and try running it runs cleanly! :)
I had a similar issue in my project (however not using Cocoapods). It ended up being an issue with an application external to Xcode (Spritebuilder) somehow holding onto a resource within my Xcode project when it crashed. I forced the non-xcode application to close and now the issue is gone
Check your project folder name have any space.Because space creates problem in directory path like "SRCROOT".I removed spaces and project run fine.
I've found that this happens to me frequently. Exact cause unknown, but appears to be switching between git branches that have differences in what pods are being used. In my case simply touching the Pods-xxx-Resources.sh shell script file causes it to speed back up.
Probably not going to work for you, but cleaning the project fixed it for me (Product -> Clean)

How do I copy the Release folder contents to a secondary location?

I am brand new to using TeamCity.
I have my .NET C# application building via a MSBuild "build step" in TeamCity. Once it is built, I would like TeamCity to copy the entire contents of the "Release" folder to a secondary location where we keep current and recent builds.
I cannot build to this location directly because there are other files which my application requires (databases, XML config files, etc..) that reside permanently in the Debug and Release folders. I know this is horrible and I would need a soapbox to complain about the decisions my predecessor made, but for not I am forced to keep that portion as-is.
You can add a command line build step with a simple xcopy command.
It will be executed only when every previous build step succeeds.

How do I archive multiple targets with one action in xcode 4

I have a project with multiple targets that are all for different iOS Apps. For instance one traget for the lite version and another one for the pro version.
I want to build and archive all of my Apps at once. Currently I have a scheme for every target which I use to archive each app independently. But now I have to start the archiving, wait until it is done and then start the next one.
Is there a way to archive all apps with one single action in xcode 4 or using the command line?
The Build action in a scheme dictates what targets are built for what actions. Leave the defaults (so they'll all be built for the Archive action). When that scheme is active, it'll build all the requested targets just prior to archiving when you select Product -> Archive.
You could create a new scheme called "All", edit it, then in its Build action, add all targets you want to archive. Then just select that scheme and ask it to archive.
Alternatively, add all targets to your existing scheme and uncheck unwanted actions for which it should build those extra targets, leaving only Archive.
You can use xcodebuild from the commandline
e.x.
xcodebuild -configuration Release -project MyProject -scheme MyProjectScheme clean build
Also you can use xcrun to build an ipa from the commandline as well, see:
https://stackoverflow.com/a/4198166/618419