Skip to content

Commit

Permalink
Fix generation of repos using -DhostOnJenkinsGitHub=false (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrjjvv committed Mar 15, 2024
1 parent 3343e9a commit eb01774
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 26 deletions.
4 changes: 2 additions & 2 deletions common-files/archetype-post-generate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ if (properties.get("hostOnJenkinsGitHub") == "false") {
'.github',
]
filesToRemove.each {
new File(it, projectPath.toFile()).delete()
projectPath.resolve(it).toFile().delete()
}
directoriesToRemove.each {
new File(it, projectPath.toFile()).deleteDir()
projectPath.resolve(it).toFile().deleteDir()
}
}

Expand Down
18 changes: 10 additions & 8 deletions empty-plugin/src/main/resources/archetype-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@
<packaging>hpi</packaging>

<name>TODO Plugin</name>
#if( $hostOnJenkinsGitHub == "true" )<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>#end

#if( $hostOnJenkinsGitHub == "true" )<licenses>
#if( $hostOnJenkinsGitHub == "true" )
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/license/mit/</url>
</license>
</licenses>#end

#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">
</licenses>
<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
<connection>scm:git:https://github.com/${gitHubRepo}</connection>
<developerConnection>scm:git:https://github.com/${gitHubRepo}</developerConnection>
<tag>${scmTag}</tag>
<url>https://github.com/${gitHubRepo}</url>
</scm>#end
</scm>
#end

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

<spotless.check.skip>false</spotless.check.skip>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
groupId=IGNORED
artifactId=testArtifact
version=1.0-SNAPSHOT
package=IGNORED
hostOnJenkinsGitHub=false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
install -ntp
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@
<packaging>hpi</packaging>

<name>TODO Plugin</name>
#if( $hostOnJenkinsGitHub == "true" )<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>#end

#if( $hostOnJenkinsGitHub == "true" )<licenses>
#if( $hostOnJenkinsGitHub == "true" )
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/license/mit/</url>
</license>
</licenses>#end

#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">
</licenses>
<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
<connection>scm:git:https://github.com/${gitHubRepo}</connection>
<developerConnection>scm:git:https://github.com/${gitHubRepo}</developerConnection>
<tag>${scmTag}</tag>
<url>https://github.com/${gitHubRepo}</url>
</scm>#end
</scm>
#end

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

<spotless.check.skip>false</spotless.check.skip>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
groupId=IGNORED
artifactId=testArtifact
version=1.0-SNAPSHOT
package=io.jenkins.plugins.sample
hostOnJenkinsGitHub=false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
install -ntp
18 changes: 10 additions & 8 deletions hello-world/src/main/resources/archetype-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,31 @@
<packaging>hpi</packaging>

<name>TODO Plugin</name>
#if( $hostOnJenkinsGitHub == "true" )<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>#end

#if( $hostOnJenkinsGitHub == "true" )<licenses>
#if( $hostOnJenkinsGitHub == "true" )
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/license/mit/</url>
</license>
</licenses>#end

#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">
</licenses>
<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
<connection>scm:git:https://github.com/${gitHubRepo}</connection>
<developerConnection>scm:git:https://github.com/${gitHubRepo}</developerConnection>
<tag>${scmTag}</tag>
<url>https://github.com/${gitHubRepo}</url>
</scm>#end
</scm>
#end

<properties>
<revision>1.0</revision>
<changelist>-SNAPSHOT</changelist>

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

<spotless.check.skip>false</spotless.check.skip>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
groupId=IGNORED
artifactId=testArtifact
version=1.0-SNAPSHOT
package=io.jenkins.plugins.sample
hostOnJenkinsGitHub=false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
install -ntp

0 comments on commit eb01774

Please sign in to comment.