Skip to content

Commit eb01774

Browse files
authored
Fix generation of repos using -DhostOnJenkinsGitHub=false (#710)
1 parent 3343e9a commit eb01774

File tree

10 files changed

+50
-26
lines changed

10 files changed

+50
-26
lines changed

common-files/archetype-post-generate.groovy

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ if (properties.get("hostOnJenkinsGitHub") == "false") {
1616
'.github',
1717
]
1818
filesToRemove.each {
19-
new File(it, projectPath.toFile()).delete()
19+
projectPath.resolve(it).toFile().delete()
2020
}
2121
directoriesToRemove.each {
22-
new File(it, projectPath.toFile()).deleteDir()
22+
projectPath.resolve(it).toFile().deleteDir()
2323
}
2424
}
2525

empty-plugin/src/main/resources/archetype-resources/pom.xml

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,30 @@
1515
<packaging>hpi</packaging>
1616

1717
<name>TODO Plugin</name>
18-
#if( $hostOnJenkinsGitHub == "true" )<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>#end
19-
20-
#if( $hostOnJenkinsGitHub == "true" )<licenses>
18+
#if( $hostOnJenkinsGitHub == "true" )
19+
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
20+
<licenses>
2121
<license>
2222
<name>MIT License</name>
2323
<url>https://opensource.org/license/mit/</url>
2424
</license>
25-
</licenses>#end
26-
27-
#if( $hostOnJenkinsGitHub == "true" )<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
25+
</licenses>
26+
<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
2827
<connection>scm:git:https://github.com/${gitHubRepo}</connection>
2928
<developerConnection>scm:git:https://github.com/${gitHubRepo}</developerConnection>
3029
<tag>${scmTag}</tag>
3130
<url>https://github.com/${gitHubRepo}</url>
32-
</scm>#end
31+
</scm>
32+
#end
3333

3434
<properties>
3535
<revision>1.0</revision>
3636
<changelist>-SNAPSHOT</changelist>
3737
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
3838
<jenkins.version>2.414.3</jenkins.version>
39-
#if( $hostOnJenkinsGitHub == "true" )<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>#end
39+
#if( $hostOnJenkinsGitHub == "true" )
40+
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
41+
#end
4042

4143
<spotless.check.skip>false</spotless.check.skip>
4244
</properties>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
groupId=IGNORED
2+
artifactId=testArtifact
3+
version=1.0-SNAPSHOT
4+
package=IGNORED
5+
hostOnJenkinsGitHub=false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
install -ntp

global-configuration/src/main/resources/archetype-resources/pom.xml

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,30 @@
1515
<packaging>hpi</packaging>
1616

1717
<name>TODO Plugin</name>
18-
#if( $hostOnJenkinsGitHub == "true" )<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>#end
19-
20-
#if( $hostOnJenkinsGitHub == "true" )<licenses>
18+
#if( $hostOnJenkinsGitHub == "true" )
19+
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
20+
<licenses>
2121
<license>
2222
<name>MIT License</name>
2323
<url>https://opensource.org/license/mit/</url>
2424
</license>
25-
</licenses>#end
26-
27-
#if( $hostOnJenkinsGitHub == "true" )<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
25+
</licenses>
26+
<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
2827
<connection>scm:git:https://github.com/${gitHubRepo}</connection>
2928
<developerConnection>scm:git:https://github.com/${gitHubRepo}</developerConnection>
3029
<tag>${scmTag}</tag>
3130
<url>https://github.com/${gitHubRepo}</url>
32-
</scm>#end
31+
</scm>
32+
#end
3333

3434
<properties>
3535
<revision>1.0</revision>
3636
<changelist>-SNAPSHOT</changelist>
3737
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
3838
<jenkins.version>2.414.3</jenkins.version>
39-
#if( $hostOnJenkinsGitHub == "true" )<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>#end
39+
#if( $hostOnJenkinsGitHub == "true" )
40+
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
41+
#end
4042

4143
<spotless.check.skip>false</spotless.check.skip>
4244
</properties>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
groupId=IGNORED
2+
artifactId=testArtifact
3+
version=1.0-SNAPSHOT
4+
package=io.jenkins.plugins.sample
5+
hostOnJenkinsGitHub=false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
install -ntp

hello-world/src/main/resources/archetype-resources/pom.xml

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,31 @@
1515
<packaging>hpi</packaging>
1616

1717
<name>TODO Plugin</name>
18-
#if( $hostOnJenkinsGitHub == "true" )<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>#end
19-
20-
#if( $hostOnJenkinsGitHub == "true" )<licenses>
18+
#if( $hostOnJenkinsGitHub == "true" )
19+
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
20+
<licenses>
2121
<license>
2222
<name>MIT License</name>
2323
<url>https://opensource.org/license/mit/</url>
2424
</license>
25-
</licenses>#end
26-
27-
#if( $hostOnJenkinsGitHub == "true" )<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
25+
</licenses>
26+
<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
2827
<connection>scm:git:https://github.com/${gitHubRepo}</connection>
2928
<developerConnection>scm:git:https://github.com/${gitHubRepo}</developerConnection>
3029
<tag>${scmTag}</tag>
3130
<url>https://github.com/${gitHubRepo}</url>
32-
</scm>#end
31+
</scm>
32+
#end
3333

3434
<properties>
3535
<revision>1.0</revision>
3636
<changelist>-SNAPSHOT</changelist>
3737

3838
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
3939
<jenkins.version>2.414.3</jenkins.version>
40-
#if( $hostOnJenkinsGitHub == "true" )<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>#end
40+
#if( $hostOnJenkinsGitHub == "true" )
41+
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
42+
#end
4143

4244
<spotless.check.skip>false</spotless.check.skip>
4345
</properties>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
groupId=IGNORED
2+
artifactId=testArtifact
3+
version=1.0-SNAPSHOT
4+
package=io.jenkins.plugins.sample
5+
hostOnJenkinsGitHub=false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
install -ntp

0 commit comments

Comments
 (0)