Navigation Menu

Skip to content

Commit

Permalink
[JENKINS-46064] Adapt to the new parser engine
Browse files Browse the repository at this point in the history
  • Loading branch information
rsandell committed Aug 17, 2017
1 parent cdf2d8f commit e2d67cc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Expand Up @@ -26,11 +26,15 @@
package org.jenkinsci.plugins.pipeline.modeldefinition.when.impl;

import hudson.Extension;
import org.codehaus.groovy.ast.expr.Expression;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTWhenContent;
import org.jenkinsci.plugins.pipeline.modeldefinition.parser.ASTParserUtils;
import org.jenkinsci.plugins.pipeline.modeldefinition.when.DeclarativeStageConditional;
import org.jenkinsci.plugins.pipeline.modeldefinition.when.DeclarativeStageConditionalDescriptor;
import org.kohsuke.stapler.DataBoundConstructor;

import javax.annotation.CheckForNull;
import java.util.regex.Pattern;

/**
Expand Down Expand Up @@ -62,6 +66,9 @@ public Pattern getMultiLinePattern() {
@Extension
@Symbol("changelog")
public static class DescriptorImpl extends DeclarativeStageConditionalDescriptor<ChangelogConditional> {

@Override
public Expression transformToRuntimeAST(@CheckForNull ModelASTWhenContent original) {
return ASTParserUtils.transformWhenContentToRuntimeAST(original);
}
}
}
Expand Up @@ -26,12 +26,17 @@
package org.jenkinsci.plugins.pipeline.modeldefinition.when.impl;

import hudson.Extension;
import org.codehaus.groovy.ast.expr.Expression;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTWhenContent;
import org.jenkinsci.plugins.pipeline.modeldefinition.parser.ASTParserUtils;
import org.jenkinsci.plugins.pipeline.modeldefinition.when.DeclarativeStageConditional;
import org.jenkinsci.plugins.pipeline.modeldefinition.when.DeclarativeStageConditionalDescriptor;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;

import javax.annotation.CheckForNull;

/**
* Conditional that checks the affected file paths recorded in the changelog.
*
Expand Down Expand Up @@ -64,6 +69,9 @@ public void setCaseSensitive(boolean caseSensitive) {
@Extension
@Symbol("changeset")
public static class DescriptorImpl extends DeclarativeStageConditionalDescriptor<ChangesetConditional> {

@Override
public Expression transformToRuntimeAST(@CheckForNull ModelASTWhenContent original) {
return ASTParserUtils.transformWhenContentToRuntimeAST(original);
}
}
}
Expand Up @@ -39,8 +39,7 @@ class ChangesetConditionalScript extends AbstractChangelogConditionalScript<Chan

@Override
void initializeEval() {
glob = (String)script.evaluate(Utils.prepareForEvalToString(describable.glob)) //TODO change when #174 lands
glob = glob.replace('\\', '/')
glob = describable.glob.replace('\\', '/')
}

@Override
Expand Down

0 comments on commit e2d67cc

Please sign in to comment.