Skip to content

Commit

Permalink
Include Env and parameters when expanding Macros
Browse files Browse the repository at this point in the history
Change TokenMacro.expand to TokenMacro.expandAll as included added in version 1.5.1
of the TokenMacro plugin (skip 1.5.0 due to http://issues.jenkins-ci.org/browse/JENKINS-11914)

This will now expand all macros including ones from Paramer Actions.
  • Loading branch information
c3johnso committed Jan 13, 2012
1 parent a5f5958 commit d226333
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -63,7 +63,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
<version>1.4</version>
<version>1.5.1</version>
</dependency>
</dependencies>

Expand Down
Expand Up @@ -53,7 +53,7 @@ public String getToken() {

@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception {
final String expandedToken = Util.fixEmptyAndTrim(TokenMacro.expand(build, listener, token));
final String expandedToken = Util.fixEmptyAndTrim(TokenMacro.expandAll(build, listener, token));
if (expandedToken == null) return false;
return RUN_REGEX.matcher(expandedToken.toLowerCase()).matches();
}
Expand Down
Expand Up @@ -53,8 +53,8 @@ public String getExpression() {

@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception {
final String expandedExpression = TokenMacro.expand(build, listener, expression);
String expandedLabel = TokenMacro.expand(build, listener, label);
final String expandedExpression = TokenMacro.expandAll(build, listener, expression);
String expandedLabel = TokenMacro.expandAll(build, listener, label);
listener.getLogger().println(Messages.expressionCondition_console_args(expandedExpression, expandedLabel));
return expandedLabel.matches(expandedExpression);
}
Expand Down
Expand Up @@ -60,7 +60,7 @@ public String getFile() {

@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception {
final String expandedFile = TokenMacro.expand(build, listener, file);
final String expandedFile = TokenMacro.expandAll(build, listener, file);
return baseDir.getBaseDirectory(build).child(expandedFile).exists();
}

Expand Down
Expand Up @@ -66,9 +66,9 @@ public Comparator getComparator() {

@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception {
final String leftString = TokenMacro.expand(build, listener, lhs);
final String leftString = TokenMacro.expandAll(build, listener, lhs);
final double left = Double.parseDouble(leftString);
final String rightString = TokenMacro.expand(build, listener, rhs);
final String rightString = TokenMacro.expandAll(build, listener, rhs);
final double right = Double.parseDouble(rightString);
listener.getLogger().println(Messages.numericalComparison_console_args(left, comparator.getDescriptor().getDisplayName(), right));
return comparator.isTrue(left, right);
Expand Down
Expand Up @@ -59,8 +59,8 @@ public boolean isIgnoreCase() {

@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception {
final String expanded1 = TokenMacro.expand(build, listener, arg1);
final String expanded2 = TokenMacro.expand(build, listener, arg2);
final String expanded1 = TokenMacro.expandAll(build, listener, arg1);
final String expanded2 = TokenMacro.expandAll(build, listener, arg2);
listener.getLogger().println(Messages.stringsMatchCondition_console_args(expanded1, expanded2));
if (expanded1 == null) return false;
return ignoreCase ? expanded1.equalsIgnoreCase(expanded2) : expanded1.equals(expanded2);
Expand Down

0 comments on commit d226333

Please sign in to comment.