Skip to content

Commit 038a73c

Browse files
authored
Enable Spotless (#1091)
* Enable Spotless * Apply Spotless * Selected edits to ameliorate legibility regressions
1 parent 2327ba2 commit 038a73c

File tree

243 files changed

+10785
-8127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+10785
-8127
lines changed

dgm-builder/pom.xml

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<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">
3-
<modelVersion>4.0.0</modelVersion>
3+
<modelVersion>4.0.0</modelVersion>
44

5-
<parent>
6-
<groupId>org.jenkins-ci.plugins.workflow</groupId>
7-
<artifactId>workflow-cps-parent</artifactId>
8-
<version>${changelist}</version>
9-
</parent>
5+
<parent>
6+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
7+
<artifactId>workflow-cps-parent</artifactId>
8+
<version>${changelist}</version>
9+
</parent>
1010

11-
<groupId>com.cloudbees</groupId>
12-
<artifactId>groovy-cps-dgm-builder</artifactId>
11+
<groupId>com.cloudbees</groupId>
12+
<artifactId>groovy-cps-dgm-builder</artifactId>
1313

14-
<name>CpsDefaultGroovyMethods generator</name>
14+
<name>CpsDefaultGroovyMethods generator</name>
1515

16-
<licenses>
17-
<license>
18-
<name>The Apache Software License, Version 2.0</name>
19-
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
20-
<distribution>repo</distribution>
21-
</license>
22-
</licenses>
16+
<licenses>
17+
<license>
18+
<name>The Apache Software License, Version 2.0</name>
19+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
20+
<distribution>repo</distribution>
21+
</license>
22+
</licenses>
2323

24-
<build>
25-
<plugins>
26-
<plugin>
27-
<groupId>org.apache.maven.plugins</groupId>
28-
<artifactId>maven-assembly-plugin</artifactId>
29-
<executions>
30-
<execution>
31-
<phase>package</phase>
32-
<goals>
33-
<goal>single</goal>
34-
</goals>
35-
<configuration>
36-
<archive>
37-
<manifest>
38-
<mainClass>com.cloudbees.groovy.cps.tool.Driver</mainClass>
39-
</manifest>
40-
</archive>
41-
<descriptorRefs>
42-
<descriptorRef>jar-with-dependencies</descriptorRef>
43-
</descriptorRefs>
44-
</configuration>
45-
</execution>
46-
</executions>
47-
</plugin>
48-
</plugins>
49-
</build>
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.codehaus.groovy</groupId>
27+
<artifactId>groovy</artifactId>
28+
<version>${groovy.version}</version>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.codehaus.groovy</groupId>
32+
<artifactId>groovy</artifactId>
33+
<version>${groovy.version}</version>
34+
<classifier>sources</classifier>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.jenkins-ci.main</groupId>
38+
<artifactId>remoting</artifactId>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.kohsuke.codemodel</groupId>
42+
<artifactId>codemodel</artifactId>
43+
<version>2.7</version>
44+
</dependency>
45+
</dependencies>
5046

51-
<dependencies>
52-
<dependency>
53-
<groupId>org.kohsuke.codemodel</groupId>
54-
<artifactId>codemodel</artifactId>
55-
<version>2.7</version>
56-
</dependency>
57-
<dependency>
58-
<groupId>org.jenkins-ci.main</groupId>
59-
<artifactId>remoting</artifactId>
60-
</dependency>
61-
<dependency>
62-
<groupId>org.codehaus.groovy</groupId>
63-
<artifactId>groovy</artifactId>
64-
<version>${groovy.version}</version>
65-
</dependency>
66-
<dependency>
67-
<groupId>org.codehaus.groovy</groupId>
68-
<artifactId>groovy</artifactId>
69-
<classifier>sources</classifier>
70-
<version>${groovy.version}</version>
71-
</dependency>
72-
</dependencies>
47+
<build>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-assembly-plugin</artifactId>
52+
<executions>
53+
<execution>
54+
<goals>
55+
<goal>single</goal>
56+
</goals>
57+
<phase>package</phase>
58+
<configuration>
59+
<archive>
60+
<manifest>
61+
<mainClass>com.cloudbees.groovy.cps.tool.Driver</mainClass>
62+
</manifest>
63+
</archive>
64+
<descriptorRefs>
65+
<descriptorRef>jar-with-dependencies</descriptorRef>
66+
</descriptorRefs>
67+
</configuration>
68+
</execution>
69+
</executions>
70+
</plugin>
71+
</plugins>
72+
</build>
7373
</project>

dgm-builder/src/main/java/com/cloudbees/groovy/cps/tool/Driver.java

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
import com.sun.codemodel.writer.FileCodeWriter;
44
import groovy.lang.GroovyShell;
55
import hudson.remoting.Which;
6-
7-
import javax.tools.DiagnosticListener;
8-
import javax.tools.JavaCompiler;
9-
import javax.tools.JavaFileObject;
10-
import javax.tools.StandardJavaFileManager;
11-
import javax.tools.StandardLocation;
12-
import javax.tools.ToolProvider;
136
import java.io.File;
147
import java.nio.charset.Charset;
158
import java.nio.file.Files;
169
import java.util.ArrayList;
1710
import java.util.List;
1811
import java.util.Locale;
1912
import java.util.Set;
13+
import javax.tools.DiagnosticListener;
14+
import javax.tools.JavaCompiler;
15+
import javax.tools.JavaFileObject;
16+
import javax.tools.StandardJavaFileManager;
17+
import javax.tools.StandardLocation;
18+
import javax.tools.ToolProvider;
2019

2120
public class Driver {
2221
public static void main(String[] args) throws Exception {
@@ -27,20 +26,25 @@ public void run(File dir) throws Exception {
2726
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
2827
DiagnosticListener<JavaFileObject> errorListener = createErrorListener();
2928

30-
try (StandardJavaFileManager fileManager = javac.getStandardFileManager(errorListener, Locale.getDefault(), Charset.defaultCharset())) {
31-
fileManager.setLocation(StandardLocation.CLASS_PATH,
32-
Set.of(Which.jarFile(GroovyShell.class)));
29+
try (StandardJavaFileManager fileManager =
30+
javac.getStandardFileManager(errorListener, Locale.getDefault(), Charset.defaultCharset())) {
31+
fileManager.setLocation(StandardLocation.CLASS_PATH, Set.of(Which.jarFile(GroovyShell.class)));
3332

34-
File groovySrcJar = Which.jarFile(Driver.class.getClassLoader().getResource("groovy/lang/GroovyShell.java"));
33+
File groovySrcJar =
34+
Which.jarFile(Driver.class.getClassLoader().getResource("groovy/lang/GroovyShell.java"));
3535

3636
// classes to translate
37-
// TODO include other classes mentioned in DefaultGroovyMethods.DGM_LIKE_CLASSES if they have any applicable methods
38-
List<String> fileNames = List.of("DefaultGroovyMethods",
39-
"DefaultGroovyStaticMethods",
40-
"StringGroovyMethods");
37+
// TODO include other classes mentioned in DefaultGroovyMethods.DGM_LIKE_CLASSES
38+
// if they have any applicable methods
39+
List<String> fileNames =
40+
List.of("DefaultGroovyMethods", "DefaultGroovyStaticMethods", "StringGroovyMethods");
4141

4242
List<JavaFileObject> src = new ArrayList<>();
43-
for (JavaFileObject jfo : fileManager.list(StandardLocation.CLASS_PATH, "org.codehaus.groovy.runtime", Set.of(JavaFileObject.Kind.SOURCE), true)) {
43+
for (JavaFileObject jfo : fileManager.list(
44+
StandardLocation.CLASS_PATH,
45+
"org.codehaus.groovy.runtime",
46+
Set.of(JavaFileObject.Kind.SOURCE),
47+
true)) {
4448
for (String name : fileNames) {
4549
if (jfo.toUri().toString().endsWith("/org/codehaus/groovy/runtime/" + name + ".java")) {
4650
src.add(jfo);
@@ -60,12 +64,11 @@ public void run(File dir) throws Exception {
6064

6165
for (String name : fileNames) {
6266
t.translate(
63-
"org.codehaus.groovy.runtime."+name,
64-
"com.cloudbees.groovy.cps.Cps"+name,
67+
"org.codehaus.groovy.runtime." + name,
68+
"com.cloudbees.groovy.cps.Cps" + name,
6569
groovySrcJar.getName());
6670
}
6771

68-
6972
Files.createDirectories(dir.toPath());
7073
t.generateTo(new FileCodeWriter(dir));
7174
}
@@ -74,5 +77,4 @@ public void run(File dir) throws Exception {
7477
private DiagnosticListener<JavaFileObject> createErrorListener() {
7578
return System.out::println;
7679
}
77-
7880
}

0 commit comments

Comments
 (0)