Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-40462] Move wrappers into options
This depends on
#70
so shouldn't be merged until that's in.

I'm not a huge fan of the hoops we have to jump through to support
wrappers in the same section as Describables, so I may tweak this.
  • Loading branch information
abayer committed Dec 16, 2016
1 parent e7cb5d8 commit 0bc6a85
Show file tree
Hide file tree
Showing 27 changed files with 94 additions and 593 deletions.
Expand Up @@ -19,7 +19,6 @@ public final class ModelASTPipelineDef extends ModelASTElement {
private ModelASTOptions options;
private ModelASTBuildParameters parameters;
private ModelASTTriggers triggers;
private ModelASTWrappers wrappers;

public ModelASTPipelineDef(Object sourceLocation) {
super(sourceLocation);
Expand Down Expand Up @@ -48,11 +47,6 @@ public JSONObject toJSON() {
} else {
a.put("triggers", null);
}
if (wrappers != null && !wrappers.getWrappers().isEmpty()) {
a.put("wrappers", wrappers.toJSON());
} else {
a.put("wrappers", null);
}
return new JSONObject().accumulate("pipeline", a);
}

Expand Down Expand Up @@ -84,9 +78,6 @@ public void validate(ModelValidator validator) {
if (triggers != null) {
triggers.validate(validator);
}
if (wrappers != null) {
wrappers.validate(validator);
}
}

@Override
Expand Down Expand Up @@ -117,9 +108,6 @@ public String toGroovy() {
if (triggers != null && !triggers.getTriggers().isEmpty()) {
result.append(triggers.toGroovy()).append('\n');
}
if (wrappers != null && !wrappers.getWrappers().isEmpty()) {
result.append(wrappers.toGroovy()).append('\n');
}

result.append("}\n");
return result.toString();
Expand Down Expand Up @@ -191,9 +179,6 @@ public void removeSourceLocation() {
if (triggers != null) {
triggers.removeSourceLocation();
}
if (wrappers != null) {
wrappers.removeSourceLocation();
}
}

private String indent(int count) {
Expand Down Expand Up @@ -264,13 +249,6 @@ public void setTriggers(ModelASTTriggers triggers) {
this.triggers = triggers;
}

public ModelASTWrappers getWrappers() {
return wrappers;
}

public void setWrappers(ModelASTWrappers wrappers) {
this.wrappers = wrappers;
}

@Override
public String toString() {
Expand All @@ -283,7 +261,6 @@ public String toString() {
", options=" + options +
", parameters=" + parameters +
", triggers=" + triggers +
", wrappers=" + wrappers +
"}";
}

Expand Down Expand Up @@ -326,10 +303,7 @@ public boolean equals(Object o) {
if (getParameters() != null ? !getParameters().equals(that.getParameters()) : that.getParameters() != null) {
return false;
}
if (getTriggers() != null ? !getTriggers().equals(that.getTriggers()) : that.getTriggers() != null) {
return false;
}
return getWrappers() != null ? getWrappers().equals(that.getWrappers()) : that.getWrappers() == null;
return getTriggers() != null ? getTriggers().equals(that.getTriggers()) : that.getTriggers() == null;

}

Expand All @@ -344,7 +318,6 @@ public int hashCode() {
result = 31 * result + (getOptions() != null ? getOptions().hashCode() : 0);
result = 31 * result + (getParameters() != null ? getParameters().hashCode() : 0);
result = 31 * result + (getTriggers() != null ? getTriggers().hashCode() : 0);
result = 31 * result + (getWrappers() != null ? getWrappers().hashCode() : 0);
return result;
}
}

This file was deleted.

This file was deleted.

Expand Up @@ -45,8 +45,6 @@
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTTrigger;
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTTriggers;
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTWhen;
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTWrapper;
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTWrappers;


public interface ModelValidator {
Expand Down Expand Up @@ -89,8 +87,4 @@ public interface ModelValidator {
boolean validateElement(ModelASTStage stage);

boolean validateElement(ModelASTStages stages);

boolean validateElement(ModelASTWrapper wrapper);

boolean validateElement(ModelASTWrappers wrappers);
}
19 changes: 1 addition & 18 deletions pipeline-model-api/src/main/resources/ast-schema.json
Expand Up @@ -117,7 +117,7 @@
]
},
"options": {
"description": "One or more options (including job properties)",
"description": "One or more options (including job properties, wrappers, and options specific to Declarative Pipelines)",
"type": "object",
"properties": {
"options": {
Expand Down Expand Up @@ -158,20 +158,6 @@
},
"additionalProperties": false
},
"wrappers": {
"description": "One or more wrappers",
"type": "object",
"properties": {
"wrappers": {
"type": "array",
"items": {
"$ref": "#/definitions/methodCall"
},
"minItems": 1
}
},
"additionalProperties": false
},
"step": {
"description": "A single step with parameters",
"type": "object",
Expand Down Expand Up @@ -391,9 +377,6 @@
},
"parameters": {
"$ref": "#/definitions/parameters"
},
"wrappers": {
"$ref": "#/definitions/wrappers"
}
},
"required": [
Expand Down

0 comments on commit 0bc6a85

Please sign in to comment.