problems with continuous integration in xcode 5 - continuous-integration

I am just learning how to setup my continuous integration bots in xcode 5 and having a really bad time. First, I was having problems with code signing identities, but after reading this great blog post, that problem disappeared.
Post:
http://matt.vlasach.com/xcode-bots-hosted-git-repositories-and-automated-testflight-builds/#comment-21
Now, after fixing those errors, other errors appeared. Every time I integrate, I get a warning like this:
The file "Pods.xcconfig" couldn't be opened because there is no such file.
And I also get an error, saying a header for a pod is not found. I assume this error is a consequence of the previous warning.
Everything works perfect locally, running on devices, archiving, the problem only happens when i try to integrate with the bots.
Should I add something to the PodFile? or is it something on the osx server itself?
I really need help before I go crazy about this!!
Thank you.

Better solution is to add a new scheme, which is used only via server (duplicate your normal scheme). Then select option manage schemes, expand 'build' and add new Pre-action with following code:
cd ${SRCROOT}
echo "Installing Pods"
pod install
You can update and many other things over here. The only problem is that the build where it updates has old content, you have to once again tap integrate. Remember to keep this scheme shared.
--edit--
You ofc have to commit this and run bot on this scheme (you can change it in your server -> safari local xcode bot url -> settings -> scheme.

You are receiving this error because your mac server doesn't have the pods created in the directory that the Xcode bot is checking them out into. This is as expected because it would be odd to check-in the results of the pod install into your source control system. I wasn't able to find a way for the BOT to run the pod install/update commands so I came up with the following workaround:
Ensure your bot is configured to NOT clean before each integration
Run your bot then search through the resulting logs for the path that files are being checked out to.
Search for "IDEDerivedDataPathOverride" That path will end in /DerivedData, if you look in the parent folder of that you will see a "source" folder. This is where your bot will continue to checkout updates for your project
Note: The source directory is owned by your server user, you will need to access it as that user. Use the su command to do so
Install cocoapods on your mac server if you haven't already
On the mac server, in the source directory found above, navigate to where your Podfile is located
Run pod install and ensure all your specified pods are installed
Double check the file permissions of the newly created pod directories and ensure they are owned by the same user as the other files. Use chown to fix if necessary
Fire off the Bot and watch it complete successfully!
The only issue with this solution is that if a clean is ever performed you will need to run pod install again. This was good enough for tonight, I'll have to look for a way to script the pod install later utilizing the Pre-actions in the Build section of the Scheme used in the bot definition.

Related

Failing to deploy a Course Builder on Google App Engine

I am really not sure what I am doing. I have no idea what is coding , and I never used the terminal on my Mac. I am trying to set up a Course Builder on Google App Engine, and the instructions are telling to to follow these steps:
Deploy from Mac and Linux:
Open a command prompt and get to your coursebuilder directory. Type the following command:
bash ./scripts/deploy.sh <your_project_id>
If your deployment was successful, you can visit your new site.
That is what I am getting:
elena$ bash ./scripts/deploy.sh on-point-learning
bash: ./scripts/deploy.sh: No such file or directory
I am completely lost, is there anyone who can help me? And please in English, I speak no Computer, even using the Terminal makes my hands sweaty and my heartbeat unstable.
p.s.: I do apologize and maybe this questions was answered before but I understand nothing in the questions/answers I read.
First, you need to have downloaded and installed the Google App Engine SDK. Follow all the steps documented by Google here. You need to follow all the steps so that all the files are installed/copied and the necessary shortcuts created
Your course builder will be in a folder (directory)
a) Open command line and change directory to your project folder i.e. something like cd <path_to_project_folder>
b) Type gcloud app deploy
Note: Google's documentation says - Use the install script to add Cloud SDK tools to your PATH. You need to make sure you do that so that typing commands in your command line will work
If you do not want to tinker with your command line or you want to make things very very simple, then you can try using a GUI, for example our App, NoCommandLine
a) Select File > Add Existing Application
b) Navigate to your Course Builder Folder and select the file named app.yaml
c) Select your programming language and the framework (if neccessary), click on Add.
d) To run your project (on your local machine) or deploy it to Production, you just select it from the UI, and click the run or deploy icon.

How can I install a Mac provisioning profile in AzureDevops?

We have previously been using the "Install Apple Provisioning Profile" task in our Azure Pipeline build to install a Mac provisioning profile *.provisionprofile. (https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/install-apple-provisioning-profile?view=azure-devops)
However, as of today the build is failing during the Pre-job step with the following error:
##[error]Error: Provisioning profile file should have the extension '.mobileprovision'
Having checked, I don't think that we've changed anything to affect this, so I was wondering if this is an outside change to the step, and if anyone knows of a work-around?
(For mobile development the provisioning profile file would be *.mobileprovision, but the Mac development ones aren't so I don't know if changing the file extension would work?)
I've posted the question here too on the Azure pipelines tasks github (related to the InstallAppleProvisioningProfileV1 task): https://github.com/microsoft/azure-pipelines-tasks/issues/13104
It looks like the issue has been fixed already in their repository, and we need to wait to get the next update.
I'll update the reply if the instructions change at all, but it looks like we may get the fix on the next release.

I'm getting a "The sandbox is not in sync with the Podfile.lock" error

I'm getting a "The sandbox is not in sync with the Podfile.lock" error. I have tried uninstalling and reinstalling Cocoapods several times to no success. It looks like the install worked as when I open the workspace file I have two projects that appear, the one I built and one named "Pods". And under the "Pods" project when I select the Target, I see that the environment variables are there, "Pods_Root" and others. I think I need to add the "$(inherited)" to my main project, the one I built but I am not sure where. I am using XCode 8.
Any help would be great as I have tried most of the items I have seend.

xcodebuild says does not contain scheme

I have a curios issue.
I have a project that I've worked on and always built from the XCode IDE, and it worked fine. Now I'm setting up Bamboo to build the project and as such am building it from the command line.
The issue is, if I check my code out of GIT and then use xcodebuild to build it it says that the scheme cannot be found, but if I open the project, it builds and if I then try to build it again from the command line with the same command, it works.
What magic is XCode doing when I open the project or am I doing something dumb, maybe excluding a file in my .gitignore that I shouldn't?
You are definitely on the right track with respect to the .xcscheme file -- I had this problem appear while setting up my own projects!
For posterity, or at least anyone getting here from a search, here are two versions of things -- the "I'm busy, so just the facts please" version and a more involved discussion and rationale. Both of these versions assume you are trying to build from a Workspace file; if you aren't then my apologies as this mostly applicable to workspace-based projects.
Condensed 'Fix-it' Version
The root cause is that the default behavior of Schemes is to keep schemes 'private' until they are specifically marked as shared. In the case of a command-line initiated build, the Xcode UI never runs and the xcoderun tool doesn't have its own cache of Schemes to work with. The goal is to generate, share, and commit the scheme you want Bamboo to run:
On a clean working copy of the code, open your Project's workspace.
Choose Scheme > Manage Schemes... from the Product Menu.
The list of Schemes defined for the project appears.
Locate the Scheme Bamboo is trying to run
Ensure the 'Shared' box is checked for that scheme and that the 'Container' setting is set to the Workspace and not the project file itself.
Click 'OK' to dismiss the Manage Schemes sheet.
A new .xcscheme file has been created in your project at WorkspaceName.xcworkspace/xcshareddata/xcschemes.
Commit this file to your repository and run a Bamboo build.
Deeper Discussion and Rationale
Xcode 4 introduced Workspaces and Schemes as a way to help try and tame some of the chaos that is inherent to dealing with the mechanics of wiring related Xcode projects, build targets, and build configurations together. The workspace itself has its own set of configuration data that describes each of the smaller 'boxes' of data it contains and acts as a skeleton for attaching .xcodeproj files and a set of shared configuration data that gets mirrored to each developer machine or CI system. This is both the power and pitfall of Workspaces -- there are 1) lots of ways in which one can get things configured 100% correctly, but put into the wrong container or 2) put into the correct container, but configured improperly thus rendering data inaccessible by other parts of the system!
The default behavior of Xcode 4 schemes is to automatically generate new schemes as projects are added to the Workspace file. Those of you that have added several .xcodeproj files may have noticed that your scheme list quickly becomes unruly especially as project files are added, then removed, and then readded to the same workspace. All schemes, autogenerated or manually created, default to being 'private' schemes visible only to the current user even when .xcuserdata files are committed with the project's data and configuration. This is the root cause of that cryptic build error Bamboo reports from xcodebuild -- Because Bamboo operates the build through the command line and not the Xcode UI, it doesn't have an opportunity for Schemes to get automatically generated and relies only on those that are defined in the workspace itself. Assuming you've configured Bamboo to build from a workspace using a command like this:
xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyApplication -configuration Debug
xcodebuild goes looking for file <'scheme' Parameter Value>.xcscheme existing at <'workspace' Parameter Value>/xcshareddata/xcschemes.
Obviously there are bunches of ways in which one could configure both Bamboo and a workspace, so keep in mind that your unique configuration may not map 100% to what is presented here. The key takeaways:
Certain automated tasks the Xcode UI magically takes care of are not available via the Xcodebuild CLI.
You can attach scheme and build configuration data to many places in the 'container hierarchy' -- Make sure your data winds up in the right container (Workspace, Project, and/or Build Target)
Consider where in the container hierarchy the xcodebuild tool may be looking for configuration data; a great indicator of where it will start looking is based on the use of '-workspace' or '-project' arguments.
The 'Shared' box is already checked...now what?
I encountered this same issue on my own Bamboo instance; it turned out that the scheme that was committed in my repository was outdated and the latest version of the command line tools wasn't handling it gracefully. Since this existed previously, I took a look through the settings to make sure there wasn't anything glaringly custom about the scheme, deleted and recreated the scheme ensuring that I marked it as 'Shared', and recommitting the new .xcscheme file to the repository.
If everything looks good and rebuilding it doesn't solve the issue, double check that container setting -- it is really easy to get that scheme attached to the wrong container in the hierarchy!
Debug the issue like this:
xcodebuild -list
or if you are using a workspace (e.g. with pods)
xcodebuild -workspace MyProject.xcworkspace -list
If you scheme is not listed fix like so:
Most of the answers would suggest you to make your scheme shared using Xcode, then commit changes to repo. That works, of course, but only if you have access to source code and have rights to commit changes, and couple of other assumptions.
But there's a number of "what ifs" to consider
What if you just can't modify the Xcode project for some reason?
What if you create a new scheme automatically on CI server? This actually happens quite often. If you use test automation framework, like Calabash, you'll normally end up duplicating an existing target, which automatically duplicates a scheme as well, and the new scheme is not shared, even if the original scheme was.
Ruby & xcodeproj gem
I would recommend using xcodeproj Ruby gem.
This is a really cool open source tool that can help you to automate tons of Xcode-related tasks.
Btw, this is the gem used by CocoaPods to mess around with your Xcode projects and workspaces.
So install it
sudo gem install xcodeproj
Then write a simple Ruby script to re-share all the schemes, the gem has recreate_user_schemes method for that purpose
#!/usr/bin/env ruby
require 'xcodeproj'
xcproj = Xcodeproj::Project.open("MyProject.xcodeproj")
xcproj.recreate_user_schemes
xcproj.save
It doesn't just copy scheme files form user's folder to xcshareddata/xcschemes, it also creates those files first by parsing the pbxproj file.
Ok I know its 2 minutes later but I found another stack overflow that says the scheme has to be set to shared... Where does Xcode 4 store Scheme Data?
One common reason for the scheme to be missing is forgetting to push the commits to the origin. If you get a missing scheme message, you should first verify the scheme is shared, then verify you have committed the changes AND pushed them to the origin server.
I had this error while implementing CI.The Question above is identical to my problems except I am using Gitlab's own CI tool.You can check if there is any such file in Bamboo.
I solved it by making some changes to gitlab-ci.yml file.
After you hav made your scheme availabe by sharing. In Xcode Go to Products>Scheme>Manage Scheme and check share to share.
Changes
Set absolute path everywhere.
eg.xcodebuild clean archive -archivePath /path/to/your/project/build/testDemo -scheme testDemo | xcpretty
here you need to change /path/to/your/project/ with your path and testDemo with your project name.
I faced this issue and even if some of the answers here actually provide the solution, I didn't find it very clear. So I will just add one more. In a nutshell how to share a schema from excode.
Navigate to Product > Scheme > Manage Schemes
You will then be shown a list of schemes, with each denoted as being shared or not. Just check the ones that you want to share (it may be different ones for dev and prod builds)
Images taken from this article https://developer.nevercode.io/docs/sharing-ios-project-schemes
Got the same problem but during building with xcode as subproject of main one. Built subproject in xcode standalone - after that this error disappeared.
I want to add solution for my case related to this thread. This one is for you who clone existing project, with all the schemes you need are already being shared:
, with fastlane lanes correctly display all your lanes including all your schemes:
, but fastlane gym only show main schemes (not dev and test schemes):
The solution is to uncheck the shared option for schemes that not listed by fastlane gym and then check it again. It will generates .xcscheme for the schemes:
Now, if you check with fastlane gym, all the schemes will be listed:
Then you should commit those .xcshemes file to the repository, so other developer who clone the project will get the files.
For anyone with Xcode 11.4 trying to find "Shared" button on scheme, it's now moved into the individual scheme.
Select the scheme you want
Press "Edit"
Check the "Shared" box

Xcode fails without specifying and errors

All of a sudden my project fails to build in Xcode. If I look at the log I see all the needed dependencies being built, and then I get a strange error:
Verify final result code for the complete build operation
Build operation failed without specifying any errors.
Individual build tasks may have failed for unknown reasons.
I removed my code directory and replaced it with a backup, did a clean, tried building all the other components separately (they succeed) - nothing works. I tried a command line build, same issue.
There were only a few hits on google for this error, none offered any useful advice.
Can anyone please help?
Update: When I run the command line build, I see the following error:
2012-05-25 08:55:53.830 xcodebuild[3358:4203] No recorder, buildTask: <Xcode3BuildTask: 0x400f35e60:'ProcessPCH MyProject-Prefix.pch':REfc(32370056113422336):deps=0:phaseNum=4>
I checked the output of xcodebuild and it is returning '65'.
I thought there might be a problem with the MyProject-Previx.pch file, so I shut off "Precompile Prefix Header", and now I get the same error with a different file:
2012-05-25 09:15:11.784 xcodebuild[3882:3703] No recorder, buildTask: <Xcode3BuildTask: 0x40048ab60:'CompileC HelperRoutines.m':REfc(33777199068741632):deps=0:phaseNum=4>
Build operation failed without specifying any errors. Individual build
tasks may have failed for unknown reasons. One possible cause is if
there are too many (possibly zombie) processes; in this case,
rebooting may fix the problem. Some individual build task failures (up
to 12) may be listed below.
I've run into this problem consistently recently while running Xcode 9.0 Beta 3 and Xcode 8.3.3.
The fix is to delete ALL in the Derived Data folder. It then seems to work again.
rm -rf ~/Library/Developer/Xcode/DerivedData
NOTE: just cleaning the build or deleting the current build folder for a project does not seem to help.
Hope this helps :)
I was hitting this error and it infuriated me for an hour or so. The answer below helped me out a lot: essentially your machine has a ton of running processes, XCode can't handle it, and rebooting your machine is the best answer.
https://stackoverflow.com/a/13183522/1863655
I looked around for a bit and the only one that worked for me was shortening my project folder name.
All other tries: restarting, recloning, deleting derived data, etc. didn't work. The only thing that worked was making the project folder name shorter.
I also encountered same error. I was edited .pch (Prefix Header) file. Then I started getting this strange error.
Then I removed all editions which I made in .PCH.
Then I quit my Xcode.
When I restarted Xcode this strange error was gone.
Hope this will work for you also.
Best luck Buddy (y)
Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie) processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.
This happens occur when the total path length is too long.
change the folder name or location of directory, shorter then before.
Happy 2019, everyone, but sad to say this can still happen in Xcode 10.2.
I had four projects open in Xcode but only one failed in this way. I tried a main menu > Product > Clean Build Folder. The little progress spinner started up and 5 minutes later was still spinning. Hmmmm.
So I quit Xcode and in Terminal did a cd ~/Library/Developer/Xcode/DerivedData. Although ls -alww showed only one subfolder named after each of my other projects, as expected, there were five subfolders whose name began with the name of the problem project. I deleted all of them
rm -R ProblemProjectName-*
and relaunched Xcode. Problem solved.
Mine gave this error sometimes, also LLVM failed with exit code 1 and clang failed with exit code 255, at different code locations each time. I just had to reboot (OS X 10.7, Xcode 4.5).
I rebooted, no luck. Then I noticed that when I relaunched XCode, one of my tabs was loaded with no file in it. I figured out what file I was editing in it, opened it, saved it and then I was able to build.
None of these answers worked for me on XCode 5.
Luckily, I'm still only testing XCode 5 - I kept XCode 4 around.
XCode 5 simply won't build one of my two projects, claiming that my libraries aren't built with the right settings, and I keep running into the error described on this page on the other one... so I'm sticking with XCode 4, which builds both of my projects perfectly well.
If you are experiencing this issue on XCode 5, consider "reverting to XCode 4" as another strategy.
Overall the idea that repeatedly running a program, XCode or not, degrades your system to the point where you have to reboot does not fill me with confidence in that program.
With Xcode 5.0.0, this error was caused after an update to the CLI tools.
Updating to Xcode 5.0.1 and installing all the required components again still didn't fix the error. However, 5.0.1 was kind enough to actually emit an error that was useful.
/bin/mkdir -p /Users/xxx/Documents/XCode/SampleApp/bin/SampleAppDebug.app/Contents
error: (null)
This lead me to look at the bin folder, and find out that the 5.0.0 build with broken CLI tools had made a symlink in bin/ to the derived information folder with SampleAppDebug.app, which for some reason it could not write to.
I manually removed all contents of the bin/ folder and rebuilt without errors.
I faced same problem. I have change my System time.I delete file "/Users/YOURNAME/Library/Developer/Xcode/DerivedData/ModuleCache/YOURBUNDLEID/UIKit.pcm". Then it's work fine for me. Try this.
I added into the Framework search paths the header file location.... removing this from the top level project settings fixed the issue for me.
Change at your peril.
The only workaround, that works for me - push your code to git repo and clone it to new location.
I highly recommend to reclone your repo, because you'll deal with some random problems if you prefer rebooting/turning off and onXcode.
did you set "Perform Single-Object Prelink" to Yes?
try turn it off.
i had the similar problem. i have tons of files in a static library. reducing the number of files or setting "Perform Single-Object Prelink" to NO solved my problem.
Same error and following didn't work for me for Xcode 6.3.2 on Mac OS X Yosemite 10.10.3:
Git discarded changes to last successful build point
Creation of new fresh project from scratch from a builtin template (though I cannot recall whether it built successfully or not)
Restart of Xcode
System Reboot
and the following worked:
I faced the problem in the morning and it got resolved in the evening with a couple of Xcode restarts and System reboots and creation of new project. So, I'm not sure what really triggered.
I faced the same problem today. Cleaning the DerivedData and cloning the project somewhere else didn't help. What fixed my problem was repairing the volume from the Disk Utility app and removal of all Xcode plugins.
I have encountered same issue without having any code changes for my project running on Xcode 9.2. It looks like if you have some run scripts or external build systems attached to the project, this might cause an issue. Try committing or discarding changes and build again. If it still persist, delete local repo and clone again. Also maintain smaller folder names for project location.
Same issue when added watchOS target inside iOS app, using Xcode 11.1 with SwiftUI:
Go to menu Xcode / Preferences / Locations
Open Derived Data folder in Finder clicking on the arrow next to /Users/yourUserName/Library/Developer/Xcode/DerivedData
Locate your app Derived Data folder and delete it
Menu Product / Clean Build Folder
You should be able to compile again.
I know this is super late to answer but I'm answering since none of the above solutions worked.
For me restarting, clean building, deleting derived data nothing worked.
Because the issue was not due to any zombie objects or something like that.
I'm using Xcode 11. I think it's an Xcode bug that sometimes errors are not shown in the issue navigator. But don't worry check the build report in Report navigator(The last tab in project navigator: the one that looks like a comment box with lines in it. or simply cmd + 9).
Click the relevant build and resolve the issue, mine was missing file in pods directory.
just try to rename the folder name of the project. it did the trick for me
I had this same problem, however the accepted solution did not work for me, what worked was:
deleting .workspace file
deleting Podfile.lock file
deleting the Pods folder
pod deintegrate ; pod install
For me it was fixed by changing to the new build system(in File -> Project settings)
I have Xcode 11.7

Resources