Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a field for entering code signing identity #6

Merged
merged 2 commits into from Apr 5, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/main/java/au/com/rayh/XCodeBuilder.java
Expand Up @@ -129,10 +129,14 @@ public class XCodeBuilder extends Builder {
* @since 1.0 * @since 1.0
*/ */
public final String keychainPwd; public final String keychainPwd;
/**
* @since 1.3.2
*/
public final String codeSigningIdentity;


// Fields in config.jelly must match the parameter names in the "DataBoundConstructor" // Fields in config.jelly must match the parameter names in the "DataBoundConstructor"
@DataBoundConstructor @DataBoundConstructor
public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, Boolean cleanTestReports, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String xcodebuildArguments, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd, String symRoot, String xcodeWorkspaceFile, String xcodeSchema, String configurationBuildDir) { public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, Boolean cleanTestReports, String configuration, String target, String sdk, String xcodeProjectPath, String xcodeProjectFile, String xcodebuildArguments, String embeddedProfileFile, String cfBundleVersionValue, String cfBundleShortVersionStringValue, Boolean unlockKeychain, String keychainPath, String keychainPwd, String symRoot, String xcodeWorkspaceFile, String xcodeSchema, String configurationBuildDir, String codeSigningIdentity) {
this.buildIpa = buildIpa; this.buildIpa = buildIpa;
this.sdk = sdk; this.sdk = sdk;
this.target = target; this.target = target;
Expand All @@ -145,6 +149,7 @@ public XCodeBuilder(Boolean buildIpa, Boolean cleanBeforeBuild, Boolean cleanTes
this.xcodeWorkspaceFile = xcodeWorkspaceFile; this.xcodeWorkspaceFile = xcodeWorkspaceFile;
this.xcodeSchema = xcodeSchema; this.xcodeSchema = xcodeSchema;
this.embeddedProfileFile = embeddedProfileFile; this.embeddedProfileFile = embeddedProfileFile;
this.codeSigningIdentity = codeSigningIdentity;
this.cfBundleVersionValue = cfBundleVersionValue; this.cfBundleVersionValue = cfBundleVersionValue;
this.cfBundleShortVersionStringValue = cfBundleShortVersionStringValue; this.cfBundleShortVersionStringValue = cfBundleShortVersionStringValue;
this.unlockKeychain = unlockKeychain; this.unlockKeychain = unlockKeychain;
Expand Down Expand Up @@ -389,6 +394,14 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis
xcodeReport.append(", configurationBuildDir: DEFAULT"); xcodeReport.append(", configurationBuildDir: DEFAULT");
} }


// handle code signing identities
if (!StringUtils.isEmpty(codeSigningIdentity)) {
commandLine.add("CODE_SIGN_IDENTITY=" + codeSigningIdentity);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your fix might also help to fix this one : https://issues.jenkins-ci.org/browse/JENKINS-12800
But I'm not sure that it works if you have a space in codeSigningIdentity
Did you try it ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact it does. It's not really the best fix (as there are other options) but that's actually what led me here. I took a few stabs at the regex and decided that this was a quicker path to something working ;-)

xcodeReport.append(", codeSignIdentity: ").append(codeSigningIdentity);
} else {
xcodeReport.append(", codeSignIdentity: DEFAULT");
}

// Additional (custom) xcodebuild arguments // Additional (custom) xcodebuild arguments
if (!StringUtils.isEmpty(xcodebuildArguments)) { if (!StringUtils.isEmpty(xcodebuildArguments)) {
String[] parts = xcodebuildArguments.split("[ ]"); String[] parts = xcodebuildArguments.split("[ ]");
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/au/com/rayh/XCodeBuilder/config.jelly
Expand Up @@ -104,6 +104,11 @@
<f:checkbox /> <f:checkbox />
</f:entry> </f:entry>


<f:entry title="${%Code Signing Identity}" field="codeSigningIdentity"
description="Override the code signing identity specified in the project">
<f:textbox />
</f:entry>

<f:entry title="${%Embedded Profile}" field="embeddedProfileFile" <f:entry title="${%Embedded Profile}" field="embeddedProfileFile"
description="The relative path to the mobileprovision to embed, leave blank for no embedded profile"> description="The relative path to the mobileprovision to embed, leave blank for no embedded profile">
<f:textbox /> <f:textbox />
Expand Down
@@ -0,0 +1,33 @@
<!--
~ 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.
-->

<div>
<p>
Override the code signing identity specified within the project config.

This lets you keep your xcode project setup to build with developer certificates
interactively but put your distribution certificate on the hosts running jenkins
to build your actual releases.
</p>
</div>