Skip to content

Commit 17816bd

Browse files
committed
prep maven build integration
1 parent f6ec0f7 commit 17816bd

File tree

6 files changed

+255
-1
lines changed

6 files changed

+255
-1
lines changed

apache-rat-gradle-plugin/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
## TODO
2727

28-
* Integrate into Maven build.
28+
* Verify all artifacts ("special" Gradle plugin artifact) are built and deployed by Maven
2929
* LICENSE/NOTICE file work needed?
3030
* HTML XSL added
3131
* Tests, tests, tests.
@@ -44,6 +44,7 @@
4444

4545
## Done
4646

47+
* Integrate into Maven build
4748
* Logging:
4849
* Implement a `Log` instance that delegates to Gradle's SLF4J compatible logging and install via
4950
`org.apache.rat.utils.DefaultLog.setInstance`.

apache-rat-gradle-plugin/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ java {
221221
withSourcesJar()
222222
}
223223

224+
tasks.named<Jar>("sourcesJar") { dependsOn(generateGradleOptionsSource) }
225+
224226
tasks.withType<Javadoc>().configureEach {
225227
val opt = options as CoreJavadocOptions
226228
// don't spam log w/ "warning: no @param/@return"

apache-rat-gradle-plugin/pom.xml

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<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">
19+
<modelVersion>4.0.0</modelVersion>
20+
<parent>
21+
<groupId>org.apache.rat</groupId>
22+
<artifactId>apache-rat-project</artifactId>
23+
<version>1.0.0-SNAPSHOT</version>
24+
</parent>
25+
<!--
26+
This artifact ID has to be the Gradle plugin ID
27+
TODO VERIFY AGAIN !!
28+
TODO add an integration test !!
29+
-->
30+
<artifactId>org.apache.rat.gradle-plugin</artifactId>
31+
<packaging>pom</packaging>
32+
<name>Apache Creadur RAT::Gradle Plugin</name>
33+
<description>Gradle plugin.</description>
34+
<properties>
35+
<gradle.task>build</gradle.task>
36+
<skip.gradle.build>false</skip.gradle.build>
37+
<artifactPrefix>apache-rat-gradle-plugin</artifactPrefix>
38+
</properties>
39+
<dependencies>
40+
<dependency>
41+
<groupId>org.apache.rat</groupId>
42+
<artifactId>apache-rat-core</artifactId>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.apache.rat</groupId>
46+
<artifactId>apache-rat-tools</artifactId>
47+
</dependency>
48+
</dependencies>
49+
<build>
50+
<pluginManagement>
51+
<plugins>
52+
<plugin>
53+
<groupId>org.apache.rat</groupId>
54+
<artifactId>apache-rat-plugin</artifactId>
55+
<configuration>
56+
<inputExcludes>
57+
<exclude>build/**</exclude>
58+
<exclude>gradle/wrapper/gradle-wrapper.jar</exclude>
59+
<exclude>gradle/wrapper/gradle-wrapper*.sha256</exclude>
60+
<!-- exclude the definition file(s) -->
61+
<exclude>**/default.xml</exclude>
62+
<exclude>**/example-configuration.xml</exclude>
63+
<!-- exclude test generation files that contain unapproved license text -->
64+
<exclude>**/ReporterOptionsProvider.java</exclude>
65+
<exclude>**/GPLLicenseTest.java</exclude>
66+
<!-- These files have bad license headers because they are used to test bad license headers -->
67+
<exclude>src/test/resources/**</exclude>
68+
<exclude>src/it/resources/ReportTest/**</exclude>
69+
</inputExcludes>
70+
</configuration>
71+
</plugin>
72+
</plugins>
73+
</pluginManagement>
74+
<plugins>
75+
<plugin>
76+
<groupId>org.codehaus.mojo</groupId>
77+
<artifactId>exec-maven-plugin</artifactId>
78+
<executions>
79+
<execution>
80+
<id>gradle</id>
81+
<phase>prepare-package</phase>
82+
<configuration>
83+
<executable>./gradlew</executable>
84+
<arguments>
85+
<argument>clean</argument>
86+
<argument>${gradle.task}</argument>
87+
<argument>-Pdescription=${project.description}</argument>
88+
<argument>-Dmaven.repo.local=${settings.localRepository}</argument>
89+
<argument>-S</argument>
90+
<argument>--stacktrace</argument>
91+
</arguments>
92+
<environmentVariables>
93+
<MAVEN_REPO_LOCAL>${settings.localRepository}</MAVEN_REPO_LOCAL>
94+
<GRADLE_OPTS>${env.MAVEN_OPTS}</GRADLE_OPTS>
95+
<JAVA_HOME>${gradleJavaHome}</JAVA_HOME>
96+
</environmentVariables>
97+
<skip>${skip.gradle.build}</skip>
98+
</configuration>
99+
<goals>
100+
<goal>exec</goal>
101+
</goals>
102+
</execution>
103+
</executions>
104+
</plugin>
105+
<plugin>
106+
<groupId>org.codehaus.mojo</groupId>
107+
<artifactId>build-helper-maven-plugin</artifactId>
108+
<executions>
109+
<execution>
110+
<id>attach-artifacts</id>
111+
<phase>package</phase>
112+
<goals>
113+
<goal>attach-artifact</goal>
114+
</goals>
115+
<configuration>
116+
<artifacts>
117+
<artifact>
118+
<file>build/libs/${artifactPrefix}-${project.version}.jar</file>
119+
<type>jar</type>
120+
</artifact>
121+
<artifact>
122+
<file>build/libs/${artifactPrefix}-${project.version}-javadoc.jar</file>
123+
<type>jar</type>
124+
<classifier>javadoc</classifier>
125+
</artifact>
126+
<artifact>
127+
<file>build/libs/${artifactPrefix}-${project.version}-sources.jar</file>
128+
<type>jar</type>
129+
<classifier>sources</classifier>
130+
</artifact>
131+
</artifacts>
132+
<skipAttach>${skip.gradle.build}</skipAttach>
133+
</configuration>
134+
</execution>
135+
</executions>
136+
</plugin>
137+
<plugin>
138+
<groupId>org.apache.maven.plugins</groupId>
139+
<artifactId>maven-jar-plugin</artifactId>
140+
<executions>
141+
<execution>
142+
<goals>
143+
<goal>test-jar</goal>
144+
</goals>
145+
</execution>
146+
</executions>
147+
</plugin>
148+
<!--
149+
TODO enable when code-style's adopted
150+
<plugin>
151+
<groupId>org.apache.maven.plugins</groupId>
152+
<artifactId>maven-checkstyle-plugin</artifactId>
153+
<configuration>
154+
<consoleOutput>true</consoleOutput>
155+
<failsOnError>true</failsOnError>
156+
<failOnViolation>true</failOnViolation>
157+
<violationSeverity>warning</violationSeverity>
158+
<excludeGeneratedSources>true</excludeGeneratedSources>
159+
<configLocation>../src/conf/checkstyle.xml</configLocation>
160+
<suppressionsLocation>../src/conf/checkstyle-suppressions.xml</suppressionsLocation>
161+
</configuration>
162+
<executions>
163+
<execution>
164+
<goals>
165+
<goal>check</goal>
166+
</goals>
167+
<phase>compile</phase>
168+
</execution>
169+
</executions>
170+
</plugin>
171+
-->
172+
</plugins>
173+
</build>
174+
<profiles>
175+
<profile>
176+
<id>skipTests</id>
177+
<activation>
178+
<property>
179+
<name>skipTests</name>
180+
<value>true</value>
181+
</property>
182+
</activation>
183+
<properties>
184+
<gradle.task>assemble</gradle.task>
185+
</properties>
186+
</profile>
187+
<profile>
188+
<id>gradleJavaHomeSet</id>
189+
<activation>
190+
<property>
191+
<name>env.GRADLE_JAVA_HOME</name>
192+
</property>
193+
</activation>
194+
<properties>
195+
<gradleJavaHome>${env.GRADLE_JAVA_HOME}</gradleJavaHome>
196+
</properties>
197+
</profile>
198+
<profile>
199+
<id>gradleJavaHomeNotSet</id>
200+
<activation>
201+
<property>
202+
<name>!env.GRADLE_JAVA_HOME</name>
203+
</property>
204+
</activation>
205+
<properties>
206+
<gradleJavaHome>${env.JAVA_HOME}</gradleJavaHome>
207+
</properties>
208+
</profile>
209+
</profiles>
210+
</project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.rat.gradle.internal;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.rat.gradle;

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ agnostic home for software distribution comprehension and audit tools.
975975
<module>apache-rat</module>
976976
<module>apache-rat-tools</module>
977977
<module>apache-rat-testdata</module>
978+
<module>apache-rat-gradle-plugin</module>
978979
</modules>
979980
<licenses>
980981
<license>

0 commit comments

Comments
 (0)