Skip to content

Commit 3fc2c29

Browse files
authored
Merge pull request #450 from bradleylarrick/plugin-refactoring
Plugin refactoring
2 parents d745cf5 + 632a856 commit 3fc2c29

39 files changed

+4294
-1673
lines changed

japicmp-maven-plugin/pom.xml

Lines changed: 176 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
35
<parent>
46
<groupId>com.github.siom79.japicmp</groupId>
57
<artifactId>japicmp-base</artifactId>
@@ -12,7 +14,8 @@
1214

1315
<name>japicmp-maven-plugin</name>
1416
<description>japicmp-maven-plugin is a maven plugin that computes the differences between two
15-
versions of a jar file/artifact in order to ease the API documentation for clients/customers.
17+
versions of a jar file/artifact in order to ease the API documentation for
18+
clients/customers.
1619
</description>
1720
<url>https://github.com/siom79/japicmp</url>
1821

@@ -25,9 +28,10 @@
2528
</licenses>
2629

2730
<properties>
28-
<mavenVersion>3.8.1</mavenVersion> <!-- maven.version property is reserved! -->
29-
<resolver.version>1.4.1</resolver.version> <!-- keep in sync with maven version -->
30-
<maven-plugin.version>3.6.4</maven-plugin.version>
31+
<reporting.version>3.1.0</reporting.version>
32+
<maven.pluginTesting.version>4.0.0-alpha-2</maven.pluginTesting.version>
33+
34+
<test.directory>${project.build.directory}/test-run</test.directory>
3135
</properties>
3236

3337
<prerequisites>
@@ -59,6 +63,12 @@
5963
<version>${resolver.version}</version>
6064
<scope>provided</scope>
6165
</dependency>
66+
<dependency>
67+
<groupId>org.apache.maven.resolver</groupId>
68+
<artifactId>maven-resolver-impl</artifactId>
69+
<version>${resolver.version}</version>
70+
<scope>provided</scope>
71+
</dependency>
6272
<dependency>
6373
<groupId>org.apache.maven.plugin-tools</groupId>
6474
<artifactId>maven-plugin-annotations</artifactId>
@@ -68,11 +78,6 @@
6878
<groupId>com.google.guava</groupId>
6979
<artifactId>guava</artifactId>
7080
</dependency>
71-
<dependency>
72-
<groupId>org.apache.maven.reporting</groupId>
73-
<artifactId>maven-reporting-api</artifactId>
74-
<version>${reporting.version}</version>
75-
</dependency>
7681
<dependency>
7782
<groupId>org.apache.maven.reporting</groupId>
7883
<artifactId>maven-reporting-impl</artifactId>
@@ -98,6 +103,42 @@
98103
<artifactId>groovy-jsr223</artifactId>
99104
<version>4.0.15</version>
100105
</dependency>
106+
<dependency>
107+
<groupId>org.apache.maven.plugin-testing</groupId>
108+
<artifactId>maven-plugin-testing-harness</artifactId>
109+
<version>${maven.pluginTesting.version}</version>
110+
<scope>test</scope>
111+
</dependency>
112+
<dependency>
113+
<groupId>org.apache.maven.resolver</groupId>
114+
<artifactId>maven-resolver-connector-basic</artifactId>
115+
<version>${resolver.version}</version>
116+
<scope>test</scope>
117+
</dependency>
118+
<dependency>
119+
<groupId>org.apache.maven.resolver</groupId>
120+
<artifactId>maven-resolver-transport-http</artifactId>
121+
<version>${resolver.version}</version>
122+
<scope>test</scope>
123+
</dependency>
124+
<dependency>
125+
<groupId>org.apache.maven</groupId>
126+
<artifactId>maven-compat</artifactId>
127+
<version>3.8.1</version>
128+
<scope>test</scope>
129+
</dependency>
130+
<dependency>
131+
<groupId>org.slf4j</groupId>
132+
<artifactId>slf4j-api</artifactId>
133+
<version>2.0.17</version>
134+
<scope>test</scope>
135+
</dependency>
136+
<dependency>
137+
<groupId>ch.qos.logback</groupId>
138+
<artifactId>logback-classic</artifactId>
139+
<version>1.5.19</version>
140+
<scope>test</scope>
141+
</dependency>
101142
</dependencies>
102143

103144
<build>
@@ -158,11 +199,136 @@
158199
<groupId>com.github.spotbugs</groupId>
159200
<artifactId>spotbugs-maven-plugin</artifactId>
160201
</plugin>
202+
<plugin>
203+
<groupId>org.apache.maven.plugins</groupId>
204+
<artifactId>maven-surefire-plugin</artifactId>
205+
<configuration>
206+
<argLine>@{argLine}</argLine>
207+
<useModulePath>false</useModulePath>
208+
</configuration>
209+
</plugin>
210+
<plugin>
211+
<groupId>org.jacoco</groupId>
212+
<artifactId>jacoco-maven-plugin</artifactId>
213+
<version>0.8.8</version>
214+
<executions>
215+
<execution>
216+
<id>default-prepare-agent</id>
217+
<goals>
218+
<goal>prepare-agent</goal>
219+
</goals>
220+
</execution>
221+
<execution>
222+
<id>default-report</id>
223+
<goals>
224+
<goal>report</goal>
225+
</goals>
226+
</execution>
227+
</executions>
228+
</plugin>
161229
</plugins>
230+
231+
<!-- Copy test data to the test directory -->
232+
<testResources>
233+
<testResource>
234+
<directory>src/test/resources</directory>
235+
<targetPath>${project.build.directory}/test-classes</targetPath>
236+
<excludes>
237+
<exclude>**/data/**</exclude>
238+
</excludes>
239+
</testResource>
240+
<testResource>
241+
<directory>src/test/resources/data</directory>
242+
<targetPath>${test.directory}</targetPath>
243+
<filtering>true</filtering>
244+
</testResource>
245+
</testResources>
162246
</build>
163247

164248
<reporting>
165249
<plugins>
250+
<!-- Generate the project reports -->
251+
<plugin>
252+
<groupId>org.apache.maven.plugins</groupId>
253+
<artifactId>maven-project-info-reports-plugin</artifactId>
254+
<version>3.1.2</version>
255+
<reportSets>
256+
<reportSet>
257+
<reports>
258+
<report>index</report>
259+
<report>summary</report>
260+
<report>dependency-info</report>
261+
<report>modules</report>
262+
<report>scm</report>
263+
<report>issue-management</report>
264+
<report>mailing-lists</report>
265+
<report>dependency-management</report>
266+
<report>dependencies</report>
267+
<report>dependency-convergence</report>
268+
<report>ci-management</report>
269+
<report>plugin-management</report>
270+
<report>plugins</report>
271+
<report>distribution-management</report>
272+
</reports>
273+
</reportSet>
274+
</reportSets>
275+
</plugin>
276+
277+
<!-- Generate the Javadoc -->
278+
<plugin>
279+
<artifactId>maven-javadoc-plugin</artifactId>
280+
<configuration>
281+
<links>
282+
<link>https://maven.apache.org/ref/${maven-api.version}/maven-plugin-api/apidocs</link>
283+
<link>https://maven.apache.org/ref/${reporting.version}/apidocs</link>
284+
</links>
285+
<tags>
286+
<tag>
287+
<name>todo</name>
288+
<placement>a</placement>
289+
<head>To Do:</head>
290+
</tag>
291+
</tags>
292+
</configuration>
293+
<reportSets>
294+
<reportSet>
295+
<reports>
296+
<report>aggregate-no-fork</report>
297+
</reports>
298+
</reportSet>
299+
</reportSets>
300+
</plugin>
301+
<!-- Generate the code coverage report -->
302+
<plugin>
303+
<groupId>org.jacoco</groupId>
304+
<artifactId>jacoco-maven-plugin</artifactId>
305+
<configuration>
306+
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
307+
<excludes>
308+
<exclude>**/HelpMojo*</exclude>
309+
</excludes>
310+
</configuration>
311+
<reportSets>
312+
<reportSet>
313+
<reports>
314+
<report>report</report>
315+
</reports>
316+
</reportSet>
317+
</reportSets>
318+
</plugin>
319+
<!-- Generate the Surefire report -->
320+
<plugin>
321+
<groupId>org.apache.maven.plugins</groupId>
322+
<artifactId>maven-surefire-report-plugin</artifactId>
323+
<version>${surefireVersion}</version>
324+
<reportSets>
325+
<reportSet>
326+
<reports>
327+
<report>report-only</report>
328+
</reports>
329+
</reportSet>
330+
</reportSets>
331+
</plugin>
166332
<plugin>
167333
<groupId>com.github.spotbugs</groupId>
168334
<artifactId>spotbugs-maven-plugin</artifactId>
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
package japicmp.maven;
2+
3+
/**
4+
* Convenience class to store flags for breaking the build.
5+
*/
6+
public class BreakBuild {
7+
8+
private boolean onSemanticVersioning;
9+
private boolean onSemanticVersioningForMajorVersionZero;
10+
private boolean onModifications;
11+
private boolean onBinaryIncompatibleModifications;
12+
private boolean onSourceIncompatibleModifications;
13+
14+
/**
15+
* Convenience constructor for unit testing.
16+
*/
17+
BreakBuild() {
18+
// Intentionally left blank.
19+
}
20+
21+
/**
22+
* Creates a new instance with the given values.
23+
*
24+
* @param breakBuildOnSemanticVersioning break the build on semantic
25+
* versioning
26+
* @param breakBuildOnSemanticVersioningForMajorVersionZero break the build on semantic versioning
27+
* for major version zero
28+
* @param breakBuildOnBinaryIncompatibleModifications break the build on binary
29+
* incompatibilities
30+
* @param breakBuildOnSourceIncompatibleModifications break the build on source
31+
* incompatibilities
32+
* @param breakBuildOnModifications break the build on modifications
33+
*/
34+
public BreakBuild(
35+
final boolean breakBuildOnSemanticVersioning,
36+
final boolean breakBuildOnSemanticVersioningForMajorVersionZero,
37+
final boolean breakBuildOnBinaryIncompatibleModifications,
38+
final boolean breakBuildOnSourceIncompatibleModifications,
39+
final boolean breakBuildOnModifications) {
40+
this.onSemanticVersioning = breakBuildOnSemanticVersioning;
41+
this.onSemanticVersioningForMajorVersionZero = breakBuildOnSemanticVersioningForMajorVersionZero;
42+
this.onModifications = breakBuildOnModifications;
43+
this.onBinaryIncompatibleModifications = breakBuildOnBinaryIncompatibleModifications;
44+
this.onSourceIncompatibleModifications = breakBuildOnSourceIncompatibleModifications;
45+
}
46+
47+
/**
48+
* Returns if the build should be broken on semantic versioning.
49+
*
50+
* @return {@code true} if the build should be broken on semantic versioning
51+
*/
52+
public boolean onSemanticVersioning() {
53+
return onSemanticVersioning;
54+
}
55+
56+
/**
57+
* Returns {@code true} if the build should be broken on semantic versioning for major version
58+
* zero.
59+
*
60+
* @return {@code true} if the build should be broken on semantic versioning for major version
61+
* zero
62+
*/
63+
public boolean onSemanticVersioningForMajorVersionZero() {
64+
return onSemanticVersioningForMajorVersionZero;
65+
}
66+
67+
/**
68+
* Returns {@code true} if the build should be broken on modifications.
69+
*
70+
* @return {@code true} if the build should be broken on modifications
71+
*/
72+
public boolean onModifications() {
73+
return onModifications;
74+
}
75+
76+
/**
77+
* Returns {@code true} if the build should be broken on binary incompatible modifications.
78+
*
79+
* @return {@code true} if the build should be broken on binary incompatible modifications
80+
*/
81+
public boolean onBinaryIncompatibleModifications() {
82+
return onBinaryIncompatibleModifications;
83+
}
84+
85+
/**
86+
* Returns {@code true} if the build should be broken on source incompatible modifications.
87+
*
88+
* @return {@code true} if the build should be broken on source incompatible modifications
89+
*/
90+
public boolean onSourceIncompatibleModifications() {
91+
return onSourceIncompatibleModifications;
92+
}
93+
94+
/*
95+
* Setter defined for unit testing.
96+
*/
97+
void setOnSemanticVersioning(final boolean onSemanticVersioning) {
98+
this.onSemanticVersioning = onSemanticVersioning;
99+
}
100+
101+
/*
102+
* Setter defined for unit testing.
103+
*/
104+
void setOnSemanticVersioningForMajorVersionZero(
105+
final boolean onSemanticVersioningForMajorVersionZero) {
106+
this.onSemanticVersioningForMajorVersionZero = onSemanticVersioningForMajorVersionZero;
107+
}
108+
109+
/*
110+
* Setter defined for unit testing.
111+
*/
112+
void setOnModifications(final boolean onModifications) {
113+
this.onModifications = onModifications;
114+
}
115+
116+
/*
117+
* Setter defined for unit testing.
118+
*/
119+
void setOnBinaryIncompatibleModifications(final boolean onBinaryIncompatibleModifications) {
120+
this.onBinaryIncompatibleModifications = onBinaryIncompatibleModifications;
121+
}
122+
123+
/*
124+
* Setter defined for unit testing.
125+
*/
126+
void setOnSourceIncompatibleModifications(final boolean onSourceIncompatibleModifications) {
127+
this.onSourceIncompatibleModifications = onSourceIncompatibleModifications;
128+
}
129+
}

0 commit comments

Comments
 (0)