-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/jenkinsci/workflow-cps-pl…
…ugin into AngryGami/master
- Loading branch information
Showing
365 changed files
with
20,739 additions
and
6,863 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @jenkinsci/workflow-cps-plugin-developers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
# Intentionally not adding automatic NPM updates because I do | ||
# not trust the plugin's tests to catch issues caused by updates. | ||
# TODO or enable, but avoid merging without first doing a local interactive test? | ||
- package-ecosystem: "maven" | ||
directory: "/" | ||
reviewers: | ||
- "dwnusbaum" | ||
schedule: | ||
interval: "daily" | ||
interval: "weekly" | ||
ignore: | ||
- dependency-name: org.codehaus.groovy:groovy | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
- package-ecosystem: "npm" | ||
directory: "/plugin" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
_extends: .github | ||
name-template: v$NEXT_MINOR_VERSION 🌈 | ||
tag-template: workflow-cps-$NEXT_MINOR_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins | ||
|
||
name: cd | ||
on: | ||
workflow_dispatch: | ||
check_run: | ||
types: | ||
- completed | ||
|
||
jobs: | ||
maven-cd: | ||
uses: jenkins-infra/github-reusable-workflows/.github/workflows/maven-cd.yml@v1 | ||
secrets: | ||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ node_modules | |
.classpath | ||
.project | ||
.settings/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
-Pconsume-incrementals | ||
-Pmight-produce-incrementals | ||
-Dchangelist.format=%d.v%s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
buildPlugin(useAci: false, configurations: [ | ||
[ platform: "linux", jdk: "8", jenkins: null ], | ||
[ platform: "windows", jdk: "8", jenkins: null ], | ||
[ platform: "linux", jdk: "11", jenkins: "2.276", javaLevel: 8 ] | ||
/* | ||
See the documentation for more options: | ||
https://github.com/jenkins-infra/pipeline-library/ | ||
*/ | ||
buildPlugin( | ||
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests | ||
configurations: [ | ||
[platform: 'linux', jdk: 21], | ||
[platform: 'windows', jdk: 17], | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.jenkins-ci.plugins.workflow</groupId> | ||
<artifactId>workflow-cps-parent</artifactId> | ||
<version>${changelist}</version> | ||
</parent> | ||
|
||
<groupId>com.cloudbees</groupId> | ||
<artifactId>groovy-cps-dgm-builder</artifactId> | ||
|
||
<name>CpsDefaultGroovyMethods generator</name> | ||
|
||
<licenses> | ||
<license> | ||
<name>The Apache Software License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>com.cloudbees.groovy.cps.tool.Driver</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.kohsuke.codemodel</groupId> | ||
<artifactId>codemodel</artifactId> | ||
<version>2.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jenkins-ci.main</groupId> | ||
<artifactId>remoting</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.groovy</groupId> | ||
<artifactId>groovy</artifactId> | ||
<version>${groovy.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.groovy</groupId> | ||
<artifactId>groovy</artifactId> | ||
<classifier>sources</classifier> | ||
<version>${groovy.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
78 changes: 78 additions & 0 deletions
78
dgm-builder/src/main/java/com/cloudbees/groovy/cps/tool/Driver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.cloudbees.groovy.cps.tool; | ||
|
||
import com.sun.codemodel.writer.FileCodeWriter; | ||
import groovy.lang.GroovyShell; | ||
import hudson.remoting.Which; | ||
|
||
import javax.tools.DiagnosticListener; | ||
import javax.tools.JavaCompiler; | ||
import javax.tools.JavaFileObject; | ||
import javax.tools.StandardJavaFileManager; | ||
import javax.tools.StandardLocation; | ||
import javax.tools.ToolProvider; | ||
import java.io.File; | ||
import java.nio.charset.Charset; | ||
import java.nio.file.Files; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Set; | ||
|
||
public class Driver { | ||
public static void main(String[] args) throws Exception { | ||
new Driver().run(new File(args[0])); | ||
} | ||
|
||
public void run(File dir) throws Exception { | ||
JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); | ||
DiagnosticListener<JavaFileObject> errorListener = createErrorListener(); | ||
|
||
try (StandardJavaFileManager fileManager = javac.getStandardFileManager(errorListener, Locale.getDefault(), Charset.defaultCharset())) { | ||
fileManager.setLocation(StandardLocation.CLASS_PATH, | ||
Set.of(Which.jarFile(GroovyShell.class))); | ||
|
||
File groovySrcJar = Which.jarFile(Driver.class.getClassLoader().getResource("groovy/lang/GroovyShell.java")); | ||
|
||
// classes to translate | ||
// TODO include other classes mentioned in DefaultGroovyMethods.DGM_LIKE_CLASSES if they have any applicable methods | ||
List<String> fileNames = List.of("DefaultGroovyMethods", | ||
"DefaultGroovyStaticMethods", | ||
"StringGroovyMethods"); | ||
|
||
List<JavaFileObject> src = new ArrayList<>(); | ||
for (JavaFileObject jfo : fileManager.list(StandardLocation.CLASS_PATH, "org.codehaus.groovy.runtime", Set.of(JavaFileObject.Kind.SOURCE), true)) { | ||
for (String name : fileNames) { | ||
if (jfo.toUri().toString().endsWith("/org/codehaus/groovy/runtime/" + name + ".java")) { | ||
src.add(jfo); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
// annotation processing appears to cause the source files to be reparsed | ||
// (even though I couldn't find exactly where it's done), which causes | ||
// Tree symbols created by the original JavacTask.parse() call to be thrown away, | ||
// which breaks later processing. | ||
// So for now, don't perform annotation processing | ||
List<String> options = List.of("-proc:none"); | ||
|
||
Translator t = new Translator(javac.getTask(null, fileManager, errorListener, options, null, src)); | ||
|
||
for (String name : fileNames) { | ||
t.translate( | ||
"org.codehaus.groovy.runtime."+name, | ||
"com.cloudbees.groovy.cps.Cps"+name, | ||
groovySrcJar.getName()); | ||
} | ||
|
||
|
||
Files.createDirectories(dir.toPath()); | ||
t.generateTo(new FileCodeWriter(dir)); | ||
} | ||
} | ||
|
||
private DiagnosticListener<JavaFileObject> createErrorListener() { | ||
return System.out::println; | ||
} | ||
|
||
} |
Oops, something went wrong.