Skip to content

Commit 6829657

Browse files
committed
[JENKINS-75401] Adapt to jenkinsci/git-server-plugin#134
1 parent 7715897 commit 6829657

File tree

6 files changed

+23
-15
lines changed

6 files changed

+23
-15
lines changed

Diff for: .mvn/extensions.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<extension>
33
<groupId>io.jenkins.tools.incrementals</groupId>
44
<artifactId>git-changelist-maven-extension</artifactId>
5-
<version>1.4</version>
5+
<version>1.8</version>
66
</extension>
77
</extensions>

Diff for: pom.xml

+12-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<parent>
2929
<groupId>org.jenkins-ci.plugins</groupId>
3030
<artifactId>plugin</artifactId>
31-
<version>4.77</version>
31+
<version>5.9</version>
3232
<relativePath />
3333
</parent>
3434
<groupId>org.jenkins-ci.plugins.workflow</groupId>
@@ -63,18 +63,26 @@
6363
</pluginRepositories>
6464
<properties>
6565
<changelist>999999-SNAPSHOT</changelist>
66-
<jenkins.version>2.414.3</jenkins.version>
66+
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
67+
<jenkins.baseline>2.479</jenkins.baseline>
68+
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
6769
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
6870
</properties>
6971
<dependencyManagement>
7072
<dependencies>
7173
<dependency>
7274
<groupId>io.jenkins.tools.bom</groupId>
73-
<artifactId>bom-2.414.x</artifactId>
74-
<version>2718.v7e8a_d43b_3f0b_</version>
75+
<artifactId>bom-${jenkins.baseline}.x</artifactId>
76+
<version>4228.v0a_71308d905b_</version>
7577
<scope>import</scope>
7678
<type>pom</type>
7779
</dependency>
80+
<!-- TODO until in BOM -->
81+
<dependency>
82+
<groupId>org.jenkins-ci.plugins</groupId>
83+
<artifactId>git-server</artifactId>
84+
<version>137.ve0060b_432302</version>
85+
</dependency>
7886
</dependencies>
7987
</dependencyManagement>
8088
<dependencies>

Diff for: src/main/java/org/jenkinsci/plugins/workflow/cps/global/GroovyShellDecoratorImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public GroovyShellDecorator forTrusted() {
2727
@Override
2828
public void configureShell(CpsFlowExecution context, GroovyShell shell) {
2929
try {
30-
shell.getClassLoader().addURL(new File(repo.workspace,"src").toURI().toURL());
31-
shell.getClassLoader().addURL(new File(repo.workspace, UserDefinedGlobalVariableList.PREFIX).toURI().toURL());
30+
shell.getClassLoader().addURL(repo.workspace.resolve("src").toUri().toURL());
31+
shell.getClassLoader().addURL(repo.workspace.resolve(UserDefinedGlobalVariableList.PREFIX).toUri().toURL());
3232
} catch (MalformedURLException e) {
3333
throw new AssertionError(e);
3434
}

Diff for: src/main/java/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariableList.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class UserDefinedGlobalVariableList extends GlobalVariableSet {
3333
* Rebuilds the list of {@link UserDefinedGlobalVariable}s and update {@link ExtensionList} accordingly.
3434
*/
3535
public synchronized void rebuild() {
36-
File[] children = new File(repo.workspace, PREFIX).listFiles();
36+
File[] children = repo.workspace.resolve(PREFIX).toFile().listFiles();
3737
if (children==null) children = new File[0];
3838

3939
List<GlobalVariable> list = new ArrayList<GlobalVariable>();
@@ -43,7 +43,7 @@ public synchronized void rebuild() {
4343
continue;
4444

4545
String name = FilenameUtils.getBaseName(child.getName());
46-
UserDefinedGlobalVariable uv = new UserDefinedGlobalVariable(name, new File(repo.workspace, PREFIX + "/" + name + ".txt"));
46+
UserDefinedGlobalVariable uv = new UserDefinedGlobalVariable(name, repo.workspace.resolve(PREFIX).resolve(name + ".txt").toFile());
4747
list.add(uv);
4848
}
4949

Diff for: src/test/java/org/jenkinsci/plugins/workflow/cps/global/UserDefinedGlobalVariableListTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void rebuild() throws Exception {
5252
src.child("acme.groovy").write("// empty", "UTF-8");
5353
src.child("acme.txt").write("Plain\ntext<", "UTF-8");
5454

55-
UserDefinedGlobalVariable acme = new UserDefinedGlobalVariable("acme", new File(repo.workspace, PREFIX + "/acme.txt"));
55+
UserDefinedGlobalVariable acme = new UserDefinedGlobalVariable("acme", repo.workspace.resolve(PREFIX).resolve("acme.txt").toFile());
5656

5757
// this variable to become accessible once the new definition is pushed
5858
git.add().addFilepattern(".").call();

Diff for: src/test/java/org/jenkinsci/plugins/workflow/cps/global/WorkflowLibRepositoryTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class WorkflowLibRepositoryTest {
4949
public void globalLib() throws Exception {
5050
story.addStep(new Statement() {
5151
@Override public void evaluate() throws Throwable {
52-
File dir = new File(repo.workspace,"src/foo");
52+
File dir = repo.workspace.resolve("src/foo").toFile();
5353
dir.mkdirs();
5454

5555
FileUtils.write(new File(dir, "Foo.groovy"),
@@ -106,7 +106,7 @@ public void globalLib() throws Exception {
106106
public void userDefinedGlobalVariable() throws Exception {
107107
story.addStep(new Statement() {
108108
@Override public void evaluate() throws Throwable {
109-
File vars = new File(repo.workspace, UserDefinedGlobalVariableList.PREFIX);
109+
File vars = repo.workspace.resolve(UserDefinedGlobalVariableList.PREFIX).toFile();
110110
vars.mkdirs();
111111
FileUtils.writeStringToFile(new File(vars, "acmeVar.groovy"), StringUtils.join(Arrays.asList(
112112
"def hello(name) {echo \"Hello ${name}\"}",
@@ -159,7 +159,7 @@ public void userDefinedGlobalVariable() throws Exception {
159159
@Test public void restartGlobalVar() {
160160
story.addStep(new Statement() {
161161
@Override public void evaluate() throws Throwable {
162-
File vars = new File(repo.workspace, UserDefinedGlobalVariableList.PREFIX);
162+
File vars = repo.workspace.resolve(UserDefinedGlobalVariableList.PREFIX).toFile();
163163
vars.mkdirs();
164164
FileUtils.writeStringToFile(new File(vars, "block.groovy"), "def call(body) {node {body()}}");
165165
uvl.rebuild();
@@ -186,7 +186,7 @@ public void userDefinedGlobalVariable() throws Exception {
186186
@Override public void evaluate() throws Throwable {
187187
File f = new File(jenkins.getRootDir(), "f"); // marker file to write from Pipeline Script
188188

189-
FileUtils.write(new File(new File(repo.workspace, "src/pkg"), "Privileged.groovy"),
189+
FileUtils.write(repo.workspace.resolve("src/pkg").resolve("Privileged.groovy").toFile(),
190190
"package pkg\n" +
191191
"class Privileged implements Serializable {\n" +
192192
" void write(String content) {\n" +
@@ -196,7 +196,7 @@ public void userDefinedGlobalVariable() throws Exception {
196196
" body()\n" +
197197
" }\n" +
198198
"}");
199-
FileUtils.write(new File(new File(repo.workspace, UserDefinedGlobalVariableList.PREFIX), "record.groovy"),
199+
FileUtils.write(repo.workspace.resolve(UserDefinedGlobalVariableList.PREFIX).resolve("record.groovy").toFile(),
200200
"def call() {new pkg.Privileged().write(jenkins.model.Jenkins.instance.systemMessage)}");
201201
WorkflowJob p = jenkins.createProject(WorkflowJob.class, "p");
202202

0 commit comments

Comments
 (0)