From eac1453f91f3297f0473016df4fc52966b8d71ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 19 Oct 2011 14:31:12 +0700 Subject: [PATCH 01/91] ignore generated files and dirs --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e558d463 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +target +work +.idea +test-* +*.iml From 029576b5d141669b47ebdaac2cb92283152908b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 19 Oct 2011 14:31:49 +0700 Subject: [PATCH 02/91] Change to use a recent parent for Jenkins --- pom.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index e91980c8..24015729 100644 --- a/pom.xml +++ b/pom.xml @@ -1,10 +1,9 @@ 4.0.0 - org.jvnet.hudson.plugins - plugin - 1.343 - ../pom.xml + org.jenkins-ci.plugins + plugin + 1.433 From 0c5a0eeb13c089a8d31f2815eec7fb27094f2569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 19 Oct 2011 14:32:16 +0700 Subject: [PATCH 03/91] Update SCM for my git repo if I want to release it --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 24015729..0aad373f 100644 --- a/pom.xml +++ b/pom.xml @@ -7,9 +7,9 @@ - scm:git:git://github.com/rayh/xcode-hudson-plugin.git/tags/xcode-builder-0.1 - scm:git:git@github.com:rayh/xcode-hudson-plugin.git/tags/xcode-builder-0.1 - http://github.com/rayh/xcode-hudson-plugin/tags/xcode-builder-0.1 + scm:git:git@github.com:aheritier/xcode-hudson-plugin.git + scm:git:git@github.com:aheritier/xcode-hudson-plugin.git + https://github.com/aheritier/xcode-hudson-plugin From 748965329ed297804e68fda377a14106d06c9c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 19 Oct 2011 14:33:23 +0700 Subject: [PATCH 04/91] Move project identity at the beginning and change the title (I'm not sure it is working with Hudson with my changes) --- pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 0aad373f..c4e41486 100644 --- a/pom.xml +++ b/pom.xml @@ -6,6 +6,12 @@ 1.433 + hudson.plugins.xcode + xcode + 0.1-SNAPSHOT + XCode integration for Jenkins CI + hpi + scm:git:git@github.com:aheritier/xcode-hudson-plugin.git scm:git:git@github.com:aheritier/xcode-hudson-plugin.git @@ -44,12 +50,6 @@ - hudson.plugins.xcode - xcode - 0.1-SNAPSHOT - XCode integration for Hudson CI - hpi - From 1feae03d5d5a0a3c2c67ffc49e0f648fc528799e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 19 Oct 2011 14:33:43 +0700 Subject: [PATCH 05/91] Update for changes in Jenkins --- .../com/rayh/XCodeBuildOutputParserTest.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java b/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java index 3abc4789..bb3f2103 100644 --- a/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java +++ b/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java @@ -5,20 +5,27 @@ package au.com.rayh; -import au.com.rayh.report.TestCase; -import au.com.rayh.report.TestSuite; -import java.io.File; import hudson.FilePath; +import hudson.console.ConsoleNote; import hudson.model.TaskListener; + +import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Date; + + +import au.com.rayh.report.TestCase; +import au.com.rayh.report.TestSuite; import org.junit.After; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; /** * @@ -38,6 +45,15 @@ public PrintStream getLogger() { throw new RuntimeException(e); } } + + public void annotate(ConsoleNote consoleNote) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void hyperlink(String s, String s1) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + public PrintWriter error(String string) { throw new UnsupportedOperationException("Not supported yet."); } @@ -114,7 +130,7 @@ public void shouldParsePassedTestCase() throws Exception { assertNull(parser.currentTestCase); assertEquals(1, parser.currentTestSuite.getTestCases().size()); assertEquals("testThatPasses", parser.currentTestSuite.getTestCases().get(0).getName()); - assertEquals(1.234, parser.currentTestSuite.getTestCases().get(0).getTime()); + assertEquals(1.234, parser.currentTestSuite.getTestCases().get(0).getTime(),0); assertEquals(1,parser.currentTestSuite.getTests()); assertEquals(0,parser.currentTestSuite.getFailures()); } @@ -128,7 +144,7 @@ public void shouldParseFailedTestCase() throws Exception { assertNull(parser.currentTestCase); assertEquals(1, parser.currentTestSuite.getTestCases().size()); assertEquals("testThatFails", parser.currentTestSuite.getTestCases().get(0).getName()); - assertEquals(1.234, parser.currentTestSuite.getTestCases().get(0).getTime()); + assertEquals(1.234, parser.currentTestSuite.getTestCases().get(0).getTime(),0); assertEquals(1,parser.currentTestSuite.getTests()); assertEquals(1,parser.currentTestSuite.getFailures()); } From ca4bb967b04ce1d2d5989be3fadb3b0cc1a199c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 20 Oct 2011 00:44:08 +0700 Subject: [PATCH 06/91] Fix test case (it uses floats) --- .../com/rayh/XCodeBuildOutputParserTest.java | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java b/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java index bb3f2103..4d5f825d 100644 --- a/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java +++ b/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java @@ -5,27 +5,19 @@ package au.com.rayh; +import au.com.rayh.report.TestCase; +import au.com.rayh.report.TestSuite; import hudson.FilePath; import hudson.console.ConsoleNote; import hudson.model.TaskListener; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.util.Date; - - -import au.com.rayh.report.TestCase; -import au.com.rayh.report.TestSuite; import org.junit.After; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import java.io.*; +import java.util.Date; + +import static org.junit.Assert.*; /** * @@ -130,7 +122,7 @@ public void shouldParsePassedTestCase() throws Exception { assertNull(parser.currentTestCase); assertEquals(1, parser.currentTestSuite.getTestCases().size()); assertEquals("testThatPasses", parser.currentTestSuite.getTestCases().get(0).getName()); - assertEquals(1.234, parser.currentTestSuite.getTestCases().get(0).getTime(),0); + assertEquals(1.234f, parser.currentTestSuite.getTestCases().get(0).getTime(),0); assertEquals(1,parser.currentTestSuite.getTests()); assertEquals(0,parser.currentTestSuite.getFailures()); } @@ -144,7 +136,7 @@ public void shouldParseFailedTestCase() throws Exception { assertNull(parser.currentTestCase); assertEquals(1, parser.currentTestSuite.getTestCases().size()); assertEquals("testThatFails", parser.currentTestSuite.getTestCases().get(0).getName()); - assertEquals(1.234, parser.currentTestSuite.getTestCases().get(0).getTime(),0); + assertEquals(1.234f, parser.currentTestSuite.getTestCases().get(0).getTime(),0); assertEquals(1,parser.currentTestSuite.getTests()); assertEquals(1,parser.currentTestSuite.getFailures()); } From 1346057a5a335ae009343528bdb3be51225ef88b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 20 Oct 2011 02:19:46 +0700 Subject: [PATCH 07/91] Use ${BUILD_NUMBER} instead of {BUILD_NUMBER} to use the current build number as it is supported by many others plugins And ensure we don't have some quotes around the value. --- src/main/java/au/com/rayh/XCodeBuilder.java | 2 +- src/main/resources/au/com/rayh/XCodeBuilder/config.jelly | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index b5133860..e6418cdc 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -129,7 +129,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis String artifactVersion = String.valueOf(build.getNumber()); String versionNumber = artifactVersion; if(!StringUtils.isEmpty(getVersionNumberPattern())) { - versionNumber = getVersionNumberPattern().replaceAll("\\{BUILD_NUMBER\\}", artifactVersion); + versionNumber = getVersionNumberPattern().replaceAll("\\$\\{BUILD_NUMBER\\}", artifactVersion); } if(updateBuildNumber) { diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index b466bc13..33d4db22 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -47,9 +47,9 @@ - + Date: Thu, 20 Oct 2011 02:24:11 +0700 Subject: [PATCH 08/91] Restore compatibility with older jenkins versions --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c4e41486..01739731 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - org.jenkins-ci.plugins - plugin - 1.433 + org.jenkins-ci.plugins + plugin + 1.399 hudson.plugins.xcode From ae0b7f542c2dcd36d299ed9a86473183bf3742f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 20 Oct 2011 02:24:37 +0700 Subject: [PATCH 09/91] Use jenkins groupId and update artifactId to have something clean --- pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 01739731..fdf3be5a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,8 +6,7 @@ 1.399 - hudson.plugins.xcode - xcode + xcode-plugin 0.1-SNAPSHOT XCode integration for Jenkins CI hpi From 528767539ba8f9c9d5fc044b134e3b5e38989239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 20 Oct 2011 02:44:25 +0700 Subject: [PATCH 10/91] Reactivate versions updates --- src/main/java/au/com/rayh/XCodeBuilder.java | 45 +++++++++++---------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index e6418cdc..c7379a1a 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -1,25 +1,26 @@ package au.com.rayh; import com.google.common.collect.Lists; import hudson.EnvVars; -import hudson.Launcher; import hudson.Extension; import hudson.FilePath; -import hudson.util.FormValidation; +import hudson.Launcher; import hudson.model.AbstractBuild; -import hudson.model.BuildListener; import hudson.model.AbstractProject; -import hudson.tasks.Builder; +import hudson.model.BuildListener; import hudson.tasks.BuildStepDescriptor; +import hudson.tasks.Builder; +import hudson.util.FormValidation; import net.sf.json.JSONObject; +import org.apache.commons.lang.StringUtils; import org.kohsuke.stapler.DataBoundConstructor; -import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.QueryParameter; +import org.kohsuke.stapler.StaplerRequest; import javax.servlet.ServletException; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang.StringUtils; /** * @author Ray Hilton @@ -134,28 +135,28 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis if(updateBuildNumber) { listener.getLogger().println("Updating version number (CFBundleVersion) to " + versionNumber); - //ByteArrayOutputStream output = new ByteArrayOutputStream(); - //returnCode = launcher.launch().envs(envs).cmds("agvtool", "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); - //if(returnCode>0) { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + returnCode = launcher.launch().envs(envs).cmds("agvtool", "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); + if(returnCode>0) { - //} else { - // String marketingVersionNumber = output.toString().trim(); - // artifactVersion = marketingVersionNumber + "." + build.getNumber(); - // listener.getLogger().println("CFBundleShortVersionString is " + marketingVersionNumber + " so new CFBundleVersion will be " + artifactVersion); - //} + } else { + String marketingVersionNumber = output.toString().trim(); + artifactVersion = marketingVersionNumber + "." + build.getNumber(); + listener.getLogger().println("CFBundleShortVersionString is " + marketingVersionNumber + " so new CFBundleVersion will be " + artifactVersion); + } returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-version", "-all", versionNumber ).stdout(listener).pwd(projectRoot).join(); if(returnCode>0) { listener.fatalError("Could not set the CFBundleVersion to " + versionNumber); } -// } else { -// listener.getLogger().println("Fetching marketing version number (CFBundleShortVersionString)"); -// ByteArrayOutputStream output = new ByteArrayOutputStream(); -// returnCode = launcher.launch().envs(envs).cmds("agvtool", "vers", "-terse").stdout(output).pwd(projectRoot).join(); -// -// // only use this version number if we found it -// if(returnCode==0) -// artifactVersion = output.toString().trim(); + } else { + listener.getLogger().println("Fetching marketing version number (CFBundleShortVersionString)"); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + returnCode = launcher.launch().envs(envs).cmds("agvtool", "vers", "-terse").stdout(output).pwd(projectRoot).join(); + + // only use this version number if we found it + if(returnCode==0) + artifactVersion = output.toString().trim(); } if( false == StringUtils.isEmpty(overrideMarketingNumber) ) { From 431cc6e5a5bcecb50279a947daac440b7dd5bf89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 20 Oct 2011 02:46:24 +0700 Subject: [PATCH 11/91] Reactivate clean before build --- src/main/java/au/com/rayh/XCodeBuilder.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index c7379a1a..cbb6ac2c 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -211,12 +211,12 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis commandLine.add(configuration); xcodeReport.append(", configuration: ").append(configuration); -// if (cleanBeforeBuild) { -// commandLine.add("clean"); -// xcodeReport.append(", clean: YES"); -// } else { -// xcodeReport.append(", clean: NO"); -// } + if (cleanBeforeBuild) { + commandLine.add("clean"); + xcodeReport.append(", clean: YES"); + } else { + xcodeReport.append(", clean: NO"); + } commandLine.add("build"); listener.getLogger().println(xcodeReport.toString()); From d9c3f9b509a4b7a0bbba80732018c12273ab26b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 20 Oct 2011 02:49:27 +0700 Subject: [PATCH 12/91] * Remove the job name from the generated ipa filename * Replace spaces in the application name by "-" --- src/main/java/au/com/rayh/XCodeBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index cbb6ac2c..113d88b1 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -236,7 +236,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis List apps = buildDirectory.list(new AppFileFilter()); for(FilePath app : apps) { - String baseName = app.getBaseName() + "-" + configuration + "-" + build.getProject().getName() + "-" + versionNumber; + String baseName = app.getBaseName().replaceAll(" ","-") + "-" + configuration + "-" + versionNumber; FilePath ipaLocation = buildDirectory.child(baseName + ".ipa"); FilePath payload = buildDirectory.child("Payload"); From da5cdaca291b78cde27ca8b66e360297ddd83a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 20 Oct 2011 03:05:29 +0700 Subject: [PATCH 13/91] We could have spaces in Configuration names --- src/main/java/au/com/rayh/XCodeBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 113d88b1..7e423e78 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -236,7 +236,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis List apps = buildDirectory.list(new AppFileFilter()); for(FilePath app : apps) { - String baseName = app.getBaseName().replaceAll(" ","-") + "-" + configuration + "-" + versionNumber; + String baseName = app.getBaseName().replaceAll(" ","-") + "-" + configuration.replaceAll(" ","_") + "-" + versionNumber; FilePath ipaLocation = buildDirectory.child(baseName + ".ipa"); FilePath payload = buildDirectory.child("Payload"); From d030c10058f4328ed0023af2d8e550dac306bdfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 20 Oct 2011 17:53:40 +0700 Subject: [PATCH 14/91] Refactor and cleanup how versions are managed and can be overridden by the plugin Macro plugin integration to reuse BUILD_NUMBER and others tokens --- pom.xml | 8 + src/main/java/au/com/rayh/XCodeBuilder.java | 144 +++++++++++------- .../au/com/rayh/XCodeBuilder/config.jelly | 46 +++--- .../webapp/help-CFBundleVersionPattern.html | 11 ++ ...elp-cfBundleShortVersionStringPattern.html | 6 + src/main/webapp/help-embeddedProfileFile.html | 5 + src/main/webapp/help-updateBuildNumber.html | 5 - .../webapp/help-updateMarketingNumber.html | 5 - 8 files changed, 137 insertions(+), 93 deletions(-) create mode 100644 src/main/webapp/help-CFBundleVersionPattern.html create mode 100644 src/main/webapp/help-cfBundleShortVersionStringPattern.html create mode 100644 src/main/webapp/help-embeddedProfileFile.html delete mode 100644 src/main/webapp/help-updateBuildNumber.html delete mode 100644 src/main/webapp/help-updateMarketingNumber.html diff --git a/pom.xml b/pom.xml index fdf3be5a..0e174b20 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,14 @@ https://github.com/aheritier/xcode-hudson-plugin + + + org.jenkins-ci.plugins + token-macro + 1.4 + + + diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 7e423e78..96b1d23a 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -12,6 +12,8 @@ import hudson.util.FormValidation; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; +import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; +import org.jenkinsci.plugins.tokenmacro.TokenMacro; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; @@ -28,34 +30,32 @@ public class XCodeBuilder extends Builder { private Boolean buildIpa; private Boolean cleanBeforeBuild; - private Boolean updateBuildNumber; private String configuration; - private String overrideMarketingNumber; + private String cfBundleShortVersionStringPattern; private String target; private String sdk; private String xcodeProjectPath; private String xcodeProjectFile; private String embeddedProfileFile; - private String versionNumberPattern; + private String cfBundleVersionPattern; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, Boolean updateBuildNumber, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String versionNumberPattern, String overrideMarketingNumber) { + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionPattern, String cfBundleShortVersionStringPattern) { this.buildIpa = buildIpa; this.sdk = sdk; this.target = target; this.cleanBeforeBuild = cleanBeforeBuild; - this.updateBuildNumber = updateBuildNumber; - this.overrideMarketingNumber = overrideMarketingNumber; + this.cfBundleShortVersionStringPattern = cfBundleShortVersionStringPattern; this.configuration = configuration; this.xcodeProjectPath = xcodeProjectPath; this.xcodeProjectFile = xcodeProjectFile; this.embeddedProfileFile = embeddedProfileFile; - this.versionNumberPattern = versionNumberPattern; + this.cfBundleVersionPattern = cfBundleVersionPattern; } - public String getVersionNumberPattern() { - return versionNumberPattern; + public String getCfBundleVersionPattern() { + return cfBundleVersionPattern; } public String getSdk() { return sdk; @@ -77,12 +77,8 @@ public Boolean getCleanBeforeBuild() { return cleanBeforeBuild; } - public Boolean getUpdateBuildNumber() { - return updateBuildNumber; - } - - public String getOverrideMarketingNumber() { - return overrideMarketingNumber; + public String getCfBundleShortVersionStringPattern() { + return cfBundleShortVersionStringPattern; } public String getXcodeProjectPath() { @@ -119,55 +115,79 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // XCode Version int returnCode = launcher.launch().envs(envs).cmds(getDescriptor().xcodebuildPath(), "-version").stdout(listener).pwd(projectRoot).join(); - if(returnCode>0) return false; - - // Unlock keychain -// if(!StringUtils.isEmpty(keychainPassword)) { -// launcher.launch().envs(envs).cmds("security", "unlock-keychain", "-p", keychainPassword); -// } - - // Set build number - String artifactVersion = String.valueOf(build.getNumber()); - String versionNumber = artifactVersion; - if(!StringUtils.isEmpty(getVersionNumberPattern())) { - versionNumber = getVersionNumberPattern().replaceAll("\\$\\{BUILD_NUMBER\\}", artifactVersion); + if(returnCode>0){ + listener.fatalError("Check your XCode installation. Jenkins cannot retrieve its version."); + return false; // We fail the build if XCode isn't deployed } - - if(updateBuildNumber) { - listener.getLogger().println("Updating version number (CFBundleVersion) to " + versionNumber); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - returnCode = launcher.launch().envs(envs).cmds("agvtool", "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); - if(returnCode>0) { - } else { - String marketingVersionNumber = output.toString().trim(); - artifactVersion = marketingVersionNumber + "." + build.getNumber(); - listener.getLogger().println("CFBundleShortVersionString is " + marketingVersionNumber + " so new CFBundleVersion will be " + artifactVersion); + listener.getLogger().println("Fetching marketing version number (CFBundleShortVersionString) from project."); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + String cfBundleShortVersionString=""; + returnCode = launcher.launch().envs(envs).cmds("agvtool", "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); + // only use this version number if we found it + if(returnCode==0) + cfBundleShortVersionString = output.toString().trim(); + if(cfBundleShortVersionString.isEmpty()) + listener.getLogger().println("No marketing version found (CFBundleShortVersionString)"); + else + listener.getLogger().println("Found marketing version (CFBundleShortVersionString)"+cfBundleShortVersionString); + + String cfBundleVersion=""; + returnCode = launcher.launch().envs(envs).cmds("agvtool", "vers", "-terse").stdout(output).pwd(projectRoot).join(); + // only use this version number if we found it + if(returnCode==0) + cfBundleVersion = output.toString().trim(); + if(cfBundleVersion.isEmpty()) + listener.getLogger().println("No marketing version found (CFBundleVersion)"); + else + listener.getLogger().println("Found marketing version (CFBundleVersion)"+cfBundleShortVersionString); + + listener.getLogger().println("Marketing version (CFBundleShortVersionString) found in project configuration :" + cfBundleShortVersionString); + listener.getLogger().println("Technical version (CFBundleVersion) found in project configuration :"+ cfBundleVersion); + + // Update the Marketing version (CFBundleShortVersionString) + if( false == StringUtils.isEmpty(cfBundleShortVersionStringPattern) ) { + try { + // If not empty we use the Token Expansion to replace it + // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin + cfBundleShortVersionString = TokenMacro.expand(build, listener, getCfBundleShortVersionStringPattern()); + listener.getLogger().println("Updating marketing version (CFBundleShortVersionString) to " + cfBundleShortVersionString); + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-marketing-version", cfBundleShortVersionString).stdout(listener).pwd(projectRoot).join(); + if(returnCode>0) { + listener.fatalError("Could not set CFBundleShortVersionString to " + cfBundleShortVersionString); + return false; + } + } catch (MacroEvaluationException e) { + listener.fatalError("Failure while expanding macros for CFBundleShortVersionString. Error : "+e.getMessage()); + return false; } + } - returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-version", "-all", versionNumber ).stdout(listener).pwd(projectRoot).join(); - if(returnCode>0) { - listener.fatalError("Could not set the CFBundleVersion to " + versionNumber); + if( ! StringUtils.isEmpty(getCfBundleVersionPattern()) ) { + try { + // If not empty we use the Token Expansion to replace it + // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin + String technicalVersion = TokenMacro.expand(build, listener, getCfBundleVersionPattern()); + output = new ByteArrayOutputStream(); + // Read the current Marketing Version in the project + cfBundleVersion = cfBundleShortVersionString.isEmpty() ? technicalVersion : cfBundleShortVersionString + "_" + technicalVersion; + listener.getLogger().println("CFBundleShortVersionString is " + cfBundleShortVersionString + " so new CFBundleVersion will be updated to " + cfBundleVersion); + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-version", "-all", cfBundleVersion ).stdout(listener).pwd(projectRoot).join(); + if(returnCode>0) { + listener.fatalError("Could not set the CFBundleVersion to " + cfBundleVersion); + return false; + } + } catch (MacroEvaluationException e) { + listener.fatalError("Failure while expanding macros for CFBundleVersion. Error : "+e.getMessage()); + // Fails the build + return false; } - } else { - listener.getLogger().println("Fetching marketing version number (CFBundleShortVersionString)"); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - returnCode = launcher.launch().envs(envs).cmds("agvtool", "vers", "-terse").stdout(output).pwd(projectRoot).join(); - - // only use this version number if we found it - if(returnCode==0) - artifactVersion = output.toString().trim(); - } - - if( false == StringUtils.isEmpty(overrideMarketingNumber) ) { - listener.getLogger().println("Updating marketing version to " + overrideMarketingNumber); - returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-marketing-version", overrideMarketingNumber ).stdout(listener).pwd(projectRoot).join(); - if(returnCode>0) { - listener.fatalError("Could not set marketing version to " + overrideMarketingNumber); - } } + listener.getLogger().println("Marketing version (CFBundleShortVersionString) used by Jenkins to produce the IPA :" + cfBundleShortVersionString); + listener.getLogger().println("Technical version (CFBundleVersion) used by Jenkins to produce the IPA :"+ cfBundleVersion); + // Clean build directories if(cleanBeforeBuild) { listener.getLogger().println("Cleaning build directory (" + projectRoot.child("build") + ")"); @@ -236,7 +256,17 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis List apps = buildDirectory.list(new AppFileFilter()); for(FilePath app : apps) { - String baseName = app.getBaseName().replaceAll(" ","-") + "-" + configuration.replaceAll(" ","_") + "-" + versionNumber; + String version = ""; + if (cfBundleShortVersionString.isEmpty() && cfBundleVersion.isEmpty()) + version = ""+build.getNumber(); + else if (cfBundleVersion.isEmpty()) + version = cfBundleShortVersionString; + else + version = cfBundleVersion; + + String baseName = app.getBaseName().replaceAll(" ","_") + "-" + + configuration.replaceAll(" ","_") + (version.isEmpty() ? "" : "-"+version); + FilePath ipaLocation = buildDirectory.child(baseName + ".ipa"); FilePath payload = buildDirectory.child("Payload"); diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 33d4db22..83f452e0 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -5,66 +5,60 @@ See global.jelly for a general discussion about jelly script. --> + + + + help="/plugin/xcode-plugin/help-target.html"> + help="/plugin/xcode-plugin/help-sdk.html"> + help="/plugin/xcode-plugin/help-configuration.html"> + help="/plugin/xcode-plugin/help-xcodeProjectPath.html"> + help="/plugin/xcode-plugin/help-xcodeProjectFile.html"> - - - - - - - - - - - + + + - - + + + help="/plugin/xcode-plugin/help-buildIpa.html"> + help="/plugin/xcode-plugin/help-embeddedProfileFile.html"> diff --git a/src/main/webapp/help-CFBundleVersionPattern.html b/src/main/webapp/help-CFBundleVersionPattern.html new file mode 100644 index 00000000..273abccc --- /dev/null +++ b/src/main/webapp/help-CFBundleVersionPattern.html @@ -0,0 +1,11 @@ +
+

+ The pattern to set the CFBundleVersion.
+ Supports all macros from the Token Macro Plugin.
+ For example the value ${BUILD_NUMBER} will be replaced with the current build number.
+ It will be CFBundleShortVersionString + "_" + this evaluated field.
+ If CFBundleShortVersionString equals 2.0.0 and CFBundleVersion pattern is "${BUILD_NUMBER}" then for the build #42 you'll have CFBundleVersion equals to 2.0.0_48.
+ You should use CFBundleShortVersionString (i.e. the marketing version) to provide a public-facing version number such as 2.0.1
+ Keep it empty to not override the version defined in your project.
+

+
diff --git a/src/main/webapp/help-cfBundleShortVersionStringPattern.html b/src/main/webapp/help-cfBundleShortVersionStringPattern.html new file mode 100644 index 00000000..089890a9 --- /dev/null +++ b/src/main/webapp/help-cfBundleShortVersionStringPattern.html @@ -0,0 +1,6 @@ +
+

+ This will set the CFBundleShortVersionString to the specified string.
+ Supports all macros from the Token Macro Plugin. +

+
diff --git a/src/main/webapp/help-embeddedProfileFile.html b/src/main/webapp/help-embeddedProfileFile.html new file mode 100644 index 00000000..eca92585 --- /dev/null +++ b/src/main/webapp/help-embeddedProfileFile.html @@ -0,0 +1,5 @@ +
+

+ The relative path to the mobileprovision to embed, leave blank for no embedded profile. +

+
diff --git a/src/main/webapp/help-updateBuildNumber.html b/src/main/webapp/help-updateBuildNumber.html deleted file mode 100644 index 82a27698..00000000 --- a/src/main/webapp/help-updateBuildNumber.html +++ /dev/null @@ -1,5 +0,0 @@ -
-

- This will set the CFBundleVersion to the current version number. You should use CFBundleShortVersionString (i.e. the marketing version) to provide a public-facing version number such as 1.0.1. -

-
diff --git a/src/main/webapp/help-updateMarketingNumber.html b/src/main/webapp/help-updateMarketingNumber.html deleted file mode 100644 index b2d8dbd2..00000000 --- a/src/main/webapp/help-updateMarketingNumber.html +++ /dev/null @@ -1,5 +0,0 @@ -
-

- This will set the CFBundleShortVersionString to the specified string. -

-
From 8e9d9ba2dbce99e5b4cc3991ec5f2029e91080e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 2 Nov 2011 02:47:49 +0100 Subject: [PATCH 15/91] Use public attributes (simpler and fixes the bug of unsaved config options) --- src/main/java/au/com/rayh/XCodeBuilder.java | 65 +++++---------------- 1 file changed, 13 insertions(+), 52 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 96b1d23a..fdc7495c 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -28,16 +28,16 @@ * @author Ray Hilton */ public class XCodeBuilder extends Builder { - private Boolean buildIpa; - private Boolean cleanBeforeBuild; - private String configuration; - private String cfBundleShortVersionStringPattern; - private String target; - private String sdk; - private String xcodeProjectPath; - private String xcodeProjectFile; - private String embeddedProfileFile; - private String cfBundleVersionPattern; + public final Boolean buildIpa; + public final Boolean cleanBeforeBuild; + public final String configuration; + public final String cfBundleShortVersionStringPattern; + public final String target; + public final String sdk; + public final String xcodeProjectPath; + public final String xcodeProjectFile; + public final String embeddedProfileFile; + public final String cfBundleVersionPattern; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor @@ -54,45 +54,6 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configura this.cfBundleVersionPattern = cfBundleVersionPattern; } - public String getCfBundleVersionPattern() { - return cfBundleVersionPattern; - } - public String getSdk() { - return sdk; - } - - public String getTarget() { - return target; - } - - public String getConfiguration() { - return configuration; - } - - public Boolean getBuildIpa() { - return buildIpa; - } - - public Boolean getCleanBeforeBuild() { - return cleanBeforeBuild; - } - - public String getCfBundleShortVersionStringPattern() { - return cfBundleShortVersionStringPattern; - } - - public String getXcodeProjectPath() { - return xcodeProjectPath; - } - - public String getXcodeProjectFile() { - return xcodeProjectFile; - } - - public String getEmbeddedProfileFile() { - return embeddedProfileFile; - } - @Override public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { EnvVars envs = build.getEnvironment(listener); @@ -150,7 +111,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis try { // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin - cfBundleShortVersionString = TokenMacro.expand(build, listener, getCfBundleShortVersionStringPattern()); + cfBundleShortVersionString = TokenMacro.expand(build, listener, cfBundleShortVersionStringPattern); listener.getLogger().println("Updating marketing version (CFBundleShortVersionString) to " + cfBundleShortVersionString); returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-marketing-version", cfBundleShortVersionString).stdout(listener).pwd(projectRoot).join(); if(returnCode>0) { @@ -163,11 +124,11 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis } } - if( ! StringUtils.isEmpty(getCfBundleVersionPattern()) ) { + if( ! StringUtils.isEmpty(cfBundleVersionPattern) ) { try { // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin - String technicalVersion = TokenMacro.expand(build, listener, getCfBundleVersionPattern()); + String technicalVersion = TokenMacro.expand(build, listener, cfBundleVersionPattern); output = new ByteArrayOutputStream(); // Read the current Marketing Version in the project cfBundleVersion = cfBundleShortVersionString.isEmpty() ? technicalVersion : cfBundleShortVersionString + "_" + technicalVersion; From 0836d64446b9246d9a20a59cf2337d43ecdf761a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 2 Nov 2011 16:47:55 +0100 Subject: [PATCH 16/91] Let's prepare to push out a 1.0 release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0e174b20..8f374a93 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ xcode-plugin - 0.1-SNAPSHOT + 1.0-SNAPSHOT XCode integration for Jenkins CI hpi From 6e55af3cd944da2c69a3d7cee726cb1edb076a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 12:19:33 +0100 Subject: [PATCH 17/91] We can match the min version used by the then-macro plugin (1.398 instead of 1.399) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8f374a93..1fc9e18f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.jenkins-ci.plugins plugin - 1.399 + 1.398 xcode-plugin From b027df607bae49c3bdf0b98fecbfb80ea952c7c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 12:20:41 +0100 Subject: [PATCH 18/91] Reformat POM --- pom.xml | 138 +++++++++++++++++++++++++++----------------------------- 1 file changed, 66 insertions(+), 72 deletions(-) diff --git a/pom.xml b/pom.xml index 1fc9e18f..22167e28 100644 --- a/pom.xml +++ b/pom.xml @@ -1,74 +1,68 @@ - - 4.0.0 - - org.jenkins-ci.plugins - plugin - 1.398 - - - xcode-plugin - 1.0-SNAPSHOT - XCode integration for Jenkins CI - hpi - - - scm:git:git@github.com:aheritier/xcode-hudson-plugin.git - scm:git:git@github.com:aheritier/xcode-hudson-plugin.git - https://github.com/aheritier/xcode-hudson-plugin - - - - - org.jenkins-ci.plugins - token-macro - 1.4 - - - - - - - org.jvnet.wagon-svn - wagon-svn - 1.9 - - - - - org.apache.maven.plugins - maven-release-plugin - 2.0 - - - org.apache.maven.scm - maven-scm-provider-gitexe - 1.3 - - - - - - - - - rayhilton - Ray Yamamoto Hilton - ray.hilton@gmail.com - - - + + + 4.0.0 + + org.jenkins-ci.plugins + plugin + 1.398 + + xcode-plugin + 1.0-SNAPSHOT + hpi + XCode integration for Jenkins CI + + + rayhilton + Ray Yamamoto Hilton + ray.hilton@gmail.com + + + + scm:git:git@github.com:aheritier/xcode-hudson-plugin.git + scm:git:git@github.com:aheritier/xcode-hudson-plugin.git + https://github.com/aheritier/xcode-hudson-plugin + - - - m.g.o-public - http://maven.glassfish.org/content/groups/public/ - - - - - - m.g.o-public - http://maven.glassfish.org/content/groups/public/ - - + + + m.g.o-public + http://maven.glassfish.org/content/groups/public/ + + + + + m.g.o-public + http://maven.glassfish.org/content/groups/public/ + + + + + org.jenkins-ci.plugins + token-macro + 1.4 + + + + + + org.jvnet.wagon-svn + wagon-svn + 1.9 + + + + + org.apache.maven.plugins + maven-release-plugin + 2.0 + + + org.apache.maven.scm + maven-scm-provider-gitexe + 1.3 + + + + + From 983a755b234fa45d4b41a271aa8c512cadf1da3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 12:22:15 +0100 Subject: [PATCH 19/91] Fix name Add description --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 22167e28..d16799af 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,8 @@ xcode-plugin 1.0-SNAPSHOT hpi - XCode integration for Jenkins CI + XCode integration + This plugin adds the ability to call XCode for mobile developments (iPhone, iPad, etc). rayhilton From 7fa8c726029944a77cbd0a61b901c61fc115df8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 12:23:33 +0100 Subject: [PATCH 20/91] add myself as dev --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index d16799af..45e9dc50 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,11 @@ Ray Yamamoto Hilton ray.hilton@gmail.com + + aheritier + Arnaud Héritier + aheritier@apache.org + scm:git:git@github.com:aheritier/xcode-hudson-plugin.git From 01dd1edc4a045762e1caab57432f32e6ec99ec80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 12:25:52 +0100 Subject: [PATCH 21/91] Fix SCM url since it is now hosted on jenkinsci --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 45e9dc50..fb0976a1 100644 --- a/pom.xml +++ b/pom.xml @@ -24,9 +24,9 @@ - scm:git:git@github.com:aheritier/xcode-hudson-plugin.git - scm:git:git@github.com:aheritier/xcode-hudson-plugin.git - https://github.com/aheritier/xcode-hudson-plugin + scm:git:git@github.com:jenkinsci/xcode-plugin.git + scm:git:git@github.com:jenkinsci/xcode-plugin.git + https://github.com/jenkinsci/xcode-plugin From 9c18dd0bc87ae5794098913dcc81f663a2e1648d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 12:26:17 +0100 Subject: [PATCH 22/91] What is SVN ? :-) --- pom.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pom.xml b/pom.xml index fb0976a1..a20f435a 100644 --- a/pom.xml +++ b/pom.xml @@ -49,13 +49,6 @@ - - - org.jvnet.wagon-svn - wagon-svn - 1.9 - - org.apache.maven.plugins From bad532eac8288f7030ba398fd6f4fc420bd71a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 12:27:56 +0100 Subject: [PATCH 23/91] Update the release plugin and the git provider to be up-to-date and to have less issues with them --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a20f435a..243708b7 100644 --- a/pom.xml +++ b/pom.xml @@ -53,12 +53,12 @@ org.apache.maven.plugins maven-release-plugin - 2.0 + 2.2.1 org.apache.maven.scm maven-scm-provider-gitexe - 1.3 + 1.5 From 74eda5758b66a8e2148622569eb59a882c58d958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 12:28:49 +0100 Subject: [PATCH 24/91] Add plugin doc URL --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 243708b7..354f64d9 100644 --- a/pom.xml +++ b/pom.xml @@ -11,6 +11,7 @@ hpi XCode integration This plugin adds the ability to call XCode for mobile developments (iPhone, iPad, etc). + https://wiki.jenkins-ci.org/display/JENKINS/XCode+Plugin rayhilton From 0bc03c3685870e496abffda3e4961fd025d44473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 14:40:10 +0100 Subject: [PATCH 25/91] Update README --- README | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README b/README index a674bf31..743e1d42 100644 --- a/README +++ b/README @@ -1,3 +1,8 @@ -This is a simple plugin for invoking xcode (iPhone, iPad, etc) builds from Hudson CI. +Xcode plugin +------------ -Please read the overview here: http://rayh.com.au/xcode-hudson-plugin +This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). +* More documentation about how to use it : https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin +* Report all issues or features requests in Jira : https://issues.jenkins-ci.org/browse/JENKINS/component/16124 + +Contact the Jenkins Community by [mail](http://jenkins-ci.org/content/mailing-lists) or [irc](http://jenkins-ci.org/content/chat) to have support. \ No newline at end of file From 33c60dd3be9c5352bee3d226d8d51c2f07240dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 8 Nov 2011 14:40:40 +0100 Subject: [PATCH 26/91] Update description --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 354f64d9..f4bb06e2 100644 --- a/pom.xml +++ b/pom.xml @@ -10,8 +10,8 @@ 1.0-SNAPSHOT hpi XCode integration - This plugin adds the ability to call XCode for mobile developments (iPhone, iPad, etc). - https://wiki.jenkins-ci.org/display/JENKINS/XCode+Plugin + This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). + https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin rayhilton From 30dc9ab757ea82d517908b7ada0406cd67f97359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 10 Nov 2011 22:39:55 +0100 Subject: [PATCH 27/91] Apply MIT license --- pom.xml | 31 +++++++++++++++ src/main/java/au/com/rayh/AppFileFilter.java | 24 ++++++++++++ .../au/com/rayh/XCodeBuildOutputParser.java | 24 ++++++++++++ src/main/java/au/com/rayh/XCodeBuilder.java | 38 +++++++++++++++---- .../java/au/com/rayh/report/TestCase.java | 24 ++++++++++++ .../java/au/com/rayh/report/TestFailure.java | 24 ++++++++++++ .../java/au/com/rayh/report/TestSuite.java | 24 ++++++++++++ .../au/com/rayh/XCodeBuilder/config.jelly | 24 ++++++++++++ .../au/com/rayh/XCodeBuilder/global.jelly | 26 ++++++++++++- src/main/resources/index.jelly | 24 ++++++++++++ .../webapp/help-CFBundleVersionPattern.html | 24 ++++++++++++ src/main/webapp/help-buildIpa.html | 24 ++++++++++++ ...elp-cfBundleShortVersionStringPattern.html | 24 ++++++++++++ src/main/webapp/help-cleanBeforeBuild.html | 24 ++++++++++++ src/main/webapp/help-configuration.html | 24 ++++++++++++ src/main/webapp/help-embeddedProfileFile.html | 24 ++++++++++++ src/main/webapp/help-sdk.html | 24 ++++++++++++ src/main/webapp/help-target.html | 24 ++++++++++++ src/main/webapp/help-xcodeProjectFile.html | 24 ++++++++++++ src/main/webapp/help-xcodeProjectPath.html | 24 ++++++++++++ .../com/rayh/XCodeBuildOutputParserTest.java | 24 ++++++++++++ 21 files changed, 518 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index f4bb06e2..9ae33aca 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,28 @@ + + 4.0.0 @@ -12,6 +36,13 @@ XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin + + + MIT + LICENSE.txt + repo + + rayhilton diff --git a/src/main/java/au/com/rayh/AppFileFilter.java b/src/main/java/au/com/rayh/AppFileFilter.java index 40b139e4..aa915272 100644 --- a/src/main/java/au/com/rayh/AppFileFilter.java +++ b/src/main/java/au/com/rayh/AppFileFilter.java @@ -1,3 +1,27 @@ +/* + * The MIT License + * + * Copyright (c) 2011 Ray Yamamoto Hilton + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + /* * To change this template, choose Tools | Templates * and open the template in the editor. diff --git a/src/main/java/au/com/rayh/XCodeBuildOutputParser.java b/src/main/java/au/com/rayh/XCodeBuildOutputParser.java index 463d6945..361a773c 100644 --- a/src/main/java/au/com/rayh/XCodeBuildOutputParser.java +++ b/src/main/java/au/com/rayh/XCodeBuildOutputParser.java @@ -1,3 +1,27 @@ +/* + * The MIT License + * + * Copyright (c) 2011 Ray Yamamoto Hilton + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + /* * To change this template, choose Tools | Templates * and open the template in the editor. diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index fdc7495c..509f227f 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -1,3 +1,27 @@ +/* + * The MIT License + * + * Copyright (c) 2011 Ray Yamamoto Hilton + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package au.com.rayh; import com.google.common.collect.Lists; import hudson.EnvVars; @@ -143,7 +167,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Fails the build return false; } - + } listener.getLogger().println("Marketing version (CFBundleShortVersionString) used by Jenkins to produce the IPA :" + cfBundleShortVersionString); @@ -154,7 +178,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis listener.getLogger().println("Cleaning build directory (" + projectRoot.child("build") + ")"); buildDirectory.deleteRecursive(); } - + // remove test-reports and *.ipa listener.getLogger().println("Cleaning up test-reports"); projectRoot.child("test-reports").deleteRecursive(); @@ -171,7 +195,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis commandLine.add(target); xcodeReport.append("target: ").append(target); } - + if(!StringUtils.isEmpty(sdk)) { commandLine.add("-sdk"); commandLine.add(sdk); @@ -199,7 +223,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis xcodeReport.append(", clean: NO"); } commandLine.add("build"); - + listener.getLogger().println(xcodeReport.toString()); returnCode = launcher.launch().envs(envs).cmds(commandLine).stdout(reportGenerator.getOutputStream()).pwd(projectRoot).join(); if(reportGenerator.getExitCode()!=0) return false; @@ -227,13 +251,13 @@ else if (cfBundleVersion.isEmpty()) String baseName = app.getBaseName().replaceAll(" ","_") + "-" + configuration.replaceAll(" ","_") + (version.isEmpty() ? "" : "-"+version); - + FilePath ipaLocation = buildDirectory.child(baseName + ".ipa"); FilePath payload = buildDirectory.child("Payload"); payload.deleteRecursive(); payload.mkdirs(); - + listener.getLogger().println("Packaging " + app.getBaseName() + ".app => " + ipaLocation); List packageCommandLine = new ArrayList(); @@ -250,7 +274,7 @@ else if (cfBundleVersion.isEmpty()) packageCommandLine.add("--embed"); packageCommandLine.add(embeddedProfileFile); } - + returnCode = launcher.launch().envs(envs).stdout(listener).pwd(projectRoot).cmds(packageCommandLine).join(); if(returnCode>0) { listener.getLogger().println("Failed to build " + ipaLocation.getName()); diff --git a/src/main/java/au/com/rayh/report/TestCase.java b/src/main/java/au/com/rayh/report/TestCase.java index 9a440305..6c4edce2 100644 --- a/src/main/java/au/com/rayh/report/TestCase.java +++ b/src/main/java/au/com/rayh/report/TestCase.java @@ -1,3 +1,27 @@ +/* + * The MIT License + * + * Copyright (c) 2011 Ray Yamamoto Hilton + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package au.com.rayh.report; import java.util.ArrayList; diff --git a/src/main/java/au/com/rayh/report/TestFailure.java b/src/main/java/au/com/rayh/report/TestFailure.java index a5e3b1fd..e6a37408 100644 --- a/src/main/java/au/com/rayh/report/TestFailure.java +++ b/src/main/java/au/com/rayh/report/TestFailure.java @@ -1,3 +1,27 @@ +/* + * The MIT License + * + * Copyright (c) 2011 Ray Yamamoto Hilton + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package au.com.rayh.report; import javax.xml.bind.annotation.XmlAccessType; diff --git a/src/main/java/au/com/rayh/report/TestSuite.java b/src/main/java/au/com/rayh/report/TestSuite.java index 262456cb..5f133269 100644 --- a/src/main/java/au/com/rayh/report/TestSuite.java +++ b/src/main/java/au/com/rayh/report/TestSuite.java @@ -1,3 +1,27 @@ +/* + * The MIT License + * + * Copyright (c) 2011 Ray Yamamoto Hilton + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package au.com.rayh.report; import java.util.ArrayList; diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 83f452e0..f4268b07 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -1,4 +1,28 @@ + + + - - diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly index b3c739b3..1442ed2f 100644 --- a/src/main/resources/index.jelly +++ b/src/main/resources/index.jelly @@ -1,3 +1,27 @@ + + +

The pattern to set the CFBundleVersion.
diff --git a/src/main/webapp/help-buildIpa.html b/src/main/webapp/help-buildIpa.html index d9ca35de..76f152a5 100644 --- a/src/main/webapp/help-buildIpa.html +++ b/src/main/webapp/help-buildIpa.html @@ -1,3 +1,27 @@ + +

Checking this option will create a .ipa for each .app found in the build directory. An .ipa is basically a zipped up .app. This is quite handy for distributing ad-hoc builds to testers as they can just double-click the .ipa and it will import into iTunes.

diff --git a/src/main/webapp/help-cfBundleShortVersionStringPattern.html b/src/main/webapp/help-cfBundleShortVersionStringPattern.html index 089890a9..25432fb3 100644 --- a/src/main/webapp/help-cfBundleShortVersionStringPattern.html +++ b/src/main/webapp/help-cfBundleShortVersionStringPattern.html @@ -1,3 +1,27 @@ + +

This will set the CFBundleShortVersionString to the specified string.
diff --git a/src/main/webapp/help-cleanBeforeBuild.html b/src/main/webapp/help-cleanBeforeBuild.html index c1964315..68d3390e 100644 --- a/src/main/webapp/help-cleanBeforeBuild.html +++ b/src/main/webapp/help-cleanBeforeBuild.html @@ -1,3 +1,27 @@ + +

This will delete the build directories before invoking the build. This will force the rebuilding of ALL dependencies and can make large projects take a lot longer. diff --git a/src/main/webapp/help-configuration.html b/src/main/webapp/help-configuration.html index 2d165bf7..4d6447b9 100644 --- a/src/main/webapp/help-configuration.html +++ b/src/main/webapp/help-configuration.html @@ -1,3 +1,27 @@ + +

This is the name of the configuration as defined in the XCode project. By default there are Debug and Release configurations. diff --git a/src/main/webapp/help-embeddedProfileFile.html b/src/main/webapp/help-embeddedProfileFile.html index eca92585..3af33629 100644 --- a/src/main/webapp/help-embeddedProfileFile.html +++ b/src/main/webapp/help-embeddedProfileFile.html @@ -1,3 +1,27 @@ + +

The relative path to the mobileprovision to embed, leave blank for no embedded profile. diff --git a/src/main/webapp/help-sdk.html b/src/main/webapp/help-sdk.html index c49d200f..5b50ea9f 100644 --- a/src/main/webapp/help-sdk.html +++ b/src/main/webapp/help-sdk.html @@ -1,3 +1,27 @@ + +

You only need to supply this value if you want to specify the SDK to build against. If empty, the SDK will be determined by XCode. If you wish to run OCUnit tests, you will need to use the iPhone Simulator's SDK, for example: diff --git a/src/main/webapp/help-target.html b/src/main/webapp/help-target.html index 55d81cd3..82f4fa53 100644 --- a/src/main/webapp/help-target.html +++ b/src/main/webapp/help-target.html @@ -1,3 +1,27 @@ + +

The target to build. If left empty, this will build all targets in the project. If you wish to build your binary and the unit test module, it is best to do this as two separate steps each with their own target. This was, the iPhone Simulator SDK can be specified for the unit tests. diff --git a/src/main/webapp/help-xcodeProjectFile.html b/src/main/webapp/help-xcodeProjectFile.html index fa74f89a..f61aa11b 100644 --- a/src/main/webapp/help-xcodeProjectFile.html +++ b/src/main/webapp/help-xcodeProjectFile.html @@ -1,3 +1,27 @@ + +

If there is more than one XCode project file in the project path, you will need to specify the file name of the project you wish to build. If you need to build all project, you will need to create an XCode build step for each one manually. diff --git a/src/main/webapp/help-xcodeProjectPath.html b/src/main/webapp/help-xcodeProjectPath.html index 6228144b..b3d9f707 100644 --- a/src/main/webapp/help-xcodeProjectPath.html +++ b/src/main/webapp/help-xcodeProjectPath.html @@ -1,3 +1,27 @@ + +

This is the relative path from the workspace to the directory that contains the XCode project file. You only need to supply this value if the XCode project you wish to build is not in the root of the workspace. diff --git a/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java b/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java index 4d5f825d..7b377375 100644 --- a/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java +++ b/src/test/java/au/com/rayh/XCodeBuildOutputParserTest.java @@ -1,3 +1,27 @@ +/* + * The MIT License + * + * Copyright (c) 2011 Ray Yamamoto Hilton + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + /* * To change this template, choose Tools | Templates * and open the template in the editor. From 56b0e1ee00294213a62a3cc51d191c69c9bddb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sat, 12 Nov 2011 23:28:57 +0100 Subject: [PATCH 28/91] i18n --- src/main/java/au/com/rayh/XCodeBuilder.java | 56 ++++++++++--------- .../resources/au/com/rayh/Messages.properties | 50 +++++++++++++++++ 2 files changed, 79 insertions(+), 27 deletions(-) create mode 100644 src/main/resources/au/com/rayh/Messages.properties diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 509f227f..4d0f56fb 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -85,27 +85,29 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // check that the configured tools exist if(!new FilePath(projectRoot.getChannel(), getDescriptor().xcodebuildPath()).exists()) { - listener.fatalError("Cannot find xcodebuild with the configured path {0}", getDescriptor().xcodebuildPath()); + listener.fatalError(Messages.XCodeBuilder_xcodebuildNotFound(getDescriptor().xcodebuildPath())); + return false; } if(!new FilePath(projectRoot.getChannel(), getDescriptor().agvtoolPath()).exists()) { - listener.fatalError("Cannot find agvtool with the configured path {0}", getDescriptor().agvtoolPath()); + listener.fatalError(Messages.XCodeBuilder_avgtoolNotFound(getDescriptor().agvtoolPath())); + return false; } // Set the working directory if(!StringUtils.isEmpty(xcodeProjectPath)) { projectRoot = projectRoot.child(xcodeProjectPath); } - listener.getLogger().println("Working directory is " + projectRoot); + listener.getLogger().println(Messages.XCodeBuilder_workingDir(projectRoot)); FilePath buildDirectory = projectRoot.child("build").child(configuration + "-iphoneos"); // XCode Version int returnCode = launcher.launch().envs(envs).cmds(getDescriptor().xcodebuildPath(), "-version").stdout(listener).pwd(projectRoot).join(); if(returnCode>0){ - listener.fatalError("Check your XCode installation. Jenkins cannot retrieve its version."); + listener.fatalError(Messages.XCodeBuilder_xcodeVersionNotFound()); return false; // We fail the build if XCode isn't deployed } - listener.getLogger().println("Fetching marketing version number (CFBundleShortVersionString) from project."); + listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleShortVersionString()); ByteArrayOutputStream output = new ByteArrayOutputStream(); String cfBundleShortVersionString=""; returnCode = launcher.launch().envs(envs).cmds("agvtool", "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); @@ -113,9 +115,9 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis if(returnCode==0) cfBundleShortVersionString = output.toString().trim(); if(cfBundleShortVersionString.isEmpty()) - listener.getLogger().println("No marketing version found (CFBundleShortVersionString)"); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringNotFound()); else - listener.getLogger().println("Found marketing version (CFBundleShortVersionString)"+cfBundleShortVersionString); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringFound(cfBundleShortVersionString)); String cfBundleVersion=""; returnCode = launcher.launch().envs(envs).cmds("agvtool", "vers", "-terse").stdout(output).pwd(projectRoot).join(); @@ -123,12 +125,12 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis if(returnCode==0) cfBundleVersion = output.toString().trim(); if(cfBundleVersion.isEmpty()) - listener.getLogger().println("No marketing version found (CFBundleVersion)"); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionNotFound()); else - listener.getLogger().println("Found marketing version (CFBundleVersion)"+cfBundleShortVersionString); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionFound(cfBundleShortVersionString)); - listener.getLogger().println("Marketing version (CFBundleShortVersionString) found in project configuration :" + cfBundleShortVersionString); - listener.getLogger().println("Technical version (CFBundleVersion) found in project configuration :"+ cfBundleVersion); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringValue(cfBundleShortVersionString)); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionValue(cfBundleVersion)); // Update the Marketing version (CFBundleShortVersionString) if( false == StringUtils.isEmpty(cfBundleShortVersionStringPattern) ) { @@ -136,14 +138,14 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin cfBundleShortVersionString = TokenMacro.expand(build, listener, cfBundleShortVersionStringPattern); - listener.getLogger().println("Updating marketing version (CFBundleShortVersionString) to " + cfBundleShortVersionString); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringUpdate(cfBundleShortVersionString)); returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-marketing-version", cfBundleShortVersionString).stdout(listener).pwd(projectRoot).join(); if(returnCode>0) { - listener.fatalError("Could not set CFBundleShortVersionString to " + cfBundleShortVersionString); + listener.fatalError(Messages.XCodeBuilder_CFBundleShortVersionStringUpdateError(cfBundleShortVersionString)); return false; } } catch (MacroEvaluationException e) { - listener.fatalError("Failure while expanding macros for CFBundleShortVersionString. Error : "+e.getMessage()); + listener.fatalError(Messages.XCodeBuilder_CFBundleShortVersionStringMacroError(e.getMessage())); return false; } } @@ -159,32 +161,32 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis listener.getLogger().println("CFBundleShortVersionString is " + cfBundleShortVersionString + " so new CFBundleVersion will be updated to " + cfBundleVersion); returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-version", "-all", cfBundleVersion ).stdout(listener).pwd(projectRoot).join(); if(returnCode>0) { - listener.fatalError("Could not set the CFBundleVersion to " + cfBundleVersion); + listener.fatalError(Messages.XCodeBuilder_CFBundleVersionUpdateError(cfBundleVersion)); return false; } } catch (MacroEvaluationException e) { - listener.fatalError("Failure while expanding macros for CFBundleVersion. Error : "+e.getMessage()); + listener.fatalError(Messages.XCodeBuilder_CFBundleVersionMacroError(e.getMessage())); // Fails the build return false; } } - listener.getLogger().println("Marketing version (CFBundleShortVersionString) used by Jenkins to produce the IPA :" + cfBundleShortVersionString); - listener.getLogger().println("Technical version (CFBundleVersion) used by Jenkins to produce the IPA :"+ cfBundleVersion); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringUsed(cfBundleShortVersionString)); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionUsed(cfBundleVersion)); // Clean build directories if(cleanBeforeBuild) { - listener.getLogger().println("Cleaning build directory (" + projectRoot.child("build") + ")"); + listener.getLogger().println(Messages.XCodeBuilder_cleaningBuildDir(projectRoot.child("build"))); buildDirectory.deleteRecursive(); } // remove test-reports and *.ipa - listener.getLogger().println("Cleaning up test-reports"); + listener.getLogger().println(Messages.XCodeBuilder_cleaningTestReportsDir()); projectRoot.child("test-reports").deleteRecursive(); // Build - StringBuilder xcodeReport = new StringBuilder("Going to invoke xcodebuild: "); + StringBuilder xcodeReport = new StringBuilder(Messages.XCodeBuilder_invokeXcodebuild()); XCodeBuildOutputParser reportGenerator = new XCodeBuildOutputParser(projectRoot, listener); List commandLine = Lists.newArrayList(getDescriptor().xcodebuildPath()); if(StringUtils.isEmpty(target)) { @@ -232,12 +234,12 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Package IPA if(buildIpa) { - listener.getLogger().println("Cleaning up previously generate .ipa files"); + listener.getLogger().println(Messages.XCodeBuilder_cleaningIPA()); for(FilePath path : buildDirectory.list("*.ipa")) { path.delete(); } - listener.getLogger().println("Packaging IPA"); + listener.getLogger().println(Messages.XCodeBuilder_packagingIPA()); List apps = buildDirectory.list(new AppFileFilter()); for(FilePath app : apps) { @@ -284,7 +286,7 @@ else if (cfBundleVersion.isEmpty()) // also zip up the symbols, if present returnCode = launcher.launch().envs(envs).stdout(listener).pwd(buildDirectory).cmds("zip", "-r", "-T", "-y", baseName + "-dSYM.zip", app.getBaseName() + ".app.dSYM").join(); if(returnCode>0) { - listener.getLogger().println("Failed to zip *.dSYM into " + baseName + "-dSYM.zip"); + listener.getLogger().println(Messages.XCodeBuilder_zipFailed(baseName)); continue; } @@ -320,7 +322,7 @@ public FormValidation doCheckConfiguration(@QueryParameter String value) throws public FormValidation doCheckXcodebuildPath(@QueryParameter String value) throws IOException, ServletException { if (StringUtils.isEmpty(value)) { - return FormValidation.error("Please specify the path to the xcodebuild executable (usually /usr/bin/xcodebuild)"); + return FormValidation.error(Messages.XCodeBuilder_xcodebuildPathNotSet()); } else { // TODO: check that the file exists } @@ -329,7 +331,7 @@ public FormValidation doCheckXcodebuildPath(@QueryParameter String value) throws public FormValidation doCheckAgvtoolPath(@QueryParameter String value) throws IOException, ServletException { if(StringUtils.isEmpty(value)) - return FormValidation.error("Please specify the path to the agvtool executable (usually /usr/bin/agvtool)"); + return FormValidation.error(Messages.XCodeBuilder_agvtoolPathNotSet()); else { // TODO: check that the file exists } @@ -342,7 +344,7 @@ public boolean isApplicable(Class aClass) { } public String getDisplayName() { - return "XCode"; + return Messages.XCodeBuilder_xcode(); } @Override diff --git a/src/main/resources/au/com/rayh/Messages.properties b/src/main/resources/au/com/rayh/Messages.properties new file mode 100644 index 00000000..2f18018a --- /dev/null +++ b/src/main/resources/au/com/rayh/Messages.properties @@ -0,0 +1,50 @@ +# +# The MIT License +# +# Copyright (c) 2011 Ray Yamamoto Hilton +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +XCodeBuilder.xcodebuildNotFound=Cannot find xcodebuild with the configured path {0}. +XCodeBuilder.avgtoolNotFound=Cannot find agvtool with the configured path {0}. +XCodeBuilder.cleaningBuildDir=Cleaning build directory: {0} +XCodeBuilder.cleaningIPA=Cleaning up previously generate .ipa files +XCodeBuilder.cleaningTestReportsDir=Cleaning up test-reports +XCodeBuilder.fetchingCFBundleShortVersionString=Fetching marketing version number (CFBundleShortVersionString) from project. +XCodeBuilder.invokeXcodebuild=Going to invoke xcodebuild: +XCodeBuilder.packagingIPA=Packaging IPA +XCodeBuilder.workingDir=Working directory is {0}. +XCodeBuilder.xcode=XCode +XCodeBuilder.xcodeVersionNotFound=Check your XCode installation. Jenkins cannot retrieve its version. +XCodeBuilder.CFBundleShortVersionStringNotFound=No marketing version found (CFBundleShortVersionString). +XCodeBuilder.CFBundleShortVersionStringFound=Found marketing version (CFBundleShortVersionString): {0}. +XCodeBuilder.CFBundleShortVersionStringMacroError=Failure while expanding macros for CFBundleShortVersionString. Error: {0} +XCodeBuilder.CFBundleShortVersionStringUpdate=Updating marketing version (CFBundleShortVersionString) to: {0} +XCodeBuilder.CFBundleShortVersionStringUpdateError=Could not set CFBundleShortVersionString to: {0} +XCodeBuilder.CFBundleShortVersionStringUsed=Marketing version (CFBundleShortVersionString) used by Jenkins to produce the IPA: {0} +XCodeBuilder.CFBundleShortVersionStringValue=Marketing version (CFBundleShortVersionString) found in project configuration: {0}. +XCodeBuilder.CFBundleVersionFound=Found marketing version (CFBundleVersion): {0}. +XCodeBuilder.CFBundleVersionMacroError=Failure while expanding macros for CFBundleVersion. Error: {0} +XCodeBuilder.CFBundleVersionNotFound=No marketing version found (CFBundleVersion) +XCodeBuilder.CFBundleVersionUpdateError=Could not set the CFBundleVersion to: {0} +XCodeBuilder.CFBundleVersionUsed=Technical version (CFBundleVersion) used by Jenkins to produce the IPA: {0} +XCodeBuilder.CFBundleVersionValue=Technical version (CFBundleVersion) found in project configuration: {0}. +XCodeBuilder.agvtoolPathNotSet=Please specify the path to the agvtool executable (usually /usr/bin/agvtool) +XCodeBuilder.xcodebuildPathNotSet=Please specify the path to the xcodebuild executable (usually /usr/bin/xcodebuild) +XCodeBuilder.zipFailed=Failed to zip *.dSYM into {0}-dSYM.zip \ No newline at end of file From 2f0073b184b2acce39b9b1da7d85207bf5776dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sat, 12 Nov 2011 23:31:45 +0100 Subject: [PATCH 29/91] Cleanup old code/comments --- src/main/java/au/com/rayh/XCodeBuilder.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 4d0f56fb..74276e49 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -290,10 +290,6 @@ else if (cfBundleVersion.isEmpty()) continue; } - //listener.getLogger().println("Copying to " + app.getBaseName() + ".ipa"); - //ipaLocation.copyTo(buildDirectory.child(app.getBaseName() + ".ipa")); - - payload.deleteRecursive(); } } @@ -351,10 +347,6 @@ public String getDisplayName() { public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { // To persist global configuration information, // set that to properties and call save(). -// updateBuildNumber = formData.getBoolean("updateBuildNumber"); -// buildIpa = formData.getBoolean("buildIpa"); -// cleanBeforeBuild = formData.getBoolean("cleanBeforeBuild"); -// configuration = formData.getString("configuration"); xcodebuildPath = formData.getString("xcodebuildPath"); agvtoolPath = formData.getString("agvtoolPath"); // ^Can also use req.bindJSON(this, formData); From 9c1822ea7ccf9f73c5731907c2eb2e6b9d962c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sat, 12 Nov 2011 23:45:02 +0100 Subject: [PATCH 30/91] Fix deprecated stuffs --- src/main/java/au/com/rayh/XCodeBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 74276e49..8dfde746 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -81,7 +81,7 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configura @Override public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { EnvVars envs = build.getEnvironment(listener); - FilePath projectRoot = build.getProject().getWorkspace(); + FilePath projectRoot = build.getWorkspace(); // check that the configured tools exist if(!new FilePath(projectRoot.getChannel(), getDescriptor().xcodebuildPath()).exists()) { @@ -271,7 +271,7 @@ else if (cfBundleVersion.isEmpty()) } else { packageCommandLine.add("iphoneos"); } - packageCommandLine.addAll(Lists.newArrayList("PackageApplication", "-v", app.toString(), "-o", ipaLocation.toString())); + packageCommandLine.addAll(Lists.newArrayList("PackageApplication", "-v", app.getRemote(), "-o", ipaLocation.getRemote())); if(!StringUtils.isEmpty(embeddedProfileFile)) { packageCommandLine.add("--embed"); packageCommandLine.add(embeddedProfileFile); From 03368b03596b85f3961a930640fabcca54dd0af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 13 Nov 2011 00:12:29 +0100 Subject: [PATCH 31/91] Simplify technical/marketing versions management. Only allow to override them. We'll see later if we provide something more complex to manage them and for example to reuse the marketing number from the project configuration into the technical number. --- src/main/java/au/com/rayh/XCodeBuilder.java | 31 ++++++++++--------- .../resources/au/com/rayh/Messages.properties | 2 ++ .../au/com/rayh/XCodeBuilder/config.jelly | 16 +++++----- ...help-cfBundleShortVersionStringValue.html} | 0 ...rn.html => help-cfBundleVersionValue.html} | 8 ++--- 5 files changed, 29 insertions(+), 28 deletions(-) rename src/main/webapp/{help-cfBundleShortVersionStringPattern.html => help-cfBundleShortVersionStringValue.html} (100%) rename src/main/webapp/{help-CFBundleVersionPattern.html => help-cfBundleVersionValue.html} (73%) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 8dfde746..4814a1eb 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -55,27 +55,27 @@ public class XCodeBuilder extends Builder { public final Boolean buildIpa; public final Boolean cleanBeforeBuild; public final String configuration; - public final String cfBundleShortVersionStringPattern; public final String target; public final String sdk; public final String xcodeProjectPath; public final String xcodeProjectFile; public final String embeddedProfileFile; - public final String cfBundleVersionPattern; + public final String cfBundleVersionValue; + public final String cfBundleShortVersionStringValue; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionPattern, String cfBundleShortVersionStringPattern) { + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue) { this.buildIpa = buildIpa; this.sdk = sdk; this.target = target; this.cleanBeforeBuild = cleanBeforeBuild; - this.cfBundleShortVersionStringPattern = cfBundleShortVersionStringPattern; this.configuration = configuration; this.xcodeProjectPath = xcodeProjectPath; this.xcodeProjectFile = xcodeProjectFile; this.embeddedProfileFile = embeddedProfileFile; - this.cfBundleVersionPattern = cfBundleVersionPattern; + this.cfBundleVersionValue = cfBundleVersionValue; + this.cfBundleShortVersionStringValue = cfBundleShortVersionStringValue; } @Override @@ -107,8 +107,10 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis return false; // We fail the build if XCode isn't deployed } - listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleShortVersionString()); ByteArrayOutputStream output = new ByteArrayOutputStream(); + + // Try to read CFBundleShortVersionString from project + listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleShortVersionString()); String cfBundleShortVersionString=""; returnCode = launcher.launch().envs(envs).cmds("agvtool", "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); // only use this version number if we found it @@ -119,6 +121,8 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis else listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringFound(cfBundleShortVersionString)); + // Try to read CFBundleVersion from project + listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleVersion()); String cfBundleVersion=""; returnCode = launcher.launch().envs(envs).cmds("agvtool", "vers", "-terse").stdout(output).pwd(projectRoot).join(); // only use this version number if we found it @@ -133,11 +137,11 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionValue(cfBundleVersion)); // Update the Marketing version (CFBundleShortVersionString) - if( false == StringUtils.isEmpty(cfBundleShortVersionStringPattern) ) { + if( ! StringUtils.isEmpty(cfBundleShortVersionStringValue) ) { try { // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin - cfBundleShortVersionString = TokenMacro.expand(build, listener, cfBundleShortVersionStringPattern); + cfBundleShortVersionString = TokenMacro.expand(build, listener, cfBundleShortVersionStringValue); listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringUpdate(cfBundleShortVersionString)); returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-marketing-version", cfBundleShortVersionString).stdout(listener).pwd(projectRoot).join(); if(returnCode>0) { @@ -150,15 +154,13 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis } } - if( ! StringUtils.isEmpty(cfBundleVersionPattern) ) { + // Update the Technical version (CFBundleVersion) + if( ! StringUtils.isEmpty(cfBundleVersionValue) ) { try { // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin - String technicalVersion = TokenMacro.expand(build, listener, cfBundleVersionPattern); - output = new ByteArrayOutputStream(); - // Read the current Marketing Version in the project - cfBundleVersion = cfBundleShortVersionString.isEmpty() ? technicalVersion : cfBundleShortVersionString + "_" + technicalVersion; - listener.getLogger().println("CFBundleShortVersionString is " + cfBundleShortVersionString + " so new CFBundleVersion will be updated to " + cfBundleVersion); + cfBundleVersion = TokenMacro.expand(build, listener, cfBundleVersionValue); + listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionUpdate(cfBundleVersion)); returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-version", "-all", cfBundleVersion ).stdout(listener).pwd(projectRoot).join(); if(returnCode>0) { listener.fatalError(Messages.XCodeBuilder_CFBundleVersionUpdateError(cfBundleVersion)); @@ -169,7 +171,6 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Fails the build return false; } - } listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringUsed(cfBundleShortVersionString)); diff --git a/src/main/resources/au/com/rayh/Messages.properties b/src/main/resources/au/com/rayh/Messages.properties index 2f18018a..5a1ef7d4 100644 --- a/src/main/resources/au/com/rayh/Messages.properties +++ b/src/main/resources/au/com/rayh/Messages.properties @@ -27,6 +27,7 @@ XCodeBuilder.cleaningBuildDir=Cleaning build directory: {0} XCodeBuilder.cleaningIPA=Cleaning up previously generate .ipa files XCodeBuilder.cleaningTestReportsDir=Cleaning up test-reports XCodeBuilder.fetchingCFBundleShortVersionString=Fetching marketing version number (CFBundleShortVersionString) from project. +XCodeBuilder.fetchingCFBundleVersion=Fetching technical version number (CFBundleVersion) from project. XCodeBuilder.invokeXcodebuild=Going to invoke xcodebuild: XCodeBuilder.packagingIPA=Packaging IPA XCodeBuilder.workingDir=Working directory is {0}. @@ -42,6 +43,7 @@ XCodeBuilder.CFBundleShortVersionStringValue=Marketing version (CFBundleShortVer XCodeBuilder.CFBundleVersionFound=Found marketing version (CFBundleVersion): {0}. XCodeBuilder.CFBundleVersionMacroError=Failure while expanding macros for CFBundleVersion. Error: {0} XCodeBuilder.CFBundleVersionNotFound=No marketing version found (CFBundleVersion) +XCodeBuilder.CFBundleVersionUpdate=Updating technical version (CFBundleVersion) to: {0} XCodeBuilder.CFBundleVersionUpdateError=Could not set the CFBundleVersion to: {0} XCodeBuilder.CFBundleVersionUsed=Technical version (CFBundleVersion) used by Jenkins to produce the IPA: {0} XCodeBuilder.CFBundleVersionValue=Technical version (CFBundleVersion) found in project configuration: {0}. diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index f4268b07..4e518040 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -63,16 +63,16 @@ - - + + - - + +

- The pattern to set the CFBundleVersion.
+ This will set the CFBundleVersion to the specified string.
Supports all macros from the Token Macro Plugin.
For example the value ${BUILD_NUMBER} will be replaced with the current build number.
- It will be CFBundleShortVersionString + "_" + this evaluated field.
- If CFBundleShortVersionString equals 2.0.0 and CFBundleVersion pattern is "${BUILD_NUMBER}" then for the build #42 you'll have CFBundleVersion equals to 2.0.0_48.
- You should use CFBundleShortVersionString (i.e. the marketing version) to provide a public-facing version number such as 2.0.1
- Keep it empty to not override the version defined in your project.
+ We advice you to generate a unique value for each build if you want for example deploy it into a private store.
+ In that case you can use for example : ${JOBNAME}-${BUILD_NUMBER}

From adca6957afc04a48fb5cc73d0be3100fc995e79d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 13 Nov 2011 00:32:28 +0100 Subject: [PATCH 32/91] Allow to configure xcrun path --- src/main/java/au/com/rayh/XCodeBuilder.java | 83 +++++++++++-------- .../resources/au/com/rayh/Messages.properties | 2 + .../au/com/rayh/XCodeBuilder/global.jelly | 3 + 3 files changed, 54 insertions(+), 34 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 4814a1eb..b3d3288b 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -23,6 +23,7 @@ */ package au.com.rayh; + import com.google.common.collect.Lists; import hudson.EnvVars; import hudson.Extension; @@ -84,17 +85,17 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis FilePath projectRoot = build.getWorkspace(); // check that the configured tools exist - if(!new FilePath(projectRoot.getChannel(), getDescriptor().xcodebuildPath()).exists()) { + if (!new FilePath(projectRoot.getChannel(), getDescriptor().xcodebuildPath()).exists()) { listener.fatalError(Messages.XCodeBuilder_xcodebuildNotFound(getDescriptor().xcodebuildPath())); return false; } - if(!new FilePath(projectRoot.getChannel(), getDescriptor().agvtoolPath()).exists()) { + if (!new FilePath(projectRoot.getChannel(), getDescriptor().agvtoolPath()).exists()) { listener.fatalError(Messages.XCodeBuilder_avgtoolNotFound(getDescriptor().agvtoolPath())); return false; } // Set the working directory - if(!StringUtils.isEmpty(xcodeProjectPath)) { + if (!StringUtils.isEmpty(xcodeProjectPath)) { projectRoot = projectRoot.child(xcodeProjectPath); } listener.getLogger().println(Messages.XCodeBuilder_workingDir(projectRoot)); @@ -102,7 +103,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // XCode Version int returnCode = launcher.launch().envs(envs).cmds(getDescriptor().xcodebuildPath(), "-version").stdout(listener).pwd(projectRoot).join(); - if(returnCode>0){ + if (returnCode > 0) { listener.fatalError(Messages.XCodeBuilder_xcodeVersionNotFound()); return false; // We fail the build if XCode isn't deployed } @@ -111,24 +112,24 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Try to read CFBundleShortVersionString from project listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleShortVersionString()); - String cfBundleShortVersionString=""; + String cfBundleShortVersionString = ""; returnCode = launcher.launch().envs(envs).cmds("agvtool", "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); // only use this version number if we found it - if(returnCode==0) + if (returnCode == 0) cfBundleShortVersionString = output.toString().trim(); - if(cfBundleShortVersionString.isEmpty()) + if (cfBundleShortVersionString.isEmpty()) listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringNotFound()); else listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringFound(cfBundleShortVersionString)); // Try to read CFBundleVersion from project listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleVersion()); - String cfBundleVersion=""; + String cfBundleVersion = ""; returnCode = launcher.launch().envs(envs).cmds("agvtool", "vers", "-terse").stdout(output).pwd(projectRoot).join(); // only use this version number if we found it - if(returnCode==0) + if (returnCode == 0) cfBundleVersion = output.toString().trim(); - if(cfBundleVersion.isEmpty()) + if (cfBundleVersion.isEmpty()) listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionNotFound()); else listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionFound(cfBundleShortVersionString)); @@ -137,14 +138,14 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionValue(cfBundleVersion)); // Update the Marketing version (CFBundleShortVersionString) - if( ! StringUtils.isEmpty(cfBundleShortVersionStringValue) ) { + if (!StringUtils.isEmpty(cfBundleShortVersionStringValue)) { try { // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin cfBundleShortVersionString = TokenMacro.expand(build, listener, cfBundleShortVersionStringValue); listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringUpdate(cfBundleShortVersionString)); returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-marketing-version", cfBundleShortVersionString).stdout(listener).pwd(projectRoot).join(); - if(returnCode>0) { + if (returnCode > 0) { listener.fatalError(Messages.XCodeBuilder_CFBundleShortVersionStringUpdateError(cfBundleShortVersionString)); return false; } @@ -155,14 +156,14 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis } // Update the Technical version (CFBundleVersion) - if( ! StringUtils.isEmpty(cfBundleVersionValue) ) { + if (!StringUtils.isEmpty(cfBundleVersionValue)) { try { // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin cfBundleVersion = TokenMacro.expand(build, listener, cfBundleVersionValue); listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionUpdate(cfBundleVersion)); - returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-version", "-all", cfBundleVersion ).stdout(listener).pwd(projectRoot).join(); - if(returnCode>0) { + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-version", "-all", cfBundleVersion).stdout(listener).pwd(projectRoot).join(); + if (returnCode > 0) { listener.fatalError(Messages.XCodeBuilder_CFBundleVersionUpdateError(cfBundleVersion)); return false; } @@ -177,7 +178,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionUsed(cfBundleVersion)); // Clean build directories - if(cleanBeforeBuild) { + if (cleanBeforeBuild) { listener.getLogger().println(Messages.XCodeBuilder_cleaningBuildDir(projectRoot.child("build"))); buildDirectory.deleteRecursive(); } @@ -190,7 +191,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis StringBuilder xcodeReport = new StringBuilder(Messages.XCodeBuilder_invokeXcodebuild()); XCodeBuildOutputParser reportGenerator = new XCodeBuildOutputParser(projectRoot, listener); List commandLine = Lists.newArrayList(getDescriptor().xcodebuildPath()); - if(StringUtils.isEmpty(target)) { + if (StringUtils.isEmpty(target)) { commandLine.add("-alltargets"); xcodeReport.append("target: ALL"); } else { @@ -199,7 +200,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis xcodeReport.append("target: ").append(target); } - if(!StringUtils.isEmpty(sdk)) { + if (!StringUtils.isEmpty(sdk)) { commandLine.add("-sdk"); commandLine.add(sdk); xcodeReport.append(", sdk: ").append(sdk); @@ -207,7 +208,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis xcodeReport.append(", sdk: DEFAULT"); } - if(!StringUtils.isEmpty(xcodeProjectFile)) { + if (!StringUtils.isEmpty(xcodeProjectFile)) { commandLine.add("-project"); commandLine.add(xcodeProjectFile); xcodeReport.append(", project: ").append(xcodeProjectFile); @@ -229,31 +230,31 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis listener.getLogger().println(xcodeReport.toString()); returnCode = launcher.launch().envs(envs).cmds(commandLine).stdout(reportGenerator.getOutputStream()).pwd(projectRoot).join(); - if(reportGenerator.getExitCode()!=0) return false; - if(returnCode>0) return false; + if (reportGenerator.getExitCode() != 0) return false; + if (returnCode > 0) return false; // Package IPA - if(buildIpa) { + if (buildIpa) { listener.getLogger().println(Messages.XCodeBuilder_cleaningIPA()); - for(FilePath path : buildDirectory.list("*.ipa")) { + for (FilePath path : buildDirectory.list("*.ipa")) { path.delete(); } listener.getLogger().println(Messages.XCodeBuilder_packagingIPA()); List apps = buildDirectory.list(new AppFileFilter()); - for(FilePath app : apps) { + for (FilePath app : apps) { String version = ""; if (cfBundleShortVersionString.isEmpty() && cfBundleVersion.isEmpty()) - version = ""+build.getNumber(); + version = "" + build.getNumber(); else if (cfBundleVersion.isEmpty()) version = cfBundleShortVersionString; else version = cfBundleVersion; - String baseName = app.getBaseName().replaceAll(" ","_") + "-" + - configuration.replaceAll(" ","_") + (version.isEmpty() ? "" : "-"+version); + String baseName = app.getBaseName().replaceAll(" ", "_") + "-" + + configuration.replaceAll(" ", "_") + (version.isEmpty() ? "" : "-" + version); FilePath ipaLocation = buildDirectory.child(baseName + ".ipa"); @@ -264,29 +265,29 @@ else if (cfBundleVersion.isEmpty()) listener.getLogger().println("Packaging " + app.getBaseName() + ".app => " + ipaLocation); List packageCommandLine = new ArrayList(); - packageCommandLine.add("/usr/bin/xcrun"); + packageCommandLine.add(getDescriptor().xcrunPath()); packageCommandLine.add("-sdk"); - if(!StringUtils.isEmpty(sdk)) { + if (!StringUtils.isEmpty(sdk)) { packageCommandLine.add(sdk); } else { packageCommandLine.add("iphoneos"); } packageCommandLine.addAll(Lists.newArrayList("PackageApplication", "-v", app.getRemote(), "-o", ipaLocation.getRemote())); - if(!StringUtils.isEmpty(embeddedProfileFile)) { + if (!StringUtils.isEmpty(embeddedProfileFile)) { packageCommandLine.add("--embed"); packageCommandLine.add(embeddedProfileFile); } returnCode = launcher.launch().envs(envs).stdout(listener).pwd(projectRoot).cmds(packageCommandLine).join(); - if(returnCode>0) { + if (returnCode > 0) { listener.getLogger().println("Failed to build " + ipaLocation.getName()); continue; } // also zip up the symbols, if present returnCode = launcher.launch().envs(envs).stdout(listener).pwd(buildDirectory).cmds("zip", "-r", "-T", "-y", baseName + "-dSYM.zip", app.getBaseName() + ".app.dSYM").join(); - if(returnCode>0) { + if (returnCode > 0) { listener.getLogger().println(Messages.XCodeBuilder_zipFailed(baseName)); continue; } @@ -300,13 +301,14 @@ else if (cfBundleVersion.isEmpty()) @Override public DescriptorImpl getDescriptor() { - return (DescriptorImpl)super.getDescriptor(); + return (DescriptorImpl) super.getDescriptor(); } @Extension public static final class DescriptorImpl extends BuildStepDescriptor { private String xcodebuildPath = "/usr/bin/xcodebuild"; private String agvtoolPath = "/usr/bin/agvtool"; + private String xcrunPath = "/usr/bin/xcrun"; public FormValidation doCheckConfiguration(@QueryParameter String value) throws IOException, ServletException { if (StringUtils.isEmpty(value)) { @@ -327,7 +329,7 @@ public FormValidation doCheckXcodebuildPath(@QueryParameter String value) throws } public FormValidation doCheckAgvtoolPath(@QueryParameter String value) throws IOException, ServletException { - if(StringUtils.isEmpty(value)) + if (StringUtils.isEmpty(value)) return FormValidation.error(Messages.XCodeBuilder_agvtoolPathNotSet()); else { // TODO: check that the file exists @@ -335,6 +337,15 @@ public FormValidation doCheckAgvtoolPath(@QueryParameter String value) throws IO return FormValidation.ok(); } + public FormValidation doCheckXcrunPath(@QueryParameter String value) throws IOException, ServletException { + if (StringUtils.isEmpty(value)) + return FormValidation.error(Messages.XCodeBuilder_xcrunPathNotSet()); + else { + // TODO: check that the file exists + } + return FormValidation.ok(); + } + public boolean isApplicable(Class aClass) { // indicates that this builder can be used with all kinds of project types return true; @@ -350,6 +361,7 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc // set that to properties and call save(). xcodebuildPath = formData.getString("xcodebuildPath"); agvtoolPath = formData.getString("agvtoolPath"); + xcrunPath = formData.getString("xcrunPath"); // ^Can also use req.bindJSON(this, formData); // (easier when there are many fields; need set* methods for this, like setUseFrench) save(); @@ -364,6 +376,9 @@ public String xcodebuildPath() { return xcodebuildPath; } + public String xcrunPath() { + return xcrunPath; + } } } diff --git a/src/main/resources/au/com/rayh/Messages.properties b/src/main/resources/au/com/rayh/Messages.properties index 5a1ef7d4..8ff70cb6 100644 --- a/src/main/resources/au/com/rayh/Messages.properties +++ b/src/main/resources/au/com/rayh/Messages.properties @@ -23,6 +23,7 @@ # XCodeBuilder.xcodebuildNotFound=Cannot find xcodebuild with the configured path {0}. XCodeBuilder.avgtoolNotFound=Cannot find agvtool with the configured path {0}. +XCodeBuilder.xcrunNotFound=Cannot find xcrun with the configured path {0}. XCodeBuilder.cleaningBuildDir=Cleaning build directory: {0} XCodeBuilder.cleaningIPA=Cleaning up previously generate .ipa files XCodeBuilder.cleaningTestReportsDir=Cleaning up test-reports @@ -49,4 +50,5 @@ XCodeBuilder.CFBundleVersionUsed=Technical version (CFBundleVersion) used by Jen XCodeBuilder.CFBundleVersionValue=Technical version (CFBundleVersion) found in project configuration: {0}. XCodeBuilder.agvtoolPathNotSet=Please specify the path to the agvtool executable (usually /usr/bin/agvtool) XCodeBuilder.xcodebuildPathNotSet=Please specify the path to the xcodebuild executable (usually /usr/bin/xcodebuild) +XCodeBuilder.xcrunPathNotSet=Please specify the path to the xcrun executable (usually /usr/bin/xcrun) XCodeBuilder.zipFailed=Failed to zip *.dSYM into {0}-dSYM.zip \ No newline at end of file diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly index 12e33884..e74fbc6b 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly @@ -30,5 +30,8 @@ + + + From 14feba622493498ac899ae804f81f12d9d899773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 13 Nov 2011 00:36:34 +0100 Subject: [PATCH 33/91] Useless --- src/main/java/au/com/rayh/XCodeBuilder.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index b3d3288b..40c94d59 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -310,15 +310,6 @@ public static final class DescriptorImpl extends BuildStepDescriptor { private String agvtoolPath = "/usr/bin/agvtool"; private String xcrunPath = "/usr/bin/xcrun"; - public FormValidation doCheckConfiguration(@QueryParameter String value) throws IOException, ServletException { - if (StringUtils.isEmpty(value)) { - return FormValidation.error("Please specify a configuration"); - } else { - // TODO: scan project file for specified configuration - } - return FormValidation.ok(); - } - public FormValidation doCheckXcodebuildPath(@QueryParameter String value) throws IOException, ServletException { if (StringUtils.isEmpty(value)) { return FormValidation.error(Messages.XCodeBuilder_xcodebuildPathNotSet()); From 80aceb1e749503d8ffc791af9f96a8a86cc83473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 13 Nov 2011 00:36:45 +0100 Subject: [PATCH 34/91] Update comments --- src/main/java/au/com/rayh/XCodeBuilder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 40c94d59..581ec3e2 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -314,7 +314,7 @@ public FormValidation doCheckXcodebuildPath(@QueryParameter String value) throws if (StringUtils.isEmpty(value)) { return FormValidation.error(Messages.XCodeBuilder_xcodebuildPathNotSet()); } else { - // TODO: check that the file exists + // TODO: check that the file exists (and if an agent is used ?) } return FormValidation.ok(); } @@ -323,7 +323,7 @@ public FormValidation doCheckAgvtoolPath(@QueryParameter String value) throws IO if (StringUtils.isEmpty(value)) return FormValidation.error(Messages.XCodeBuilder_agvtoolPathNotSet()); else { - // TODO: check that the file exists + // TODO: check that the file exists (and if an agent is used ?) } return FormValidation.ok(); } @@ -332,7 +332,7 @@ public FormValidation doCheckXcrunPath(@QueryParameter String value) throws IOEx if (StringUtils.isEmpty(value)) return FormValidation.error(Messages.XCodeBuilder_xcrunPathNotSet()); else { - // TODO: check that the file exists + // TODO: check that the file exists (and if an agent is used ?) } return FormValidation.ok(); } From 8b84e12120708d7129b19ad8d1a421d0b5390615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 13 Nov 2011 00:55:16 +0100 Subject: [PATCH 35/91] Fix macro name used for job name --- src/main/webapp/help-cfBundleVersionValue.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/help-cfBundleVersionValue.html b/src/main/webapp/help-cfBundleVersionValue.html index d8508e54..c5807c36 100644 --- a/src/main/webapp/help-cfBundleVersionValue.html +++ b/src/main/webapp/help-cfBundleVersionValue.html @@ -28,6 +28,6 @@ Supports all macros from the Token Macro Plugin.
For example the value ${BUILD_NUMBER} will be replaced with the current build number.
We advice you to generate a unique value for each build if you want for example deploy it into a private store.
- In that case you can use for example : ${JOBNAME}-${BUILD_NUMBER} + In that case you can use for example : ${JOB_NAME}-${BUILD_NUMBER}

From bed193d1ac4c51b13b52705cc53ec5c312efe124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 13 Nov 2011 23:31:54 +0100 Subject: [PATCH 36/91] New feature : Allow to unlock the keychain (used for packaging) --- src/main/java/au/com/rayh/XCodeBuilder.java | 29 ++++++++++++++++--- .../resources/au/com/rayh/Messages.properties | 1 + .../au/com/rayh/XCodeBuilder/config.jelly | 24 +++++++++++++-- .../webapp/help-cfBundleVersionValue.html | 2 +- src/main/webapp/help-configuration.html | 2 +- src/main/webapp/help-keychainPath.html | 27 +++++++++++++++++ src/main/webapp/help-keychainPwd.html | 27 +++++++++++++++++ src/main/webapp/help-unlockKeychain.html | 28 ++++++++++++++++++ 8 files changed, 131 insertions(+), 9 deletions(-) create mode 100644 src/main/webapp/help-keychainPath.html create mode 100644 src/main/webapp/help-keychainPwd.html create mode 100644 src/main/webapp/help-unlockKeychain.html diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 581ec3e2..3fcd803e 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -53,7 +53,6 @@ * @author Ray Hilton */ public class XCodeBuilder extends Builder { - public final Boolean buildIpa; public final Boolean cleanBeforeBuild; public final String configuration; public final String target; @@ -63,10 +62,14 @@ public class XCodeBuilder extends Builder { public final String embeddedProfileFile; public final String cfBundleVersionValue; public final String cfBundleShortVersionStringValue; + public final Boolean buildIpa; + public final Boolean unlockKeychain; + public final String keychainPath; + public final String keychainPwd; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue) { + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd) { this.buildIpa = buildIpa; this.sdk = sdk; this.target = target; @@ -77,6 +80,9 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configura this.embeddedProfileFile = embeddedProfileFile; this.cfBundleVersionValue = cfBundleVersionValue; this.cfBundleShortVersionStringValue = cfBundleShortVersionStringValue; + this.unlockKeychain = unlockKeychain; + this.keychainPath = keychainPath; + this.keychainPwd = keychainPwd; } @Override @@ -113,7 +119,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Try to read CFBundleShortVersionString from project listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleShortVersionString()); String cfBundleShortVersionString = ""; - returnCode = launcher.launch().envs(envs).cmds("agvtool", "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); // only use this version number if we found it if (returnCode == 0) cfBundleShortVersionString = output.toString().trim(); @@ -125,7 +131,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Try to read CFBundleVersion from project listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleVersion()); String cfBundleVersion = ""; - returnCode = launcher.launch().envs(envs).cmds("agvtool", "vers", "-terse").stdout(output).pwd(projectRoot).join(); + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "vers", "-terse").stdout(output).pwd(projectRoot).join(); // only use this version number if we found it if (returnCode == 0) cfBundleVersion = output.toString().trim(); @@ -187,6 +193,20 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis listener.getLogger().println(Messages.XCodeBuilder_cleaningTestReportsDir()); projectRoot.child("test-reports").deleteRecursive(); + if (unlockKeychain) { + // Let's unlock the keychain + launcher.launch().envs(envs).cmds("/usr/bin/security","list-keychains","-s",keychainPath).stdout(listener).pwd(projectRoot).join(); + launcher.launch().envs(envs).cmds("/usr/bin/security","login-keychain","-d","user","-s",keychainPath).stdout(listener).pwd(projectRoot).join(); + if(StringUtils.isEmpty(keychainPwd)) + returnCode = launcher.launch().envs(envs).cmds("/usr/bin/security","unlock-keychain",keychainPath).stdout(listener).pwd(projectRoot).join(); + else + returnCode = launcher.launch().envs(envs).cmds("/usr/bin/security","unlock-keychain","-p",keychainPwd,keychainPath).masks(false,false,false,true,false).stdout(listener).pwd(projectRoot).join(); + if (returnCode > 0) { + listener.fatalError(Messages.XCodeBuilder_unlockKeychainFailed()); + return false; + } + } + // Build StringBuilder xcodeReport = new StringBuilder(Messages.XCodeBuilder_invokeXcodebuild()); XCodeBuildOutputParser reportGenerator = new XCodeBuildOutputParser(projectRoot, listener); @@ -236,6 +256,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Package IPA if (buildIpa) { + listener.getLogger().println(Messages.XCodeBuilder_cleaningIPA()); for (FilePath path : buildDirectory.list("*.ipa")) { path.delete(); diff --git a/src/main/resources/au/com/rayh/Messages.properties b/src/main/resources/au/com/rayh/Messages.properties index 8ff70cb6..b3351df2 100644 --- a/src/main/resources/au/com/rayh/Messages.properties +++ b/src/main/resources/au/com/rayh/Messages.properties @@ -23,6 +23,7 @@ # XCodeBuilder.xcodebuildNotFound=Cannot find xcodebuild with the configured path {0}. XCodeBuilder.avgtoolNotFound=Cannot find agvtool with the configured path {0}. +XCodeBuilder.unlockKeychainFailed=Unable to unlock the keychain. XCodeBuilder.xcrunNotFound=Cannot find xcrun with the configured path {0}. XCodeBuilder.cleaningBuildDir=Cleaning build directory: {0} XCodeBuilder.cleaningIPA=Cleaning up previously generate .ipa files diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 4e518040..ff716bbd 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -40,7 +40,7 @@ - @@ -77,12 +77,30 @@ - + - + + + + + + + + + + + + + + diff --git a/src/main/webapp/help-cfBundleVersionValue.html b/src/main/webapp/help-cfBundleVersionValue.html index c5807c36..b68d826f 100644 --- a/src/main/webapp/help-cfBundleVersionValue.html +++ b/src/main/webapp/help-cfBundleVersionValue.html @@ -28,6 +28,6 @@ Supports all macros from the Token Macro Plugin.
For example the value ${BUILD_NUMBER} will be replaced with the current build number.
We advice you to generate a unique value for each build if you want for example deploy it into a private store.
- In that case you can use for example : ${JOB_NAME}-${BUILD_NUMBER} + In that case you can use for example : ${ENV,var="JOB_NAME"}-${BUILD_NUMBER}

diff --git a/src/main/webapp/help-configuration.html b/src/main/webapp/help-configuration.html index 4d6447b9..c5459e72 100644 --- a/src/main/webapp/help-configuration.html +++ b/src/main/webapp/help-configuration.html @@ -24,6 +24,6 @@

- This is the name of the configuration as defined in the XCode project. By default there are Debug and Release configurations. + This is the name of the configuration as defined in the XCode project. By default there are Debug and Release configurations.

diff --git a/src/main/webapp/help-keychainPath.html b/src/main/webapp/help-keychainPath.html new file mode 100644 index 00000000..8b042534 --- /dev/null +++ b/src/main/webapp/help-keychainPath.html @@ -0,0 +1,27 @@ + + +
+

The path of the keychain to use to retrieve certificates to sign the package (default : ${ENV.HOME}/Library/Keychains/login.keychain).

+
diff --git a/src/main/webapp/help-keychainPwd.html b/src/main/webapp/help-keychainPwd.html new file mode 100644 index 00000000..f033e17e --- /dev/null +++ b/src/main/webapp/help-keychainPwd.html @@ -0,0 +1,27 @@ + + +
+

The password of the keychain to use to retrieve certificates to sign the package.

+
diff --git a/src/main/webapp/help-unlockKeychain.html b/src/main/webapp/help-unlockKeychain.html new file mode 100644 index 00000000..0aa6c145 --- /dev/null +++ b/src/main/webapp/help-unlockKeychain.html @@ -0,0 +1,28 @@ + + +
+

+ Automatically unlock the keychain before signing the archive?

+
From 8ef54f674d5e2bf36603b3285a24e4f5a04c40cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 13 Nov 2011 23:47:49 +0100 Subject: [PATCH 37/91] 1.399 is better to ease the release (see : https://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9ae33aca..7cc79fa0 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.jenkins-ci.plugins plugin - 1.398 + 1.399 xcode-plugin 1.0-SNAPSHOT From 6f1aa5d25c4d4faa6e4bff2bd2dcffecf4f4a223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 14 Nov 2011 00:16:56 +0100 Subject: [PATCH 38/91] [maven-release-plugin] prepare release 1.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7cc79fa0..b1cd1e48 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ ~ THE SOFTWARE. --> - + 4.0.0 org.jenkins-ci.plugins @@ -31,7 +31,7 @@ 1.399 xcode-plugin - 1.0-SNAPSHOT + 1.0 hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 23768e7d1b8f40c2c011c6a6d1e2089f6d9abc2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 14 Nov 2011 00:21:37 +0100 Subject: [PATCH 39/91] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b1cd1e48..36ff2665 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 1.399 xcode-plugin - 1.0 + 1.1-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 316ca275c88e1cf3738018653c2c8e4ccbba48ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 14 Nov 2011 09:38:33 +0100 Subject: [PATCH 40/91] FIX : The default keychain wasn't the same between the default value and the help (and the help entry was wrong) --- src/main/resources/au/com/rayh/XCodeBuilder/config.jelly | 2 +- src/main/webapp/help-keychainPath.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index ff716bbd..3fb698e0 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -94,7 +94,7 @@ - +
-

The path of the keychain to use to retrieve certificates to sign the package (default : ${ENV.HOME}/Library/Keychains/login.keychain).

+

The path of the keychain to use to retrieve certificates to sign the package (default : ${HOME}/Library/Keychains/login.keychain).

From c3c005bb40d6d2f94871167f5f985dd1a513cd26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 14 Nov 2011 18:05:12 +0100 Subject: [PATCH 41/91] Fix default value for keystore --- src/main/resources/au/com/rayh/XCodeBuilder/config.jelly | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 3fb698e0..c7b364fb 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -94,7 +94,7 @@ - + Date: Mon, 14 Nov 2011 18:20:02 +0100 Subject: [PATCH 42/91] Let's release a 1.0.1 just to fix the little error in the keystore path default value --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 36ff2665..c58f1ec0 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 1.399 xcode-plugin - 1.1-SNAPSHOT + 1.0.1-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 084e0fa78c6253f9dc8c2b97f0e3c207ef844cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 14 Nov 2011 18:21:50 +0100 Subject: [PATCH 43/91] [maven-release-plugin] prepare release 1.0.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c58f1ec0..91ecc593 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 1.399 xcode-plugin - 1.0.1-SNAPSHOT + 1.0.1 hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From afb3e4ef59cd770da3d5ff5855fd9643cc92058b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 14 Nov 2011 18:22:00 +0100 Subject: [PATCH 44/91] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 91ecc593..3fd29a1b 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 1.399 xcode-plugin - 1.0.1 + 1.0.2-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 91823af75cbe9025df95fc2f51335db1989cd707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 17 Nov 2011 01:26:08 +0100 Subject: [PATCH 45/91] Using more convention over configuration to simplify the code. --- src/main/java/au/com/rayh/XCodeBuilder.java | 50 +++++++------- .../au/com/rayh/XCodeBuilder/config.jelly | 65 ++++++++----------- .../au/com/rayh/XCodeBuilder/global.jelly | 6 +- .../com/rayh/XCodeBuilder}/help-buildIpa.html | 0 .../help-cfBundleShortVersionStringValue.html | 0 .../help-cfBundleVersionValue.html | 0 .../XCodeBuilder}/help-cleanBeforeBuild.html | 0 .../XCodeBuilder}/help-configuration.html | 0 .../help-embeddedProfileFile.html | 0 .../rayh/XCodeBuilder}/help-keychainPath.html | 0 .../rayh/XCodeBuilder}/help-keychainPwd.html | 0 .../au/com/rayh/XCodeBuilder}/help-sdk.html | 0 .../com/rayh/XCodeBuilder}/help-target.html | 0 .../XCodeBuilder}/help-unlockKeychain.html | 0 .../XCodeBuilder}/help-xcodeProjectFile.html | 0 .../XCodeBuilder}/help-xcodeProjectPath.html | 0 16 files changed, 57 insertions(+), 64 deletions(-) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-buildIpa.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-cfBundleShortVersionStringValue.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-cfBundleVersionValue.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-cleanBeforeBuild.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-configuration.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-embeddedProfileFile.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-keychainPath.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-keychainPwd.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-sdk.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-target.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-unlockKeychain.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-xcodeProjectFile.html (100%) rename src/main/{webapp => resources/au/com/rayh/XCodeBuilder}/help-xcodeProjectPath.html (100%) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 3fcd803e..7ef7dee6 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -91,12 +91,12 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis FilePath projectRoot = build.getWorkspace(); // check that the configured tools exist - if (!new FilePath(projectRoot.getChannel(), getDescriptor().xcodebuildPath()).exists()) { - listener.fatalError(Messages.XCodeBuilder_xcodebuildNotFound(getDescriptor().xcodebuildPath())); + if (!new FilePath(projectRoot.getChannel(), getDescriptor().getXcodebuildPath()).exists()) { + listener.fatalError(Messages.XCodeBuilder_xcodebuildNotFound(getDescriptor().getXcodebuildPath())); return false; } - if (!new FilePath(projectRoot.getChannel(), getDescriptor().agvtoolPath()).exists()) { - listener.fatalError(Messages.XCodeBuilder_avgtoolNotFound(getDescriptor().agvtoolPath())); + if (!new FilePath(projectRoot.getChannel(), getDescriptor().getAgvtoolPath()).exists()) { + listener.fatalError(Messages.XCodeBuilder_avgtoolNotFound(getDescriptor().getAgvtoolPath())); return false; } @@ -108,7 +108,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis FilePath buildDirectory = projectRoot.child("build").child(configuration + "-iphoneos"); // XCode Version - int returnCode = launcher.launch().envs(envs).cmds(getDescriptor().xcodebuildPath(), "-version").stdout(listener).pwd(projectRoot).join(); + int returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getXcodebuildPath(), "-version").stdout(listener).pwd(projectRoot).join(); if (returnCode > 0) { listener.fatalError(Messages.XCodeBuilder_xcodeVersionNotFound()); return false; // We fail the build if XCode isn't deployed @@ -119,7 +119,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Try to read CFBundleShortVersionString from project listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleShortVersionString()); String cfBundleShortVersionString = ""; - returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getAgvtoolPath(), "mvers", "-terse1").stdout(output).pwd(projectRoot).join(); // only use this version number if we found it if (returnCode == 0) cfBundleShortVersionString = output.toString().trim(); @@ -131,7 +131,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Try to read CFBundleVersion from project listener.getLogger().println(Messages.XCodeBuilder_fetchingCFBundleVersion()); String cfBundleVersion = ""; - returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "vers", "-terse").stdout(output).pwd(projectRoot).join(); + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getAgvtoolPath(), "vers", "-terse").stdout(output).pwd(projectRoot).join(); // only use this version number if we found it if (returnCode == 0) cfBundleVersion = output.toString().trim(); @@ -150,7 +150,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin cfBundleShortVersionString = TokenMacro.expand(build, listener, cfBundleShortVersionStringValue); listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringUpdate(cfBundleShortVersionString)); - returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-marketing-version", cfBundleShortVersionString).stdout(listener).pwd(projectRoot).join(); + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getAgvtoolPath(), "new-marketing-version", cfBundleShortVersionString).stdout(listener).pwd(projectRoot).join(); if (returnCode > 0) { listener.fatalError(Messages.XCodeBuilder_CFBundleShortVersionStringUpdateError(cfBundleShortVersionString)); return false; @@ -168,7 +168,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin cfBundleVersion = TokenMacro.expand(build, listener, cfBundleVersionValue); listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionUpdate(cfBundleVersion)); - returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-version", "-all", cfBundleVersion).stdout(listener).pwd(projectRoot).join(); + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getAgvtoolPath(), "new-version", "-all", cfBundleVersion).stdout(listener).pwd(projectRoot).join(); if (returnCode > 0) { listener.fatalError(Messages.XCodeBuilder_CFBundleVersionUpdateError(cfBundleVersion)); return false; @@ -210,7 +210,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Build StringBuilder xcodeReport = new StringBuilder(Messages.XCodeBuilder_invokeXcodebuild()); XCodeBuildOutputParser reportGenerator = new XCodeBuildOutputParser(projectRoot, listener); - List commandLine = Lists.newArrayList(getDescriptor().xcodebuildPath()); + List commandLine = Lists.newArrayList(getDescriptor().getXcodebuildPath()); if (StringUtils.isEmpty(target)) { commandLine.add("-alltargets"); xcodeReport.append("target: ALL"); @@ -286,7 +286,7 @@ else if (cfBundleVersion.isEmpty()) listener.getLogger().println("Packaging " + app.getBaseName() + ".app => " + ipaLocation); List packageCommandLine = new ArrayList(); - packageCommandLine.add(getDescriptor().xcrunPath()); + packageCommandLine.add(getDescriptor().getXcrunPath()); packageCommandLine.add("-sdk"); if (!StringUtils.isEmpty(sdk)) { @@ -369,28 +369,34 @@ public String getDisplayName() { @Override public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { - // To persist global configuration information, - // set that to properties and call save(). - xcodebuildPath = formData.getString("xcodebuildPath"); - agvtoolPath = formData.getString("agvtoolPath"); - xcrunPath = formData.getString("xcrunPath"); - // ^Can also use req.bindJSON(this, formData); - // (easier when there are many fields; need set* methods for this, like setUseFrench) + req.bindJSON(this, formData); save(); return super.configure(req, formData); } - public String agvtoolPath() { + public String getAgvtoolPath() { return agvtoolPath; } - public String xcodebuildPath() { + public String getXcodebuildPath() { return xcodebuildPath; } - public String xcrunPath() { + public String getXcrunPath() { return xcrunPath; } - } + + public void setXcodebuildPath(String xcodebuildPath) { + this.xcodebuildPath = xcodebuildPath; + } + + public void setAgvtoolPath(String agvtoolPath) { + this.agvtoolPath = agvtoolPath; + } + + public void setXcrunPath(String xcrunPath) { + this.xcrunPath = xcrunPath; + } + } } diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index c7b364fb..1e2696d6 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -29,78 +29,65 @@ See global.jelly for a general discussion about jelly script. --> - - + + - + description="Leave empty for all targets"> + - + description="Leave empty for default SDK"> + - - + + - + description="Relative path within the workspace that contains the xcode project file(s). Only needed if project file is not in the workspace root."> + - + description="Only needed if there is more than one project file in the Xcode Project Directory"> + - + description="The value to use for CFBundleShortVersionString. Leave blank to use project's marketing number."> + - + description="The value to use for CFBundleVersion. Leave blank to use project's technical number."> + - - + + - + description="The relative path to the mobileprovision to embed, leave blank for no embedded profile"> + - - + + - + description="The path of the keychain to use to sign the IPA."> + - + description="The password to use to unlock the keychain."> + diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly index e74fbc6b..a1a28bc8 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly @@ -25,13 +25,13 @@ - + - + - + diff --git a/src/main/webapp/help-buildIpa.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-buildIpa.html similarity index 100% rename from src/main/webapp/help-buildIpa.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-buildIpa.html diff --git a/src/main/webapp/help-cfBundleShortVersionStringValue.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleShortVersionStringValue.html similarity index 100% rename from src/main/webapp/help-cfBundleShortVersionStringValue.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleShortVersionStringValue.html diff --git a/src/main/webapp/help-cfBundleVersionValue.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleVersionValue.html similarity index 100% rename from src/main/webapp/help-cfBundleVersionValue.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleVersionValue.html diff --git a/src/main/webapp/help-cleanBeforeBuild.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-cleanBeforeBuild.html similarity index 100% rename from src/main/webapp/help-cleanBeforeBuild.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-cleanBeforeBuild.html diff --git a/src/main/webapp/help-configuration.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-configuration.html similarity index 100% rename from src/main/webapp/help-configuration.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-configuration.html diff --git a/src/main/webapp/help-embeddedProfileFile.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-embeddedProfileFile.html similarity index 100% rename from src/main/webapp/help-embeddedProfileFile.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-embeddedProfileFile.html diff --git a/src/main/webapp/help-keychainPath.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-keychainPath.html similarity index 100% rename from src/main/webapp/help-keychainPath.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-keychainPath.html diff --git a/src/main/webapp/help-keychainPwd.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-keychainPwd.html similarity index 100% rename from src/main/webapp/help-keychainPwd.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-keychainPwd.html diff --git a/src/main/webapp/help-sdk.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-sdk.html similarity index 100% rename from src/main/webapp/help-sdk.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-sdk.html diff --git a/src/main/webapp/help-target.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-target.html similarity index 100% rename from src/main/webapp/help-target.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-target.html diff --git a/src/main/webapp/help-unlockKeychain.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-unlockKeychain.html similarity index 100% rename from src/main/webapp/help-unlockKeychain.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-unlockKeychain.html diff --git a/src/main/webapp/help-xcodeProjectFile.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectFile.html similarity index 100% rename from src/main/webapp/help-xcodeProjectFile.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectFile.html diff --git a/src/main/webapp/help-xcodeProjectPath.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectPath.html similarity index 100% rename from src/main/webapp/help-xcodeProjectPath.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectPath.html From 97fb0efe2f27f969e2f7186bbd47bb2f747e9bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 17 Nov 2011 01:26:47 +0100 Subject: [PATCH 46/91] Maven 3 compat --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 3fd29a1b..79a14e5e 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,7 @@ org.jenkins-ci.plugins plugin 1.399 + xcode-plugin 1.0.2-SNAPSHOT From 7b958bce44973d85fdcee3ed7748c61f601cdf70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 17 Nov 2011 01:35:26 +0100 Subject: [PATCH 47/91] More i18n --- .../au/com/rayh/XCodeBuilder/config.jelly | 26 +++++++++---------- .../au/com/rayh/XCodeBuilder/global.jelly | 8 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 1e2696d6..4ef8b624 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -29,63 +29,63 @@ See global.jelly for a general discussion about jelly script. --> - + - - - + - - - - - + - - + - - diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly index a1a28bc8..3cc616bf 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/global.jelly @@ -23,14 +23,14 @@ --> - - + + - + - + From f96fb727c25ee2c29f6238aca7890127f5d2ddbb Mon Sep 17 00:00:00 2001 From: Dan Zinngrabe Date: Thu, 17 Nov 2011 13:13:09 -0800 Subject: [PATCH 48/91] Adding help file --- .../XCodeBuilder/help-xcodeBuildOutput.html | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeBuildOutput.html diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeBuildOutput.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeBuildOutput.html new file mode 100644 index 00000000..476181e9 --- /dev/null +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeBuildOutput.html @@ -0,0 +1,29 @@ + + +
+

+ You only need to supply this value if you want the product of the XCode build to be in a location other than the one specified in the project file. +

+
From dfe13ce14d7abc35f1d9c55fd95b5757a46c6378 Mon Sep 17 00:00:00 2001 From: Dan Zinngrabe Date: Thu, 17 Nov 2011 13:15:37 -0800 Subject: [PATCH 49/91] Added new functionality that allows a user to specify the build output directory. This overrides the setting in the user's project file, so it will be put into a known directory rather than XcodeDerivedData, etc. This makes it much easier to set up subsequent build steps in Jenkins that do something with the output of the build. It does this by passing the setting CONFIGURATION_BUILD_DIR to xcodebuild if a path is set for this new job config value. --- src/main/java/au/com/rayh/XCodeBuilder.java | 9 ++++++++- src/main/resources/au/com/rayh/XCodeBuilder/config.jelly | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 7ef7dee6..e999adf7 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -62,6 +62,7 @@ public class XCodeBuilder extends Builder { public final String embeddedProfileFile; public final String cfBundleVersionValue; public final String cfBundleShortVersionStringValue; + public final String xcodeBuildOutput; public final Boolean buildIpa; public final Boolean unlockKeychain; public final String keychainPath; @@ -69,7 +70,7 @@ public class XCodeBuilder extends Builder { // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd) { + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, String xcodeBuildOutput, Boolean unlockKeychain, String keychainPath, String keychainPwd) { this.buildIpa = buildIpa; this.sdk = sdk; this.target = target; @@ -80,6 +81,7 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configura this.embeddedProfileFile = embeddedProfileFile; this.cfBundleVersionValue = cfBundleVersionValue; this.cfBundleShortVersionStringValue = cfBundleShortVersionStringValue; + this.xcodeBuildOutput = xcodeBuildOutput; this.unlockKeychain = unlockKeychain; this.keychainPath = keychainPath; this.keychainPwd = keychainPwd; @@ -248,6 +250,11 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis } commandLine.add("build"); + if (!StringUtils.isEmpty(xcodeBuildOutput)) { + commandLine.add("CONFIGURATION_BUILD_DIR=" + xcodeBuildOutput); + xcodeReport.append(", output directory: ").append(xcodeBuildOutput); + } + listener.getLogger().println(xcodeReport.toString()); returnCode = launcher.launch().envs(envs).cmds(commandLine).stdout(reportGenerator.getOutputStream()).pwd(projectRoot).join(); if (reportGenerator.getExitCode() != 0) return false; diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 1e2696d6..bd570a0f 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -67,6 +67,11 @@
+ + + + From 9bf9807e582810313f59f3bff125771e92b74041 Mon Sep 17 00:00:00 2001 From: Vladimir Grichina Date: Sat, 19 Nov 2011 06:27:51 +0200 Subject: [PATCH 50/91] Added option to specify custom xcodebuild arguments --- src/main/java/au/com/rayh/XCodeBuilder.java | 32 +++++++++++++------ .../au/com/rayh/XCodeBuilder/config.jelly | 11 +++++-- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index b5133860..4b8927a4 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -34,12 +34,13 @@ public class XCodeBuilder extends Builder { private String sdk; private String xcodeProjectPath; private String xcodeProjectFile; + private String xcodebuildArguments; private String embeddedProfileFile; private String versionNumberPattern; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, Boolean updateBuildNumber, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String versionNumberPattern, String overrideMarketingNumber) { + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, Boolean updateBuildNumber, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String xcodebuildArguments, String embeddedProfileFile, String versionNumberPattern, String overrideMarketingNumber) { this.buildIpa = buildIpa; this.sdk = sdk; this.target = target; @@ -49,6 +50,7 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, Boolean updateBu this.configuration = configuration; this.xcodeProjectPath = xcodeProjectPath; this.xcodeProjectFile = xcodeProjectFile; + this.xcodebuildArguments = xcodebuildArguments; this.embeddedProfileFile = embeddedProfileFile; this.versionNumberPattern = versionNumberPattern; } @@ -92,6 +94,10 @@ public String getXcodeProjectFile() { return xcodeProjectFile; } + public String getXcodebuildArguments() { + return xcodebuildArguments; + } + public String getEmbeddedProfileFile() { return embeddedProfileFile; } @@ -131,7 +137,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis if(!StringUtils.isEmpty(getVersionNumberPattern())) { versionNumber = getVersionNumberPattern().replaceAll("\\{BUILD_NUMBER\\}", artifactVersion); } - + if(updateBuildNumber) { listener.getLogger().println("Updating version number (CFBundleVersion) to " + versionNumber); //ByteArrayOutputStream output = new ByteArrayOutputStream(); @@ -157,10 +163,10 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // if(returnCode==0) // artifactVersion = output.toString().trim(); } - + if( false == StringUtils.isEmpty(overrideMarketingNumber) ) { listener.getLogger().println("Updating marketing version to " + overrideMarketingNumber); - + returnCode = launcher.launch().envs(envs).cmds(getDescriptor().agvtoolPath(), "new-marketing-version", overrideMarketingNumber ).stdout(listener).pwd(projectRoot).join(); if(returnCode>0) { listener.fatalError("Could not set marketing version to " + overrideMarketingNumber); @@ -172,7 +178,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis listener.getLogger().println("Cleaning build directory (" + projectRoot.child("build") + ")"); buildDirectory.deleteRecursive(); } - + // remove test-reports and *.ipa listener.getLogger().println("Cleaning up test-reports"); projectRoot.child("test-reports").deleteRecursive(); @@ -189,7 +195,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis commandLine.add(target); xcodeReport.append("target: ").append(target); } - + if(!StringUtils.isEmpty(sdk)) { commandLine.add("-sdk"); commandLine.add(sdk); @@ -217,7 +223,15 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // xcodeReport.append(", clean: NO"); // } commandLine.add("build"); - + + // Additional (custom) xcodebuild arguments + if (!StringUtils.isEmpty(xcodebuildArguments)) { + String[] parts = xcodebuildArguments.split("[ ]"); + for (String arg : parts) { + commandLine.add(arg); + } + } + listener.getLogger().println(xcodeReport.toString()); returnCode = launcher.launch().envs(envs).cmds(commandLine).stdout(reportGenerator.getOutputStream()).pwd(projectRoot).join(); if(reportGenerator.getExitCode()!=0) return false; @@ -241,7 +255,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis FilePath payload = buildDirectory.child("Payload"); payload.deleteRecursive(); payload.mkdirs(); - + listener.getLogger().println("Packaging " + app.getBaseName() + ".app => " + ipaLocation); List packageCommandLine = new ArrayList(); @@ -258,7 +272,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis packageCommandLine.add("--embed"); packageCommandLine.add(embeddedProfileFile); } - + returnCode = launcher.launch().envs(envs).stdout(listener).pwd(projectRoot).cmds(packageCommandLine).join(); if(returnCode>0) { listener.getLogger().println("Failed to build " + ipaLocation.getName()); diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index b466bc13..02284972 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -12,7 +12,7 @@
- @@ -34,12 +34,17 @@ help="/plugin/xcode/help-xcodeProjectFile.html"> - + + + + + - + From 8f49bb5955673e4fd6eed290f39375034b17da6d Mon Sep 17 00:00:00 2001 From: Vladimir Grichina Date: Fri, 25 Nov 2011 02:44:30 +0200 Subject: [PATCH 51/91] Made cleaning of test reports optional --- src/main/java/au/com/rayh/XCodeBuilder.java | 16 ++++++++++++---- .../au/com/rayh/XCodeBuilder/config.jelly | 5 +++++ src/main/webapp/help-cleanTestReports.html | 8 ++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/main/webapp/help-cleanTestReports.html diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 4b8927a4..f34d605b 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -27,6 +27,7 @@ public class XCodeBuilder extends Builder { private Boolean buildIpa; private Boolean cleanBeforeBuild; + private Boolean cleanTestReports; private Boolean updateBuildNumber; private String configuration; private String overrideMarketingNumber; @@ -40,11 +41,12 @@ public class XCodeBuilder extends Builder { // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, Boolean updateBuildNumber, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String xcodebuildArguments, String embeddedProfileFile, String versionNumberPattern, String overrideMarketingNumber) { + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, Boolean cleanTestReports, Boolean updateBuildNumber, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String xcodebuildArguments, String embeddedProfileFile, String versionNumberPattern, String overrideMarketingNumber) { this.buildIpa = buildIpa; this.sdk = sdk; this.target = target; this.cleanBeforeBuild = cleanBeforeBuild; + this.cleanTestReports = cleanTestReports; this.updateBuildNumber = updateBuildNumber; this.overrideMarketingNumber = overrideMarketingNumber; this.configuration = configuration; @@ -78,6 +80,10 @@ public Boolean getCleanBeforeBuild() { return cleanBeforeBuild; } + public Boolean getCleanTestReports() { + return cleanTestReports; + } + public Boolean getUpdateBuildNumber() { return updateBuildNumber; } @@ -174,14 +180,16 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis } // Clean build directories - if(cleanBeforeBuild) { + if(cleanBeforeBuild != null && cleanBeforeBuild) { listener.getLogger().println("Cleaning build directory (" + projectRoot.child("build") + ")"); buildDirectory.deleteRecursive(); } // remove test-reports and *.ipa - listener.getLogger().println("Cleaning up test-reports"); - projectRoot.child("test-reports").deleteRecursive(); + if(cleanTestReports != null && cleanTestReports) { + listener.getLogger().println("Cleaning up test-reports"); + projectRoot.child("test-reports").deleteRecursive(); + } // Build StringBuilder xcodeReport = new StringBuilder("Going to invoke xcodebuild: "); diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 02284972..0d69153c 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -62,6 +62,11 @@ + + + + diff --git a/src/main/webapp/help-cleanTestReports.html b/src/main/webapp/help-cleanTestReports.html new file mode 100644 index 00000000..284b1d7d --- /dev/null +++ b/src/main/webapp/help-cleanTestReports.html @@ -0,0 +1,8 @@ +
+

+ This will delete the processed test reports before invoking the build. + Usually it is a good idea only to do it in test targets, + otherwise if other Xcode target is built before tests – the build will fail to collect test reports. +

+
+ From 8adaabe5c76556f11dc4239dcc9b4529a8c2c9fb Mon Sep 17 00:00:00 2001 From: Vladimir Grichina Date: Fri, 25 Nov 2011 02:55:39 +0200 Subject: [PATCH 52/91] Added documentation for xcodebuildArguments --- src/main/webapp/help-xcodebuildArguments.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/main/webapp/help-xcodebuildArguments.html diff --git a/src/main/webapp/help-xcodebuildArguments.html b/src/main/webapp/help-xcodebuildArguments.html new file mode 100644 index 00000000..96eaf519 --- /dev/null +++ b/src/main/webapp/help-xcodebuildArguments.html @@ -0,0 +1,14 @@ +
+

+ Arguments are currently separated by space, enclosing them in quotes won't help. +

+

+ Passing custom arguments is convenient when you need to change some project options for Jenkins build, + but don't want them to persist in project file. + For example when running application tests, following settings often are nice fit: + GCC_SYMBOLS_PRIVATE_EXTERN=NO COPY_PHASE_STRIP=NO. + Otherwise Release build will usually fail because it won't be able to find application symbols to link with test bundle. +

+
+ + From 1fe5e73baa980db3cf22bab6d49bf3c5b69bc7be Mon Sep 17 00:00:00 2001 From: Fabio Gallonetto Date: Fri, 25 Nov 2011 10:50:47 +0000 Subject: [PATCH 53/91] Add support for building schemes and workspaces The plugin now supports two extra configuration parameters: xcodeScheme and xcodeWorkspaceFile. The scheme maps to xcodebuild's parameter "-scheme" and the workspace to "-workspace". The scheme takes precedence over the target setting and the workspace takes precedence over the project setting. --- pom.xml | 2 +- src/main/java/au/com/rayh/XCodeBuilder.java | 21 ++++++++++++++++--- .../au/com/rayh/XCodeBuilder/config.jelly | 12 ++++++++++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 79a14e5e..f4f37479 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.0.2-SNAPSHOT + 1.0.2-FW-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 7ef7dee6..0866ef02 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -59,6 +59,8 @@ public class XCodeBuilder extends Builder { public final String sdk; public final String xcodeProjectPath; public final String xcodeProjectFile; + public final String xcodeSchema; + public final String xcodeWorkspaceFile; public final String embeddedProfileFile; public final String cfBundleVersionValue; public final String cfBundleShortVersionStringValue; @@ -69,7 +71,7 @@ public class XCodeBuilder extends Builder { // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd) { + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String xcodeWorkspaceFile, String xcodeSchema, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd) { this.buildIpa = buildIpa; this.sdk = sdk; this.target = target; @@ -77,6 +79,8 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configura this.configuration = configuration; this.xcodeProjectPath = xcodeProjectPath; this.xcodeProjectFile = xcodeProjectFile; + this.xcodeWorkspaceFile = xcodeWorkspaceFile; + this.xcodeSchema = xcodeSchema; this.embeddedProfileFile = embeddedProfileFile; this.cfBundleVersionValue = cfBundleVersionValue; this.cfBundleShortVersionStringValue = cfBundleShortVersionStringValue; @@ -211,7 +215,13 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis StringBuilder xcodeReport = new StringBuilder(Messages.XCodeBuilder_invokeXcodebuild()); XCodeBuildOutputParser reportGenerator = new XCodeBuildOutputParser(projectRoot, listener); List commandLine = Lists.newArrayList(getDescriptor().getXcodebuildPath()); - if (StringUtils.isEmpty(target)) { + + // Priritizing schemaa over target setting + if(!StringUtils.isEmpty(xcodeSchema)) { + commandLine.add("-scheme"); + commandLine.add(xcodeSchema); + xcodeReport.append(", scheme: ").append(xcodeSchema); + } else if (StringUtils.isEmpty(target)) { commandLine.add("-alltargets"); xcodeReport.append("target: ALL"); } else { @@ -228,7 +238,12 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis xcodeReport.append(", sdk: DEFAULT"); } - if (!StringUtils.isEmpty(xcodeProjectFile)) { + // Prioritizing workspace over project setting + if (!StringUtils.isEmpty(xcodeWorkspaceFile)) { + commandLine.add("-workspace"); + commandLine.add(xcodeWorkspaceFile + ".xcworkspace"); + xcodeReport.append(", workspace: ").append(xcodeWorkspaceFile); + } else if (!StringUtils.isEmpty(xcodeProjectFile)) { commandLine.add("-project"); commandLine.add(xcodeProjectFile); xcodeReport.append(", project: ").append(xcodeProjectFile); diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 1e2696d6..ec0364d4 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -53,7 +53,17 @@
+ description="Only needed if there is more than one project file in the Xcode Project Directory."> + + + + + + + + From 91ab7f121141f3e07c528521516349e15a2a342a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 27 Nov 2011 23:13:34 +0100 Subject: [PATCH 54/91] Remove the accent in my name. there is an encoding issue in with the confluence macro. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 79a14e5e..8f287869 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ aheritier - Arnaud Héritier + Arnaud Heritier aheritier@apache.org From dfd0a84e21cf952f03fc8796ac3681fdc6755e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 28 Nov 2011 00:04:35 +0100 Subject: [PATCH 55/91] Bump version to 1.1 (JENKINS-11813 is an improvement) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8f287869..81cc9359 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.0.2-SNAPSHOT + 1.1-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 3817940a3c020cc420ed2f3b55617d6d6509119e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 28 Nov 2011 01:34:37 +0100 Subject: [PATCH 56/91] JENKINS-11813 : New option to allow to configure SYMROOT (With token macro plugin support) --- src/main/java/au/com/rayh/XCodeBuilder.java | 38 ++++++++++++++++++- .../resources/au/com/rayh/Messages.properties | 1 + .../au/com/rayh/XCodeBuilder/config.jelly | 5 +++ .../com/rayh/XCodeBuilder/help-symroot.html | 32 ++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/au/com/rayh/XCodeBuilder/help-symroot.html diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 7ef7dee6..bd3d634b 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -45,6 +45,7 @@ import javax.servlet.ServletException; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -57,6 +58,7 @@ public class XCodeBuilder extends Builder { public final String configuration; public final String target; public final String sdk; + public final String symRoot; public final String xcodeProjectPath; public final String xcodeProjectFile; public final String embeddedProfileFile; @@ -68,8 +70,11 @@ public class XCodeBuilder extends Builder { public final String keychainPwd; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" + /** + * @since 1.1 + */ @DataBoundConstructor - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd) { + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd, String symRoot) { this.buildIpa = buildIpa; this.sdk = sdk; this.target = target; @@ -83,6 +88,12 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configura this.unlockKeychain = unlockKeychain; this.keychainPath = keychainPath; this.keychainPwd = keychainPwd; + this.symRoot = symRoot; + } + + @Deprecated + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd) { + this(buildIpa,cleanBeforeBuild,configuration,target,sdk,xcodeProjectPath,xcodeProjectFile,embeddedProfileFile,cfBundleVersionValue,cfBundleShortVersionStringValue,unlockKeychain,keychainPath,keychainPwd,null); } @Override @@ -105,7 +116,23 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis projectRoot = projectRoot.child(xcodeProjectPath); } listener.getLogger().println(Messages.XCodeBuilder_workingDir(projectRoot)); - FilePath buildDirectory = projectRoot.child("build").child(configuration + "-iphoneos"); + + // Set the build directory and the symRoot + String symRootValue = null; + FilePath buildDirectory; + if (!StringUtils.isEmpty(symRoot)) { + // If not empty we use the Token Expansion to replace it + // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin + try { + symRootValue = TokenMacro.expand(build, listener, symRoot).trim(); + buildDirectory = new FilePath(new File(symRootValue)).child(configuration + "-iphoneos"); + } catch (MacroEvaluationException e) { + listener.error(Messages.XCodeBuilder_symRootMacroError(e.getMessage())); + return false; + } + } else { + buildDirectory = projectRoot.child("build").child(configuration + "-iphoneos"); + } // XCode Version int returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getXcodebuildPath(), "-version").stdout(listener).pwd(projectRoot).join(); @@ -248,6 +275,13 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis } commandLine.add("build"); + if (!StringUtils.isEmpty(symRootValue)) { + commandLine.add("SYMROOT="+symRootValue); + xcodeReport.append(", symRoot: ").append(symRootValue); + } else { + xcodeReport.append(", symRoot: DEFAULT"); + } + listener.getLogger().println(xcodeReport.toString()); returnCode = launcher.launch().envs(envs).cmds(commandLine).stdout(reportGenerator.getOutputStream()).pwd(projectRoot).join(); if (reportGenerator.getExitCode() != 0) return false; diff --git a/src/main/resources/au/com/rayh/Messages.properties b/src/main/resources/au/com/rayh/Messages.properties index b3351df2..458cde92 100644 --- a/src/main/resources/au/com/rayh/Messages.properties +++ b/src/main/resources/au/com/rayh/Messages.properties @@ -23,6 +23,7 @@ # XCodeBuilder.xcodebuildNotFound=Cannot find xcodebuild with the configured path {0}. XCodeBuilder.avgtoolNotFound=Cannot find agvtool with the configured path {0}. +XCodeBuilder.symRootMacroError=Failure while expanding macros for symRoot. Error: {0} XCodeBuilder.unlockKeychainFailed=Unable to unlock the keychain. XCodeBuilder.xcrunNotFound=Cannot find xcrun with the configured path {0}. XCodeBuilder.cleaningBuildDir=Cleaning build directory: {0} diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 4ef8b624..c9d96b57 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -43,6 +43,11 @@
+ + + + diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-symroot.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-symroot.html new file mode 100644 index 00000000..b2789f6e --- /dev/null +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-symroot.html @@ -0,0 +1,32 @@ + + +
+

+ You only need to supply this value if you want to specify the SYMROOT path to use.
+ If empty, the default SYMROOT path will be used (it could be different depending of your Xcode version).
+ Supports all macros from the Token Macro Plugin.
+ For example you can use the value : ${ENV,var="WORKSPACE"}/build
+

+
From 0b5aa8417735cdd75567d04715ef8ab13d5a5458 Mon Sep 17 00:00:00 2001 From: Dan Zinngrabe Date: Tue, 29 Nov 2011 02:45:31 -0800 Subject: [PATCH 57/91] Implemented output directory for xcode plugin --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 79a14e5e..2897b492 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.0.2-SNAPSHOT + 1.0.2a-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 6840d65bc546fc72af248fb2a065882ab3bf6781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 29 Nov 2011 21:44:39 +0100 Subject: [PATCH 58/91] JENKINS-11813 : Fix how buildDirectory is computed to work with a remote agent --- src/main/java/au/com/rayh/XCodeBuilder.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index bd3d634b..c6e10810 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -45,7 +45,6 @@ import javax.servlet.ServletException; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -125,7 +124,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin try { symRootValue = TokenMacro.expand(build, listener, symRoot).trim(); - buildDirectory = new FilePath(new File(symRootValue)).child(configuration + "-iphoneos"); + buildDirectory = new FilePath(projectRoot.getChannel(),symRootValue).child(configuration + "-iphoneos"); } catch (MacroEvaluationException e) { listener.error(Messages.XCodeBuilder_symRootMacroError(e.getMessage())); return false; From 5d2b55611171442dfe51d08972282cfa4dbbf9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 29 Nov 2011 23:34:11 +0100 Subject: [PATCH 59/91] JENKINS-11892 : Upgrade token macro plugin to version 1.5.1 to allow to replace macro but also environment and build variables in configuration parameters --- pom.xml | 2 +- src/main/java/au/com/rayh/XCodeBuilder.java | 7 ++++--- src/main/resources/au/com/rayh/Messages.properties | 6 +++--- .../XCodeBuilder/help-cfBundleShortVersionStringValue.html | 2 +- .../com/rayh/XCodeBuilder/help-cfBundleVersionValue.html | 4 ++-- .../XCodeBuilder/{help-symroot.html => help-symRoot.html} | 4 ++-- 6 files changed, 13 insertions(+), 12 deletions(-) rename src/main/resources/au/com/rayh/XCodeBuilder/{help-symroot.html => help-symRoot.html} (81%) diff --git a/pom.xml b/pom.xml index 81cc9359..0b83fe24 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ org.jenkins-ci.plugins token-macro - 1.4 + 1.5.1 diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index c6e10810..e306be6a 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -123,10 +123,11 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin try { - symRootValue = TokenMacro.expand(build, listener, symRoot).trim(); + symRootValue = TokenMacro.expandAll(build, listener, symRoot).trim(); buildDirectory = new FilePath(projectRoot.getChannel(),symRootValue).child(configuration + "-iphoneos"); } catch (MacroEvaluationException e) { listener.error(Messages.XCodeBuilder_symRootMacroError(e.getMessage())); + return false; } } else { @@ -174,7 +175,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis try { // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin - cfBundleShortVersionString = TokenMacro.expand(build, listener, cfBundleShortVersionStringValue); + cfBundleShortVersionString = TokenMacro.expandAll(build, listener, cfBundleShortVersionStringValue); listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringUpdate(cfBundleShortVersionString)); returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getAgvtoolPath(), "new-marketing-version", cfBundleShortVersionString).stdout(listener).pwd(projectRoot).join(); if (returnCode > 0) { @@ -192,7 +193,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis try { // If not empty we use the Token Expansion to replace it // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin - cfBundleVersion = TokenMacro.expand(build, listener, cfBundleVersionValue); + cfBundleVersion = TokenMacro.expandAll(build, listener, cfBundleVersionValue); listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionUpdate(cfBundleVersion)); returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getAgvtoolPath(), "new-version", "-all", cfBundleVersion).stdout(listener).pwd(projectRoot).join(); if (returnCode > 0) { diff --git a/src/main/resources/au/com/rayh/Messages.properties b/src/main/resources/au/com/rayh/Messages.properties index 458cde92..b344f41d 100644 --- a/src/main/resources/au/com/rayh/Messages.properties +++ b/src/main/resources/au/com/rayh/Messages.properties @@ -23,7 +23,7 @@ # XCodeBuilder.xcodebuildNotFound=Cannot find xcodebuild with the configured path {0}. XCodeBuilder.avgtoolNotFound=Cannot find agvtool with the configured path {0}. -XCodeBuilder.symRootMacroError=Failure while expanding macros for symRoot. Error: {0} +XCodeBuilder.symRootMacroError=Failure while expanding macros and variables for symRoot. Error: {0} XCodeBuilder.unlockKeychainFailed=Unable to unlock the keychain. XCodeBuilder.xcrunNotFound=Cannot find xcrun with the configured path {0}. XCodeBuilder.cleaningBuildDir=Cleaning build directory: {0} @@ -38,13 +38,13 @@ XCodeBuilder.xcode=XCode XCodeBuilder.xcodeVersionNotFound=Check your XCode installation. Jenkins cannot retrieve its version. XCodeBuilder.CFBundleShortVersionStringNotFound=No marketing version found (CFBundleShortVersionString). XCodeBuilder.CFBundleShortVersionStringFound=Found marketing version (CFBundleShortVersionString): {0}. -XCodeBuilder.CFBundleShortVersionStringMacroError=Failure while expanding macros for CFBundleShortVersionString. Error: {0} +XCodeBuilder.CFBundleShortVersionStringMacroError=Failure while expanding macros and variables for CFBundleShortVersionString. Error: {0} XCodeBuilder.CFBundleShortVersionStringUpdate=Updating marketing version (CFBundleShortVersionString) to: {0} XCodeBuilder.CFBundleShortVersionStringUpdateError=Could not set CFBundleShortVersionString to: {0} XCodeBuilder.CFBundleShortVersionStringUsed=Marketing version (CFBundleShortVersionString) used by Jenkins to produce the IPA: {0} XCodeBuilder.CFBundleShortVersionStringValue=Marketing version (CFBundleShortVersionString) found in project configuration: {0}. XCodeBuilder.CFBundleVersionFound=Found marketing version (CFBundleVersion): {0}. -XCodeBuilder.CFBundleVersionMacroError=Failure while expanding macros for CFBundleVersion. Error: {0} +XCodeBuilder.CFBundleVersionMacroError=Failure while expanding macros and variables for CFBundleVersion. Error: {0} XCodeBuilder.CFBundleVersionNotFound=No marketing version found (CFBundleVersion) XCodeBuilder.CFBundleVersionUpdate=Updating technical version (CFBundleVersion) to: {0} XCodeBuilder.CFBundleVersionUpdateError=Could not set the CFBundleVersion to: {0} diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleShortVersionStringValue.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleShortVersionStringValue.html index 25432fb3..39dc41f5 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleShortVersionStringValue.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleShortVersionStringValue.html @@ -25,6 +25,6 @@

This will set the CFBundleShortVersionString to the specified string.
- Supports all macros from the Token Macro Plugin. + Supports all macros and also environment and build variables from the Token Macro Plugin.

diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleVersionValue.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleVersionValue.html index b68d826f..0a21f7ae 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleVersionValue.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-cfBundleVersionValue.html @@ -25,9 +25,9 @@

This will set the CFBundleVersion to the specified string.
- Supports all macros from the Token Macro Plugin.
+ Supports all macros and also environment and build variables from the Token Macro Plugin.
For example the value ${BUILD_NUMBER} will be replaced with the current build number.
We advice you to generate a unique value for each build if you want for example deploy it into a private store.
- In that case you can use for example : ${ENV,var="JOB_NAME"}-${BUILD_NUMBER} + In that case, for example, you can use : ${JOB_NAME}-${BUILD_NUMBER}

diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-symroot.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-symRoot.html similarity index 81% rename from src/main/resources/au/com/rayh/XCodeBuilder/help-symroot.html rename to src/main/resources/au/com/rayh/XCodeBuilder/help-symRoot.html index b2789f6e..fbb2b4a1 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-symroot.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-symRoot.html @@ -26,7 +26,7 @@

You only need to supply this value if you want to specify the SYMROOT path to use.
If empty, the default SYMROOT path will be used (it could be different depending of your Xcode version).
- Supports all macros from the Token Macro Plugin.
- For example you can use the value : ${ENV,var="WORKSPACE"}/build
+ Supports all macros and also environment and build variables from the Token Macro Plugin.
+ For example you can use the value : ${WORKSPACE}/build

From 041d147b660bda2d96138aa1a83370d1deb9c66f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 29 Nov 2011 23:58:19 +0100 Subject: [PATCH 60/91] [maven-release-plugin] prepare release 1.1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0b83fe24..c191ccf3 100644 --- a/pom.xml +++ b/pom.xml @@ -29,10 +29,10 @@ org.jenkins-ci.plugins plugin 1.399 - + xcode-plugin - 1.1-SNAPSHOT + 1.1 hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 13158f5ef21718bff3ecdc79d1ab2a5828d3269b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 29 Nov 2011 23:58:25 +0100 Subject: [PATCH 61/91] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c191ccf3..31dade30 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.1 + 1.2-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 45db097c5848038e10eac9c20e011bcc107fd924 Mon Sep 17 00:00:00 2001 From: Ray Hilton Date: Thu, 1 Dec 2011 11:22:30 +1100 Subject: [PATCH 62/91] Fix deprecated constructor call --- src/main/java/au/com/rayh/XCodeBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index d45813b8..8c13c6cc 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -96,7 +96,7 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configura @Deprecated public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd) { - this(buildIpa,cleanBeforeBuild,configuration,target,sdk,xcodeProjectPath,xcodeProjectFile,embeddedProfileFile,cfBundleVersionValue,cfBundleShortVersionStringValue,unlockKeychain,keychainPath,keychainPwd,null); + this(buildIpa,cleanBeforeBuild,configuration,target,sdk,xcodeProjectPath,xcodeProjectFile,embeddedProfileFile,null, null, cfBundleVersionValue,cfBundleShortVersionStringValue,unlockKeychain,keychainPath,keychainPwd,null); } @Override From 200404c60a0ea4de9785b724743cffcc192c819c Mon Sep 17 00:00:00 2001 From: Dan Zinngrabe Date: Sun, 4 Dec 2011 16:24:24 -0800 Subject: [PATCH 63/91] Added new functionality that allows a user to specify the build output directory. This overrides the setting in the user's project file, so it will be put into a known directory rather than XcodeDerivedData, etc. This makes it much easier to set up subsequent build steps in Jenkins that do something with the output of the build. It does this by passing the setting CONFIGURATION_BUILD_DIR to xcodebuild if a path is set for this new job config value. --- src/main/java/au/com/rayh/XCodeBuilder.java | 73 ++++++++++++++----- .../au/com/rayh/XCodeBuilder/config.jelly | 5 ++ 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index e306be6a..f989ad26 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -58,6 +58,7 @@ public class XCodeBuilder extends Builder { public final String target; public final String sdk; public final String symRoot; + public final String configurationBuildDir; public final String xcodeProjectPath; public final String xcodeProjectFile; public final String embeddedProfileFile; @@ -73,7 +74,7 @@ public class XCodeBuilder extends Builder { * @since 1.1 */ @DataBoundConstructor - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd, String symRoot) { + public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd, String symRoot, String configurationBuildDir) { this.buildIpa = buildIpa; this.sdk = sdk; this.target = target; @@ -88,11 +89,12 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configura this.keychainPath = keychainPath; this.keychainPwd = keychainPwd; this.symRoot = symRoot; + this.configurationBuildDir = configurationBuildDir; } @Deprecated public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd) { - this(buildIpa,cleanBeforeBuild,configuration,target,sdk,xcodeProjectPath,xcodeProjectFile,embeddedProfileFile,cfBundleVersionValue,cfBundleShortVersionStringValue,unlockKeychain,keychainPath,keychainPwd,null); + this(buildIpa,cleanBeforeBuild,configuration,target,sdk,xcodeProjectPath,xcodeProjectFile,embeddedProfileFile,cfBundleVersionValue,cfBundleShortVersionStringValue,unlockKeychain,keychainPath,keychainPwd,null,null); } @Override @@ -116,23 +118,52 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis } listener.getLogger().println(Messages.XCodeBuilder_workingDir(projectRoot)); + // Infer as best we can the build platform + String buildPlatform = "iphoneos"; + if (!StringUtils.isEmpty(sdk)){ + if (sdk.toLowerCase().indexOf("iphonesimulator") != -1){ + // Building for the simulator + buildPlatform = "iphonesimulator"; + } + } + // Set the build directory and the symRoot - String symRootValue = null; - FilePath buildDirectory; - if (!StringUtils.isEmpty(symRoot)) { - // If not empty we use the Token Expansion to replace it - // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin - try { - symRootValue = TokenMacro.expandAll(build, listener, symRoot).trim(); - buildDirectory = new FilePath(projectRoot.getChannel(),symRootValue).child(configuration + "-iphoneos"); - } catch (MacroEvaluationException e) { - listener.error(Messages.XCodeBuilder_symRootMacroError(e.getMessage())); + // + String symRootValue = null; + String configurationBuildDirValue = null; + FilePath buildDirectory; + if (!StringUtils.isEmpty(symRoot)) { + try { + // If not empty we use the Token Expansion to replace it + // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin + symRootValue = TokenMacro.expandAll(build, listener, symRoot).trim(); + } catch (MacroEvaluationException e) { + listener.error(Messages.XCodeBuilder_symRootMacroError(e.getMessage())); + return false; + } + } + if (!StringUtils.isEmpty(configurationBuildDir)) { + try { + configurationBuildDirValue = TokenMacro.expandAll(build, listener, symRoot).trim(); + } catch (MacroEvaluationException e) { + listener.error(Messages.XCodeBuilder_configurationBuildDirMacroError(e.getMessage())); + return false; + } + } + + + if (symRootValue != null){ + // If there is a SYMROOT specified, build the build directory from that. + buildDirectory = new FilePath(projectRoot.getChannel(),symRootValue).child(configuration + "-" + buildPlatform); + } else if (configurationBuildDirValue != null){ + // If there is a CONFIGURATION_BUILD_DIR, that overrides any use of SYMROOT. Does not require the build platform. + buildDirectory = new FilePath(projectRoot.getChannel(),configurationBuildDirValue).child(configuration); + } else { + // Assume its a build for the handset, not the simulator. + buildDirectory = projectRoot.child("build").child(configuration + "-" + buildPlatform); + } + // - return false; - } - } else { - buildDirectory = projectRoot.child("build").child(configuration + "-iphoneos"); - } // XCode Version int returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getXcodebuildPath(), "-version").stdout(listener).pwd(projectRoot).join(); @@ -281,6 +312,14 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis } else { xcodeReport.append(", symRoot: DEFAULT"); } + + // CONFIGURATION_BUILD_DIR + if (!StringUtils.isEmpty(configurationBuildDirValue)) { + commandLine.add("CONFIGURATION_BUILD_DIR="+configurationBuildDirValue); + xcodeReport.append(", configurationBuildDir: ").append(configurationBuildDirValue); + } else { + xcodeReport.append(", configurationBuildDir: DEFAULT"); + } listener.getLogger().println(xcodeReport.toString()); returnCode = launcher.launch().envs(envs).cmds(commandLine).stdout(reportGenerator.getOutputStream()).pwd(projectRoot).join(); diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index c9d96b57..d5bd8f9b 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -81,6 +81,11 @@ + + + + From b551f641346ef5677bacf2829d5b8e8e2eb3590f Mon Sep 17 00:00:00 2001 From: Dan Zinngrabe Date: Sun, 4 Dec 2011 16:27:50 -0800 Subject: [PATCH 64/91] Added new functionality that allows a user to specify the build output directory. This overrides the setting in the user's project file, so it will be put into a known directory rather than XcodeDerivedData, etc. This makes it much easier to set up subsequent build steps in Jenkins that do something with the output of the build. It does this by passing the setting CONFIGURATION_BUILD_DIR to xcodebuild if a path is set for this new job config value. --- .../help-configurationBuildDir.html | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/resources/au/com/rayh/XCodeBuilder/help-configurationBuildDir.html diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-configurationBuildDir.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-configurationBuildDir.html new file mode 100644 index 00000000..476181e9 --- /dev/null +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-configurationBuildDir.html @@ -0,0 +1,29 @@ + + +
+

+ You only need to supply this value if you want the product of the XCode build to be in a location other than the one specified in the project file. +

+
From e24cfca50becb3714a4af08557ece5b7e969967a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 6 Dec 2011 10:18:42 +0100 Subject: [PATCH 65/91] Cleanup/Improve help files and job parameters descriptions --- .../au/com/rayh/XCodeBuilder/config.jelly | 20 +++++++------ .../com/rayh/XCodeBuilder/help-buildIpa.html | 4 ++- .../XCodeBuilder/help-cleanBeforeBuild.html | 7 +++-- .../rayh/XCodeBuilder/help-configuration.html | 3 +- .../help-configurationBuildDir.html | 12 ++++++-- .../au/com/rayh/XCodeBuilder/help-sdk.html | 10 ++++--- .../com/rayh/XCodeBuilder/help-symRoot.html | 15 ++++++---- .../au/com/rayh/XCodeBuilder/help-target.html | 9 ++++-- .../XCodeBuilder/help-xcodeProjectFile.html | 3 +- .../XCodeBuilder/help-xcodeProjectPath.html | 3 +- .../rayh/XCodeBuilder/help-xcodeSchema.html | 28 +++++++++++++++++++ .../XCodeBuilder/help-xcodeWorkspaceFile.html | 28 +++++++++++++++++++ 12 files changed, 111 insertions(+), 31 deletions(-) create mode 100644 src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeSchema.html create mode 100644 src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeWorkspaceFile.html diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index f4735ba6..f4c4298e 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -29,7 +29,8 @@ See global.jelly for a general discussion about jelly script. --> - + @@ -39,7 +40,7 @@ + description="Only needed if you want to compile for a specific schema instead of a target."> @@ -53,17 +54,18 @@ - + + description="Only needed if you want to compile a workspace instead of a project."> + description="Relative path within the workspace that contains the xcode project file(s)."> @@ -73,7 +75,7 @@ + description="The value to use for CONFIGURATION_BUILD_DIR setting."> @@ -87,7 +89,8 @@ - + @@ -96,7 +99,8 @@ - + diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-buildIpa.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-buildIpa.html index 76f152a5..9bffd7a4 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-buildIpa.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-buildIpa.html @@ -24,5 +24,7 @@

- Checking this option will create a .ipa for each .app found in the build directory. An .ipa is basically a zipped up .app. This is quite handy for distributing ad-hoc builds to testers as they can just double-click the .ipa and it will import into iTunes.

+ Checking this option will create a .ipa for each .app found in the build directory.
+ An .ipa is basically a zipped up .app.
+ This is quite handy for distributing ad-hoc builds to testers as they can just double-click the .ipa and it will import into iTunes.

diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-cleanBeforeBuild.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-cleanBeforeBuild.html index 68d3390e..9843f97b 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-cleanBeforeBuild.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-cleanBeforeBuild.html @@ -23,7 +23,8 @@ -->
-

- This will delete the build directories before invoking the build. This will force the rebuilding of ALL dependencies and can make large projects take a lot longer. -

+

+ This will delete the build directories before invoking the build. This will force the rebuilding of ALL + dependencies and can make large projects take a lot longer. +

diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-configuration.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-configuration.html index c5459e72..81be5509 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-configuration.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-configuration.html @@ -24,6 +24,7 @@

- This is the name of the configuration as defined in the XCode project. By default there are Debug and Release configurations. + This is the name of the configuration as defined in the XCode project.
+ By default there are Debug and Release configurations.

diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-configurationBuildDir.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-configurationBuildDir.html index 476181e9..3e0d2e8c 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-configurationBuildDir.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-configurationBuildDir.html @@ -23,7 +23,13 @@ -->
-

- You only need to supply this value if you want the product of the XCode build to be in a location other than the one specified in the project file. -

+

The value to use for CONFIGURATION_BUILD_DIR setting. You only need to supply this value if you want the product + of the XCode build to be in a location other than the one specified in project settings and this job 'SYMROOT' + parameter.
+ Supports all macros and also environment and + build variables from + the Token Macro Plugin.
+ For example you can use the value :
+

${WORKSPACE}/build

+

diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-sdk.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-sdk.html index 5b50ea9f..c4d926df 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-sdk.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-sdk.html @@ -23,8 +23,10 @@ -->
-

- You only need to supply this value if you want to specify the SDK to build against. If empty, the SDK will be determined by XCode. If you wish to run OCUnit tests, you will need to use the iPhone Simulator's SDK, for example: -

-
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/
+

+ You only need to supply this value if you want to specify the SDK to build against. If empty, the SDK will be + determined by XCode. If you wish to run OCUnit tests, you will need to use the iPhone Simulator's SDK, for + example: +

+
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/
diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-symRoot.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-symRoot.html index fbb2b4a1..4ab13473 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-symRoot.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-symRoot.html @@ -23,10 +23,13 @@ -->
-

- You only need to supply this value if you want to specify the SYMROOT path to use.
- If empty, the default SYMROOT path will be used (it could be different depending of your Xcode version).
- Supports all macros and also environment and build variables from the Token Macro Plugin.
- For example you can use the value : ${WORKSPACE}/build
-

+

+ You only need to supply this value if you want to specify the SYMROOT path to use.
+ If empty, the default SYMROOT path will be used (it could be different depending of your Xcode version).
+ Supports all macros and also environment and build + variables from the Token + Macro Plugin.
+ For example you can use the value :
+

+
${WORKSPACE}/symroot
diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-target.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-target.html index 82f4fa53..903248d6 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-target.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-target.html @@ -23,7 +23,10 @@ -->
-

- The target to build. If left empty, this will build all targets in the project. If you wish to build your binary and the unit test module, it is best to do this as two separate steps each with their own target. This was, the iPhone Simulator SDK can be specified for the unit tests. -

+

+ The target to build. If left empty, this will build all targets in the project.
+ If you wish to build your binary and the unit test module, it is best to do this as two separate steps each with + their own target.
+ This was, the iPhone Simulator SDK can be specified for the unit tests. +

diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectFile.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectFile.html index f61aa11b..6d461481 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectFile.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectFile.html @@ -24,6 +24,7 @@

- If there is more than one XCode project file in the project path, you will need to specify the file name of the project you wish to build. If you need to build all project, you will need to create an XCode build step for each one manually. + If there is more than one XCode project file in the project path, you will need to specify the file name of the project you wish to build.
+ If you need to build all project, you will need to create an XCode build step for each one manually.

diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectPath.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectPath.html index b3d9f707..ccaa7553 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectPath.html +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeProjectPath.html @@ -24,6 +24,7 @@

- This is the relative path from the workspace to the directory that contains the XCode project file. You only need to supply this value if the XCode project you wish to build is not in the root of the workspace. + This is the relative path from the workspace to the directory that contains the XCode project file. + You only need to supply this value if the XCode project you wish to build is not in the root of the workspace.

diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeSchema.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeSchema.html new file mode 100644 index 00000000..ea1496a9 --- /dev/null +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeSchema.html @@ -0,0 +1,28 @@ + + +
+

Only needed if you want to compile for a specific schema instead of a target. + It takes precedence over 'Xcode Configuration' setting and this job 'target' parameter.

+
diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeWorkspaceFile.html b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeWorkspaceFile.html new file mode 100644 index 00000000..944f95fa --- /dev/null +++ b/src/main/resources/au/com/rayh/XCodeBuilder/help-xcodeWorkspaceFile.html @@ -0,0 +1,28 @@ + + +
+

Only needed if you want to compile a workspace instead of a project. + It takes precedence over 'Xcode Project File' setting and this job 'configuration' parameter."

+
From 2bcb51d8680d164c2734afa846666d24893382ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 6 Dec 2011 15:31:47 +0100 Subject: [PATCH 66/91] Add @since info about when we introduced each param --- src/main/java/au/com/rayh/XCodeBuilder.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 24bcdfbf..ef700c99 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -53,22 +53,39 @@ * @author Ray Hilton */ public class XCodeBuilder extends Builder { + /** @since 1.0 */ public final Boolean cleanBeforeBuild; + /** @since 1.0 */ public final String configuration; + /** @since 1.0 */ public final String target; + /** @since 1.0 */ public final String sdk; + /** @since 1.1 */ public final String symRoot; + /** @since 1.2 */ public final String configurationBuildDir; + /** @since 1.0 */ public final String xcodeProjectPath; + /** @since 1.0 */ public final String xcodeProjectFile; + /** @since 1.2 */ public final String xcodeSchema; + /** @since 1.2 */ public final String xcodeWorkspaceFile; + /** @since 1.0 */ public final String embeddedProfileFile; + /** @since 1.0 */ public final String cfBundleVersionValue; + /** @since 1.0 */ public final String cfBundleShortVersionStringValue; + /** @since 1.0 */ public final Boolean buildIpa; + /** @since 1.0 */ public final Boolean unlockKeychain; + /** @since 1.0 */ public final String keychainPath; + /** @since 1.0 */ public final String keychainPwd; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" From a99998e6744ab79572bc43e17cadce3eaf77c6d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 6 Dec 2011 15:33:09 +0100 Subject: [PATCH 67/91] After having checked with the team (and especially Drulli) we don't need to keep previous constructors as they aren't use to deserialize the configuration. We could have to keep them only if we know that this plugin code could be reused in Java --- src/main/java/au/com/rayh/XCodeBuilder.java | 22 --------------------- 1 file changed, 22 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index ef700c99..38119da0 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -89,9 +89,6 @@ public class XCodeBuilder extends Builder { public final String keychainPwd; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" - /** - * @since 1.2 - */ @DataBoundConstructor public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd, String symRoot, String xcodeWorkspaceFile, String xcodeSchema, String configurationBuildDir) { this.buildIpa = buildIpa; @@ -113,25 +110,6 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configura this.configurationBuildDir = configurationBuildDir; } - // We need to keep as long as possible all constructors - // from previous released versions to ensure a good - // backward compatibility for users - /** - * @since 1.1 - */ - @Deprecated - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd, String symRoot) { - this(buildIpa,cleanBeforeBuild,configuration,target,sdk,xcodeProjectPath,xcodeProjectFile,embeddedProfileFile,cfBundleVersionValue,cfBundleShortVersionStringValue,unlockKeychain,keychainPath,keychainPwd,null,null,null,null); - } - - /** - * @since 1.0 - */ - @Deprecated - public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd) { - this(buildIpa,cleanBeforeBuild,configuration,target,sdk,xcodeProjectPath,xcodeProjectFile,embeddedProfileFile,cfBundleVersionValue,cfBundleShortVersionStringValue,unlockKeychain,keychainPath,keychainPwd,null,null,null,null); - } - @Override public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { EnvVars envs = build.getEnvironment(listener); From c2e5f275e067b3f58b614e959f2b4f9c73747870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Tue, 6 Dec 2011 15:48:29 +0100 Subject: [PATCH 68/91] Merge branches 'merge-everything' and 'master' From 02a624212c35688557b323c770ccc3d06ebef204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 8 Dec 2011 00:39:52 +0100 Subject: [PATCH 69/91] [maven-release-plugin] prepare release xcode-plugin-1.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 31dade30..5043f017 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.2-SNAPSHOT + 1.2 hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 0fa3e9b8376b30695908b24dbf5661f369bbd7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 8 Dec 2011 00:40:10 +0100 Subject: [PATCH 70/91] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5043f017..4d72ef57 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.2 + 1.3-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 4f2c02aa9df2c766ae0acf788242e2b9fa7a5b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 15 Dec 2011 22:25:24 +0100 Subject: [PATCH 71/91] Let' s release a bug fix for JENKINS-12089 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4d72ef57..e37e3fe7 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.3-SNAPSHOT + 1.2.1-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 8f87e6b5ce9ad049eac75fd8a694091f1d320d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Thu, 15 Dec 2011 22:26:22 +0100 Subject: [PATCH 72/91] JENKINS-12089 : buildDirectory is wrongly computed thus the cleaning of IPAs fails --- src/main/java/au/com/rayh/XCodeBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 38119da0..8180f6e1 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -166,8 +166,8 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis } if (configurationBuildDirValue != null){ - // If there is a CONFIGURATION_BUILD_DIR, that overrides any use of SYMROOT. Does not require the build platform. - buildDirectory = new FilePath(projectRoot.getChannel(),configurationBuildDirValue).child(configuration); + // If there is a CONFIGURATION_BUILD_DIR, that overrides any use of SYMROOT. Does not require the build platform and the configuration. + buildDirectory = new FilePath(projectRoot.getChannel(),configurationBuildDirValue); } else if (symRootValue != null){ // If there is a SYMROOT specified, compute the build directory from that. buildDirectory = new FilePath(projectRoot.getChannel(),symRootValue).child(configuration + "-" + buildPlatform); From 0da95b1da9137c0ec261cf6a433b244aac54af36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 18 Dec 2011 22:44:48 +0100 Subject: [PATCH 73/91] [maven-release-plugin] prepare release xcode-plugin-1.2.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e37e3fe7..18c89b99 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.2.1-SNAPSHOT + 1.2.1 hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 4a8b2ecabdfa0685edf94f7e71fa3bc32e650130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 18 Dec 2011 22:44:57 +0100 Subject: [PATCH 74/91] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 18c89b99..a23a44b9 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.2.1 + 1.3.0-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 2c95751cda8ca562763cf017d95bfc804b4e52f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 19 Dec 2011 14:13:36 +0100 Subject: [PATCH 75/91] JENKINS-12144 : It will be a bug fix --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a23a44b9..e44acfaa 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.3.0-SNAPSHOT + 1.2.2-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From bf710312e215e5fa48b0fd344c5a602192b03deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 19 Dec 2011 22:34:57 +0100 Subject: [PATCH 76/91] JENKINS-12144 : Always use an absolute path to not have problems when we have a relative path for the FS Root of the remote agent --- src/main/java/au/com/rayh/XCodeBuilder.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 8180f6e1..c19e1c21 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -254,12 +254,12 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Clean build directories if (cleanBeforeBuild) { - listener.getLogger().println(Messages.XCodeBuilder_cleaningBuildDir(projectRoot.child("build"))); + listener.getLogger().println(Messages.XCodeBuilder_cleaningBuildDir(projectRoot.child("build").absolutize().getRemote())); buildDirectory.deleteRecursive(); } // remove test-reports and *.ipa - listener.getLogger().println(Messages.XCodeBuilder_cleaningTestReportsDir(projectRoot.child("test-reports"))); + listener.getLogger().println(Messages.XCodeBuilder_cleaningTestReportsDir(projectRoot.child("test-reports").absolutize().getRemote())); projectRoot.child("test-reports").deleteRecursive(); if (unlockKeychain) { @@ -378,7 +378,7 @@ else if (cfBundleVersion.isEmpty()) payload.deleteRecursive(); payload.mkdirs(); - listener.getLogger().println("Packaging " + app.getBaseName() + ".app => " + ipaLocation); + listener.getLogger().println("Packaging " + app.getBaseName() + ".app => " + ipaLocation.absolutize().getRemote()); List packageCommandLine = new ArrayList(); packageCommandLine.add(getDescriptor().getXcrunPath()); packageCommandLine.add("-sdk"); @@ -388,7 +388,7 @@ else if (cfBundleVersion.isEmpty()) } else { packageCommandLine.add(buildPlatform); } - packageCommandLine.addAll(Lists.newArrayList("PackageApplication", "-v", app.getRemote(), "-o", ipaLocation.getRemote())); + packageCommandLine.addAll(Lists.newArrayList("PackageApplication", "-v", app.absolutize().getRemote(), "-o", ipaLocation.absolutize().getRemote())); if (!StringUtils.isEmpty(embeddedProfileFile)) { packageCommandLine.add("--embed"); packageCommandLine.add(embeddedProfileFile); @@ -396,12 +396,12 @@ else if (cfBundleVersion.isEmpty()) returnCode = launcher.launch().envs(envs).stdout(listener).pwd(projectRoot).cmds(packageCommandLine).join(); if (returnCode > 0) { - listener.getLogger().println("Failed to build " + ipaLocation.getName()); + listener.getLogger().println("Failed to build " + ipaLocation.absolutize().getRemote()); continue; } // also zip up the symbols, if present - returnCode = launcher.launch().envs(envs).stdout(listener).pwd(buildDirectory).cmds("zip", "-r", "-T", "-y", baseName + "-dSYM.zip", app.getBaseName() + ".app.dSYM").join(); + returnCode = launcher.launch().envs(envs).stdout(listener).pwd(buildDirectory).cmds("zip", "-r", "-T", "-y", baseName + "-dSYM.zip", app.absolutize().getRemote() + ".app.dSYM").join(); if (returnCode > 0) { listener.getLogger().println(Messages.XCodeBuilder_zipFailed(baseName)); continue; From b668c94aebd741f3491ac74d12ba3f1a93750361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 19 Dec 2011 22:39:14 +0100 Subject: [PATCH 77/91] [maven-release-plugin] prepare release xcode-plugin-1.2.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e44acfaa..0cd73ad2 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.2.2-SNAPSHOT + 1.2.2 hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From b2e5dd551f7096620f48c8e92547c99c2927088c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 19 Dec 2011 22:39:21 +0100 Subject: [PATCH 78/91] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0cd73ad2..a23a44b9 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.2.2 + 1.3.0-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From dbdb0672cd7aa93a82abf24d8e4361029d428e5c Mon Sep 17 00:00:00 2001 From: Oliver Hoeltke Date: Mon, 2 Jan 2012 20:20:15 +0100 Subject: [PATCH 79/91] fixed double .app extension while compression .dsym --- pom.xml | 2 +- src/main/java/au/com/rayh/XCodeBuilder.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a23a44b9..1ac7f4cb 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.3.0-SNAPSHOT + 1.2.3-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index c19e1c21..db0e7cd2 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -401,7 +401,7 @@ else if (cfBundleVersion.isEmpty()) } // also zip up the symbols, if present - returnCode = launcher.launch().envs(envs).stdout(listener).pwd(buildDirectory).cmds("zip", "-r", "-T", "-y", baseName + "-dSYM.zip", app.absolutize().getRemote() + ".app.dSYM").join(); + returnCode = launcher.launch().envs(envs).stdout(listener).pwd(buildDirectory).cmds("zip", "-r", "-T", "-y", baseName + "-dSYM.zip", app.absolutize().getRemote() + ".dSYM").join(); if (returnCode > 0) { listener.getLogger().println(Messages.XCodeBuilder_zipFailed(baseName)); continue; From bbf50b7d182fefb0540fd1028b85754002d223c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 4 Jan 2012 00:21:58 +0100 Subject: [PATCH 80/91] Let's back on a bug fix release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a23a44b9..1ac7f4cb 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.3.0-SNAPSHOT + 1.2.3-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From a04a48d27142113f96f31d46c44628c7ee5845d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 4 Jan 2012 01:00:53 +0100 Subject: [PATCH 81/91] code format --- src/main/java/au/com/rayh/XCodeBuilder.java | 178 ++++++++++++-------- 1 file changed, 106 insertions(+), 72 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index db0e7cd2..307cf079 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -53,39 +53,73 @@ * @author Ray Hilton */ public class XCodeBuilder extends Builder { - /** @since 1.0 */ + /** + * @since 1.0 + */ public final Boolean cleanBeforeBuild; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String configuration; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String target; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String sdk; - /** @since 1.1 */ + /** + * @since 1.1 + */ public final String symRoot; - /** @since 1.2 */ + /** + * @since 1.2 + */ public final String configurationBuildDir; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String xcodeProjectPath; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String xcodeProjectFile; - /** @since 1.2 */ + /** + * @since 1.2 + */ public final String xcodeSchema; - /** @since 1.2 */ + /** + * @since 1.2 + */ public final String xcodeWorkspaceFile; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String embeddedProfileFile; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String cfBundleVersionValue; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String cfBundleShortVersionStringValue; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final Boolean buildIpa; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final Boolean unlockKeychain; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String keychainPath; - /** @since 1.0 */ + /** + * @since 1.0 + */ public final String keychainPwd; // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @@ -133,48 +167,48 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Infer as best we can the build platform String buildPlatform = "iphoneos"; - if (!StringUtils.isEmpty(sdk)){ - if (StringUtils.contains(sdk.toLowerCase(),"iphonesimulator")){ - // Building for the simulator - buildPlatform = "iphonesimulator"; - } - } + if (!StringUtils.isEmpty(sdk)) { + if (StringUtils.contains(sdk.toLowerCase(), "iphonesimulator")) { + // Building for the simulator + buildPlatform = "iphonesimulator"; + } + } // Set the build directory and the symRoot - // - String symRootValue = null; - if (!StringUtils.isEmpty(symRoot)) { - try { - // If not empty we use the Token Expansion to replace it - // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin - symRootValue = TokenMacro.expandAll(build, listener, symRoot).trim(); - } catch (MacroEvaluationException e) { - listener.error(Messages.XCodeBuilder_symRootMacroError(e.getMessage())); - return false; - } - } + // + String symRootValue = null; + if (!StringUtils.isEmpty(symRoot)) { + try { + // If not empty we use the Token Expansion to replace it + // https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin + symRootValue = TokenMacro.expandAll(build, listener, symRoot).trim(); + } catch (MacroEvaluationException e) { + listener.error(Messages.XCodeBuilder_symRootMacroError(e.getMessage())); + return false; + } + } String configurationBuildDirValue = null; - FilePath buildDirectory; - if (!StringUtils.isEmpty(configurationBuildDir)) { - try { - configurationBuildDirValue = TokenMacro.expandAll(build, listener, configurationBuildDir).trim(); - } catch (MacroEvaluationException e) { - listener.error(Messages.XCodeBuilder_configurationBuildDirMacroError(e.getMessage())); - return false; - } - } - - if (configurationBuildDirValue != null){ + FilePath buildDirectory; + if (!StringUtils.isEmpty(configurationBuildDir)) { + try { + configurationBuildDirValue = TokenMacro.expandAll(build, listener, configurationBuildDir).trim(); + } catch (MacroEvaluationException e) { + listener.error(Messages.XCodeBuilder_configurationBuildDirMacroError(e.getMessage())); + return false; + } + } + + if (configurationBuildDirValue != null) { // If there is a CONFIGURATION_BUILD_DIR, that overrides any use of SYMROOT. Does not require the build platform and the configuration. - buildDirectory = new FilePath(projectRoot.getChannel(),configurationBuildDirValue); - } else if (symRootValue != null){ + buildDirectory = new FilePath(projectRoot.getChannel(), configurationBuildDirValue); + } else if (symRootValue != null) { // If there is a SYMROOT specified, compute the build directory from that. - buildDirectory = new FilePath(projectRoot.getChannel(),symRootValue).child(configuration + "-" + buildPlatform); - } else { - // Assume its a build for the handset, not the simulator. - buildDirectory = projectRoot.child("build").child(configuration + "-" + buildPlatform); - } + buildDirectory = new FilePath(projectRoot.getChannel(), symRootValue).child(configuration + "-" + buildPlatform); + } else { + // Assume its a build for the handset, not the simulator. + buildDirectory = projectRoot.child("build").child(configuration + "-" + buildPlatform); + } // XCode Version int returnCode = launcher.launch().envs(envs).cmds(getDescriptor().getXcodebuildPath(), "-version").stdout(listener).pwd(projectRoot).join(); @@ -264,12 +298,12 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis if (unlockKeychain) { // Let's unlock the keychain - launcher.launch().envs(envs).cmds("/usr/bin/security","list-keychains","-s",keychainPath).stdout(listener).pwd(projectRoot).join(); - launcher.launch().envs(envs).cmds("/usr/bin/security","login-keychain","-d","user","-s",keychainPath).stdout(listener).pwd(projectRoot).join(); - if(StringUtils.isEmpty(keychainPwd)) - returnCode = launcher.launch().envs(envs).cmds("/usr/bin/security","unlock-keychain",keychainPath).stdout(listener).pwd(projectRoot).join(); + launcher.launch().envs(envs).cmds("/usr/bin/security", "list-keychains", "-s", keychainPath).stdout(listener).pwd(projectRoot).join(); + launcher.launch().envs(envs).cmds("/usr/bin/security", "login-keychain", "-d", "user", "-s", keychainPath).stdout(listener).pwd(projectRoot).join(); + if (StringUtils.isEmpty(keychainPwd)) + returnCode = launcher.launch().envs(envs).cmds("/usr/bin/security", "unlock-keychain", keychainPath).stdout(listener).pwd(projectRoot).join(); else - returnCode = launcher.launch().envs(envs).cmds("/usr/bin/security","unlock-keychain","-p",keychainPwd,keychainPath).masks(false,false,false,true,false).stdout(listener).pwd(projectRoot).join(); + returnCode = launcher.launch().envs(envs).cmds("/usr/bin/security", "unlock-keychain", "-p", keychainPwd, keychainPath).masks(false, false, false, true, false).stdout(listener).pwd(projectRoot).join(); if (returnCode > 0) { listener.fatalError(Messages.XCodeBuilder_unlockKeychainFailed()); return false; @@ -282,7 +316,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis List commandLine = Lists.newArrayList(getDescriptor().getXcodebuildPath()); // Prioritizing schema over target setting - if(!StringUtils.isEmpty(xcodeSchema)) { + if (!StringUtils.isEmpty(xcodeSchema)) { commandLine.add("-scheme"); commandLine.add(xcodeSchema); xcodeReport.append(", scheme: ").append(xcodeSchema); @@ -329,19 +363,19 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis commandLine.add("build"); if (!StringUtils.isEmpty(symRootValue)) { - commandLine.add("SYMROOT="+symRootValue); + commandLine.add("SYMROOT=" + symRootValue); xcodeReport.append(", symRoot: ").append(symRootValue); } else { xcodeReport.append(", symRoot: DEFAULT"); } - - // CONFIGURATION_BUILD_DIR - if (!StringUtils.isEmpty(configurationBuildDirValue)) { - commandLine.add("CONFIGURATION_BUILD_DIR="+configurationBuildDirValue); - xcodeReport.append(", configurationBuildDir: ").append(configurationBuildDirValue); - } else { - xcodeReport.append(", configurationBuildDir: DEFAULT"); - } + + // CONFIGURATION_BUILD_DIR + if (!StringUtils.isEmpty(configurationBuildDirValue)) { + commandLine.add("CONFIGURATION_BUILD_DIR=" + configurationBuildDirValue); + xcodeReport.append(", configurationBuildDir: ").append(configurationBuildDirValue); + } else { + xcodeReport.append(", configurationBuildDir: DEFAULT"); + } listener.getLogger().println(xcodeReport.toString()); returnCode = launcher.launch().envs(envs).cmds(commandLine).stdout(reportGenerator.getOutputStream()).pwd(projectRoot).join(); @@ -481,16 +515,16 @@ public String getXcrunPath() { } public void setXcodebuildPath(String xcodebuildPath) { - this.xcodebuildPath = xcodebuildPath; + this.xcodebuildPath = xcodebuildPath; } public void setAgvtoolPath(String agvtoolPath) { - this.agvtoolPath = agvtoolPath; + this.agvtoolPath = agvtoolPath; } public void setXcrunPath(String xcrunPath) { - this.xcrunPath = xcrunPath; + this.xcrunPath = xcrunPath; } - } + } } From 462b28019c558295710ed8377ebfb531287ba9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Wed, 4 Jan 2012 01:02:57 +0100 Subject: [PATCH 82/91] Fix log message about the path of the deleted build directory --- src/main/java/au/com/rayh/XCodeBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 307cf079..5e8708bb 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -288,7 +288,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Clean build directories if (cleanBeforeBuild) { - listener.getLogger().println(Messages.XCodeBuilder_cleaningBuildDir(projectRoot.child("build").absolutize().getRemote())); + listener.getLogger().println(Messages.XCodeBuilder_cleaningBuildDir(buildDirectory.absolutize().getRemote())); buildDirectory.deleteRecursive(); } From f9cdaaca0d4351ea6af5c7f3f8d11e16dbb02f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 9 Jan 2012 21:30:19 +0100 Subject: [PATCH 83/91] JENKINS-12237 : Failed deleting previous generated IPA results in a failed build Don't try to delete if the the directory doesn't exist. --- src/main/java/au/com/rayh/XCodeBuilder.java | 10 +++++++--- src/main/resources/au/com/rayh/Messages.properties | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 5e8708bb..87042d31 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -386,9 +386,13 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // Package IPA if (buildIpa) { - listener.getLogger().println(Messages.XCodeBuilder_cleaningIPA()); - for (FilePath path : buildDirectory.list("*.ipa")) { - path.delete(); + if (buildDirectory.exists()) { + listener.getLogger().println(Messages.XCodeBuilder_cleaningIPA()); + for (FilePath path : buildDirectory.list("*.ipa")) { + path.delete(); + } + } else { + listener.getLogger().println(Messages.XCodeBuilder_NotExistingDirToCleanIPA(buildDirectory.absolutize().getRemote())); } listener.getLogger().println(Messages.XCodeBuilder_packagingIPA()); diff --git a/src/main/resources/au/com/rayh/Messages.properties b/src/main/resources/au/com/rayh/Messages.properties index aaa9ff05..b5d363d8 100644 --- a/src/main/resources/au/com/rayh/Messages.properties +++ b/src/main/resources/au/com/rayh/Messages.properties @@ -51,6 +51,7 @@ XCodeBuilder.CFBundleVersionUpdate=Updating technical version (CFBundleVersion) XCodeBuilder.CFBundleVersionUpdateError=Could not set the CFBundleVersion to: {0} XCodeBuilder.CFBundleVersionUsed=Technical version (CFBundleVersion) used by Jenkins to produce the IPA: {0} XCodeBuilder.CFBundleVersionValue=Technical version (CFBundleVersion) found in project configuration: {0}. +XCodeBuilder.NotExistingDirToCleanIPA=Cannot remove *.ipa files from a non-existing directory: {0} XCodeBuilder.agvtoolPathNotSet=Please specify the path to the agvtool executable (usually /usr/bin/agvtool) XCodeBuilder.xcodebuildPathNotSet=Please specify the path to the xcodebuild executable (usually /usr/bin/xcodebuild) XCodeBuilder.xcrunPathNotSet=Please specify the path to the xcrun executable (usually /usr/bin/xcrun) From 445690fea943d7238a00c2bb3395fb04ef343a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 9 Jan 2012 21:53:22 +0100 Subject: [PATCH 84/91] New minor version. New parameters added. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1ac7f4cb..4d72ef57 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.2.3-SNAPSHOT + 1.3-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From b2985f135b9d88298d4ce7a7058f5b202463fd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 9 Jan 2012 21:57:18 +0100 Subject: [PATCH 85/91] Fix java 1.5 compat by using StringUtils.isEmpty() instead of String.isEmpty() --- src/main/java/au/com/rayh/XCodeBuilder.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 1738a46f..fd3d0431 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -236,7 +236,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // only use this version number if we found it if (returnCode == 0) cfBundleShortVersionString = output.toString().trim(); - if (cfBundleShortVersionString.isEmpty()) + if (StringUtils.isEmpty(cfBundleShortVersionString)) listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringNotFound()); else listener.getLogger().println(Messages.XCodeBuilder_CFBundleShortVersionStringFound(cfBundleShortVersionString)); @@ -249,7 +249,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis // only use this version number if we found it if (returnCode == 0) cfBundleVersion = output.toString().trim(); - if (cfBundleVersion.isEmpty()) + if (StringUtils.isEmpty(cfBundleVersion)) listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionNotFound()); else listener.getLogger().println(Messages.XCodeBuilder_CFBundleVersionFound(cfBundleShortVersionString)); @@ -420,15 +420,15 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis for (FilePath app : apps) { String version; - if (cfBundleShortVersionString.isEmpty() && cfBundleVersion.isEmpty()) + if (StringUtils.isEmpty(cfBundleShortVersionString) && StringUtils.isEmpty(cfBundleVersion)) version = Integer.toString(build.getNumber()); - else if (cfBundleVersion.isEmpty()) + else if (StringUtils.isEmpty(cfBundleVersion)) version = cfBundleShortVersionString; else version = cfBundleVersion; String baseName = app.getBaseName().replaceAll(" ", "_") + "-" + - configuration.replaceAll(" ", "_") + (version.isEmpty() ? "" : "-" + version); + configuration.replaceAll(" ", "_") + (StringUtils.isEmpty(version) ? "" : "-" + version); FilePath ipaLocation = buildDirectory.child(baseName + ".ipa"); From 4aacab1b0d01b64b7fb1382e83e63c6a7536cb27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 9 Jan 2012 22:04:40 +0100 Subject: [PATCH 86/91] JENKINS-12217 : fails to set default keychain when using alternate (non login) keychain --- src/main/java/au/com/rayh/XCodeBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index fd3d0431..f37da5b7 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -311,7 +311,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis if (unlockKeychain) { // Let's unlock the keychain launcher.launch().envs(envs).cmds("/usr/bin/security", "list-keychains", "-s", keychainPath).stdout(listener).pwd(projectRoot).join(); - launcher.launch().envs(envs).cmds("/usr/bin/security", "login-keychain", "-d", "user", "-s", keychainPath).stdout(listener).pwd(projectRoot).join(); + launcher.launch().envs(envs).cmds("/usr/bin/security", "default-keychain", "-d", "user", "-s", keychainPath).stdout(listener).pwd(projectRoot).join(); if (StringUtils.isEmpty(keychainPwd)) returnCode = launcher.launch().envs(envs).cmds("/usr/bin/security", "unlock-keychain", keychainPath).stdout(listener).pwd(projectRoot).join(); else From b112fcc1039ef5a042d108ca8935efc85722a093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Mon, 9 Jan 2012 22:11:06 +0100 Subject: [PATCH 87/91] These parameters will be available in 1.3 --- src/main/java/au/com/rayh/XCodeBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index f37da5b7..f7d10e2c 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -58,7 +58,7 @@ public class XCodeBuilder extends Builder { */ public final Boolean cleanBeforeBuild; /** - * @since TODO + * @since 1.3 */ public final Boolean cleanTestReports; /** @@ -90,7 +90,7 @@ public class XCodeBuilder extends Builder { */ public final String xcodeProjectFile; /** - * @since TODO + * @since 1.3 */ private String xcodebuildArguments; /** From cb5af2c96b9b1be0ccc21613cadbeb69cf13db80 Mon Sep 17 00:00:00 2001 From: Vladimir Grichina Date: Wed, 11 Jan 2012 06:59:26 +0200 Subject: [PATCH 88/91] Fixed NullPointerException with older job configs --- src/main/java/au/com/rayh/XCodeBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index a7dcd767..04c46486 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -308,7 +308,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis projectRoot.child("test-reports").deleteRecursive(); } - if (unlockKeychain) { + if (unlockKeychain != null && unlockKeychain) { // Let's unlock the keychain launcher.launch().envs(envs).cmds("/usr/bin/security", "list-keychains", "-s", keychainPath).stdout(listener).pwd(projectRoot).join(); launcher.launch().envs(envs).cmds("/usr/bin/security", "login-keychain", "-d", "user", "-s", keychainPath).stdout(listener).pwd(projectRoot).join(); From 399ee0ef114bd0a4e8d0fbbc9ba4348bb5b461d9 Mon Sep 17 00:00:00 2001 From: Vladimir Grichina Date: Wed, 11 Jan 2012 07:03:07 +0200 Subject: [PATCH 89/91] Moved "Clean Test Reports" option into more appropriate place --- .../resources/au/com/rayh/XCodeBuilder/config.jelly | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly index 965eea2d..9bfebf0b 100644 --- a/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly +++ b/src/main/resources/au/com/rayh/XCodeBuilder/config.jelly @@ -34,6 +34,11 @@
+ + + + @@ -94,11 +99,6 @@ - - - - From ace2a26bca76765028e97d27bff0de4092344869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Fri, 20 Jan 2012 23:37:52 +0100 Subject: [PATCH 90/91] [maven-release-plugin] prepare release xcode-plugin-1.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4d72ef57..4b8e1c46 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.3-SNAPSHOT + 1.3 hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). From 7977eeb78585dc71e94c6f5d62caef529765d54a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Fri, 20 Jan 2012 23:38:15 +0100 Subject: [PATCH 91/91] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4b8e1c46..af4830d0 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ xcode-plugin - 1.3 + 1.3.1-SNAPSHOT hpi XCode integration This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...).