Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatten repositories from JEP-229 plugins #802

Merged
merged 5 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,10 @@
<flattenMode>oss</flattenMode>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>${project.artifactId}-${project.version}.pom</flattenedPomFilename>
<!-- TODO https://github.com/mojohaus/flatten-maven-plugin/issues/362 -->
<pomElements>
Vlatombe marked this conversation as resolved.
Show resolved Hide resolved
<repositories>flatten</repositories>
</pomElements>
</configuration>
</execution>
</executions>
Expand Down
7 changes: 7 additions & 0 deletions src/it/cd-plugin/.mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.6</version>
</extension>
</extensions>
3 changes: 3 additions & 0 deletions src/it/cd-plugin/.mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
-Dchangelist.format=%d.v%s
2 changes: 2 additions & 0 deletions src/it/cd-plugin/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Same options as in https://github.com/jenkins-infra/jenkins-maven-cd-action/blob/master/run.sh (but hard-coding a sample changelist)
invoker.goals=-Dstyle.color=always -Dset.changelist -Dchangelist=1234.deadbeef5678 -ntp -P-consume-incrementals -Pquick-build clean install
47 changes: 47 additions & 0 deletions src/it/cd-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>@project.version@</version>
<relativePath />
</parent>
<groupId>org.jenkins-ci.plugins.its</groupId>
<artifactId>cd-plugin</artifactId>
<version>${changelist}</version>
<packaging>hpi</packaging>
<name>CD plugin</name>
<description>CD description</description>
<properties>
<changelist>999999-SNAPSHOT</changelist>
<spotless.check.skip>false</spotless.check.skip>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
</dependency>
</dependencies>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
23 changes: 23 additions & 0 deletions src/it/cd-plugin/postbuild.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
assert new File(basedir, 'target/cd-plugin.hpi').file
assert new File(basedir, 'target/cd-plugin.jar').file

File installed = new File(basedir, '../../local-repo/org/jenkins-ci/plugins/its/cd-plugin/1234.deadbeef5678/')
assert new File(installed, 'cd-plugin-1234.deadbeef5678.hpi').file

def targetPom = new File(basedir, 'target/cd-plugin-1234.deadbeef5678.pom')
assert targetPom.file

def installedPom = new File(installed, 'cd-plugin-1234.deadbeef5678.pom')
assert installedPom.file

assert installedPom.text.contains("<name>")
assert installedPom.text.contains("<description>")
assert installedPom.text.contains("<dependencies>")
assert installedPom.text.contains("<build>")
assert installedPom.text.contains("<scm>")
assert !installedPom.text.contains("<properties>")
assert !installedPom.text.contains("<dependencyManagement>")
assert !installedPom.text.contains("<repositories>")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the point of the PR, FTR)

assert !installedPom.text.contains("<pluginRepositories>")

return true
2 changes: 2 additions & 0 deletions src/it/cd-plugin/src/main/resources/index.jelly
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?jelly escape-by-default='true'?>
<div/>