Details
-
Type:
Improvement
-
Status: Closed (View Workflow)
-
Priority:
Major
-
Resolution: Fixed
-
Component/s: xcode-plugin
-
Labels:
-
Environment:XCode plugin 1.0.1
Jenkins 1.440
-
Similar Issues:
Description
When building in Xcode, all SYMROOT is set so all binaries for all projects are created in ~/Library/Developer/Xcode/DerivedData/...
This makes linking to dependent projects very easy because all of the dependencies have the same SYMROOT. When running xcodebuild from the command line, SYMROOT can be set to achieve the same behavior. Providing this option would help developers who have framework targets in child projects.
Attachments
Attachments
- xcode-plugin.hpi
- 45 kB
- xcode-plugin.hpi
- 41 kB
- xcode-plugin.hpi
- 41 kB
Issue Links
- is related to
-
JENKINS-12089 Build IPA switch doesn't work properly for a default Xcode project always results in FATAL error
-
- Closed
-
-
JENKINS-11892 Upgrade token macro plugin to version 1.5.1
-
- Closed
-
Activity
I'm not at all a xcode developer but we have to take care that SYMROOT and OBJROOT default values changed between XCode 3 and XCode 4.
I don't know which impact it could have. Myself I'm using this plugin with XCode 4.
Brad, I attached a SNAPSHOT adding the support to set the SYMROOT. Let me know if it is good for you.
Code changed in jenkins
User: Arnaud Héritier
Path:
pom.xml
http://jenkins-ci.org/commit/xcode-plugin/dfd0a84e21cf952f03fc8796ac3681fdc6755e67
Log:
Bump version to 1.1 (JENKINS-11813 is an improvement)
Code changed in jenkins
User: Arnaud Héritier
Path:
src/main/java/au/com/rayh/XCodeBuilder.java
src/main/resources/au/com/rayh/Messages.properties
src/main/resources/au/com/rayh/XCodeBuilder/config.jelly
src/main/resources/au/com/rayh/XCodeBuilder/help-symroot.html
http://jenkins-ci.org/commit/xcode-plugin/3817940a3c020cc420ed2f3b55617d6d6509119e
Log:
JENKINS-11813 : New option to allow to configure SYMROOT (With token macro plugin support)
Compare: https://github.com/jenkinsci/xcode-plugin/compare/dfd0a84^...3817940
2 things...
1) It fails to expand the WORKSPACE build variable. I know it is using the Token Macro Plugin to expand this but it would be nice if it also could look up the environment variables listed at http://ci.jenkins-ci.org/env-vars.html
ERROR: Failure while expanding macros for symRoot. Error: Unrecognized macro 'WORKSPACE' in '${WORKSPACE}/build'
2) I hard-coded the full build path and the build was successful until it tried to create the .IPA
Previously after building the project it code-signed it and verified it:
CodeSign "/Jenkins/workspace/Test Project/build/Ad Hoc-iphoneos/Test Project.app"
Validate "/Jenkins/workspace/Test Project/build/Ad Hoc-iphoneos/Test Project.app"
It reported that the build SUCCEEDED:
** BUILD SUCCEEDED **
Then tried to generate the .ipa and failed:
Cleaning up previously generate .ipa files
FATAL: /Jenkins/workspace/Test Project/build/Ad Hoc-iphoneos does not exist.
/Jenkins/workspace/Test Project/build/Ad Hoc-iphoneos does not exist.
at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:474)
at hudson.FilePath.glob(FilePath.java:1265)
at hudson.FilePath.access$700(FilePath.java:164)
at hudson.FilePath$23.invoke(FilePath.java:1244)
at hudson.FilePath$23.invoke(FilePath.java:1242)
at hudson.FilePath.act(FilePath.java:783)
at hudson.FilePath.act(FilePath.java:765)
at hudson.FilePath.list(FilePath.java:1242)
at hudson.FilePath.list(FilePath.java:1228)
at au.com.rayh.XCodeBuilder.perform(XCodeBuilder.java:295)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:692)
at hudson.model.Build$RunnerImpl.build(Build.java:178)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:462)
at hudson.model.Run.run(Run.java:1404)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)
Not sure what is causing this. It most definitely exists because I can still see it in the workspace. If it makes any difference the Jenkins Master is a Linux machine so this project is run on a Jenkins Slave. Is the FilePath for symRoot not getting set correctly for the slave machine?
Thanks for your work on this. I need to learn more about Jenkins Plugins so I can be more help.
I should also note that if I uncheck Build IPA? everything works fine.
Thanks again.
I need to learn more form XCode dev env to help more :-D
Thx for these feedbacks
1/ About the WORKSPACE env var and others I need to see how to do this. I used the token macro plugin because when I checked to do that without it, the only thing I found was a big part of hardcoded code to search/replace in the String. I will ask to others devs if/how we can do that.
Can you test if ${env:WORKSPACE} works ?
2/ Strange problem. I need to investigate more. I have the configuration : Linux server + Macos agent.
The behavior I have is like you at the end of the app build :
CodeSign "build/Distribution AdHoc-iphoneos/eXo GA .app" ... Validate "build/Distribution AdHoc-iphoneos/eXo GA .app" ... ** BUILD SUCCEEDED **
And then I have
Cleaning up previously generate .ipa files Packaging IPA Packaging eXo GA .app => /Users/mbjenkins/jenkins-agent/workspace/mobile-ios-trunk-ci/sources/build/Distribution AdHoc-iphoneos/eXo_GA_-Distribution_AdHoc-mobile-ios-trunk-ci-242.ipa ....
It seems that in your case it is failing in the "clean previous IPA" part while searching for them. Perhaps you can try to deactivate this option to see what it gives.
I need to study why it is failing.
cheers,
Can you attach a full log of a failing job because of the IPA cleanup
I think I have a bug in how I compute the default build directory
If you don't want to attach them here publicly, can you send me a copy of them by mail : aheritier AT gmail
Cheers
Our Lucky Luke (http://en.wikipedia.org/wiki/Lucky_Luke) aka Kohsuke, the man known to code faster than his shadow just fixed the token macro plugin to allow it to expand all vars like ${WORKSPACE} and others listed here : http://ci.jenkins-ci.org/env-vars.html
I'll integrate it in the next release of the xcode plugin. I will open a new issue for that
The issue to upgrade the token macro plugin : JENKINS-11892
Awesome, good to hear about the Token Macro Plugin. Just FYI ${env:WORKSPACE} did not expand at all.
/usr/bin/xcodebuild -alltargets -configuration "Ad Hoc" build SYMROOT=${env:WORKSPACE}/build
I had a hunch that I decided to test. Based on the following log message
FATAL: /Jenkins/workspace/Test Project/build/Ad Hoc-iphoneos does not exist.
I guessed that the Build .ipa step was using the Master file systems instead of the Slave file system.
So I created /Jenkins/workspace/Test Project/build/Ad Hoc-iphoneos on the Jenkins Master.
Obviously the .ipa wasn't created but the log now shows
** BUILD SUCCEEDED ** Cleaning up previously generate .ipa files Packaging IPA Finished: SUCCESS
Based on that I agree that the problem is "a bug in how I compute the default build directory".
In the changelist above, In XCodeBuilder.java on line 128 you use the hudson.FilePath class. The JavaDoc for that constructor says
To create FilePath that represents a "local" path.
A "local" path means a file path on the computer where the constructor invocation happened.
I think instead you should use the following constructor with base = build.getWorkspace() and rel = symRootValue
public FilePath(FilePath base, String rel)
It says,
Construct a path starting with a base location.
Parameters:
base - starting point for resolution, and defines channel
rel - a path which if relative will be resolved against base
ok, for the Macro I will do more tests with the upgrade of the macro token plugin
For the path you're right. this is my error, I used the wrong constructor. I didn't understand correctly its usage.
I will provide a fix.
Code changed in jenkins
User: Arnaud Héritier
Path:
src/main/java/au/com/rayh/XCodeBuilder.java
http://jenkins-ci.org/commit/xcode-plugin/6840d65bc546fc72af248fb2a065882ab3bf6781
Log:
JENKINS-11813 : Fix how buildDirectory is computed to work with a remote agent
New HPI that should fix the deletion issue on a remote agent
I have confirmed that "Build .ipa?" works with the new xcode-plugin.hpi.
About the macro to access to the workspace the syntax is ${ENV,var="WORKSPACE"}
I'm stupid, I wrote it in the help if you clicked on it
cool. I'm merging that in the master branch and I upgrade the token plugin.
I'll do the release of 1.1 just after
Fixed in 1.1
I'm having this same issue on Mac running Lion.
XcodePlugin: v1.2
Token Macro Plugin: v1.5.1
-
- BUILD SUCCEEDED **
Cleaning up previously generate .ipa files
FATAL: /Users/Shared/Jenkins/Home/jobs/EH-script-xcodePlugin/workspace/build/Release-iphoneos does not exist.
/Users/Shared/Jenkins/Home/jobs/EH-script-xcodePlugin/workspace/build/Release-iphoneos does not exist.
at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:474)
at hudson.FilePath.glob(FilePath.java:1265)
at hudson.FilePath.access$700(FilePath.java:164)
at hudson.FilePath$23.invoke(FilePath.java:1244)
at hudson.FilePath$23.invoke(FilePath.java:1242)
at hudson.FilePath.act(FilePath.java:783)
at hudson.FilePath.act(FilePath.java:765)
at hudson.FilePath.list(FilePath.java:1242)
at hudson.FilePath.list(FilePath.java:1228)
at au.com.rayh.XCodeBuilder.perform(XCodeBuilder.java:356)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:692)
at hudson.model.Build$RunnerImpl.build(Build.java:178)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:462)
at hudson.model.Run.run(Run.java:1404)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238)
Can you attach your logs ? The problem is different, it's not a remote/local issue to compute the path.
Which parameters did you set in your job ?
I think there is a mismatch between the build directory path used in the build and used in the IPA part
Setting symroot = ${WORKSPACE}/build fixed things. I'm just not sure why that's required with the "Build ipa" checked.
What were your others parameters ?
Did you defined the build directory ?
Or none of them (symroot, build dir)
I have something suspect in the code....
Can you test this 1.2.1-SNAPSHOT with your build. I think I fixed a problem when the configuration build direcotry parameter was set.
I can confirm I took a's snapshot and guess what...IT WORKS FOR ME!
aheritier, do you still need me to open a ticket here?
ok, cool
yes please open a ticket with all details you gave in the wiki to have a trace of the problem for the future.
the bug isn't related to this feature.
thx
This is erring again when I set the Configuration parameter.
Parameters:
SYMROOT = ${WORKSPACE}/build/Ad-Hoc
Configuration = Beta
Build output directory = ${WORKSPACE}/build/Ad-Hoc
Error:
Cleaning up previously generate .ipa files
FATAL: /iOS-Project-Beta/workspace/build/Ad-Hoc/Beta does not exist.
Please help. Thanks in advance.
This might be related to JENKINS-12089
Brian, did you gave a try to the latest SNAPSHOT of the plugin attached here ?
I will open a ticket for this problem (It seems that Tzur didn't do it for now). I explained it al little bit more in the plugin wiki page comments (https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin)
The problem was fixed in 1.2.1 with issue JENKINS-12089
No more feedback after 1.2.1 release. I close it.
Hi Brad,
I read a little bit the xcodebuild documentation (http://www.manpagez.com/man/1/xcodebuild/) and this parameter can be passed as SYMROOT=<A_PATH>
Thus what I could propose is :
Let me know if it is what you have in mind. I'll implement it this week if we are agree.