Skip to content

Commit

Permalink
JENKINS-11892 : Upgrade token macro plugin to version 1.5.1 to allow …
Browse files Browse the repository at this point in the history
…to replace macro but also environment and build variables in configuration parameters
  • Loading branch information
aheritier committed Nov 29, 2011
1 parent 6840d65 commit 5d2b556
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -78,7 +78,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
<version>1.4</version>
<version>1.5.1</version>
</dependency>
</dependencies>
<build>
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/au/com/rayh/XCodeBuilder.java
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/au/com/rayh/Messages.properties
Expand Up @@ -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}
Expand All @@ -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}
Expand Down
Expand Up @@ -25,6 +25,6 @@
<div>
<p>
This will set the CFBundleShortVersionString to the specified string.<br/>
Supports all macros from the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin" target="_blank">Token Macro Plugin</a>.
Supports all macros and also environment and <a href="http://ci.jenkins-ci.org/env-vars.html" target="_blank">build variables</a> from the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin" target="_blank">Token Macro Plugin</a>.<br/>
</p>
</div>
Expand Up @@ -25,9 +25,9 @@
<div>
<p>
This will set the CFBundleVersion to the specified string.<br/>
Supports all macros from the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin" target="_blank">Token Macro Plugin</a>.<br/>
Supports all macros and also environment and <a href="http://ci.jenkins-ci.org/env-vars.html" target="_blank">build variables</a> from the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin" target="_blank">Token Macro Plugin</a>.<br/>
For example the value ${BUILD_NUMBER} will be replaced with the current build number.<br/>
We advice you to generate a unique value for each build if you want for example deploy it into a private store.<br/>
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}
</p>
</div>
Expand Up @@ -26,7 +26,7 @@
<p>
You only need to supply this value if you want to specify the SYMROOT path to use.<br/>
If empty, the default SYMROOT path will be used (it could be different depending of your Xcode version).<br/>
Supports all macros from the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin" target="_blank">Token Macro Plugin</a>.<br/>
For example you can use the value : ${ENV,var="WORKSPACE"}/build<br/>
Supports all macros and also environment and <a href="http://ci.jenkins-ci.org/env-vars.html" target="_blank">build variables</a> from the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin" target="_blank">Token Macro Plugin</a>.<br/>
For example you can use the value : ${WORKSPACE}/build<br/>
</p>
</div>

0 comments on commit 5d2b556

Please sign in to comment.