Skip to content
Permalink
Browse files

[JENKINS-46064] Adapt to the new parser engine

  • Loading branch information...
rsandell committed Aug 17, 2017
1 parent cdf2d8f commit e2d67cc959f7161698dcf90f4eb6dd101a2557fa
@@ -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;

/**
@@ -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);
}
}
}
@@ -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.
*
@@ -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);
}
}
}
@@ -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

0 comments on commit e2d67cc

Please sign in to comment.
You can’t perform that action at this time.