Skip to content

Commit 1488fc9

Browse files
guillaume-dequennesonartech
authored andcommitted
SONARPY-3298 Generate 3rd party dependencies license files (#480)
GitOrigin-RevId: 0a6077570beb201912c6a8b232293357297582ad
1 parent add9bed commit 1488fc9

33 files changed

Lines changed: 4514 additions & 0 deletions

license-resources/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The open source and enterprise plugin JAR both contain a `licenses/` folder which contains the licenses of all the used libraries. These licenses have to be txt files. However, some libraries ship html files, in which case they need to be overwritten. The files which overwrite the html file are located in this folder. The overwriting itself is configured in the `pom.xml` of the respective plugin, like `sonar-python-plugin/pom.xml`.

license-resources/asm_ow2_bsd.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ASM: a very small and fast Java bytecode manipulation framework
2+
Copyright (c) 2000-2011 INRIA, France Telecom
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions
7+
are met:
8+
1. Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
3. Neither the name of the copyright holders nor the names of its
14+
contributors may be used to endorse or promote products derived from
15+
this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27+
THE POSSIBILITY OF SUCH DAMAGE.

license-resources/bsd2_clause.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Copyright <YEAR> <COPYRIGHT HOLDER>
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

license-resources/bsd3_clause.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright <YEAR> <COPYRIGHT HOLDER>
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10+
11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

license-resources/sax.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright Status
2+
3+
SAX is free!
4+
5+
In fact, it's not possible to own a license to SAX, since it's been placed in the public domain.
6+
No Warranty
7+
8+
Because SAX is released to the public domain, there is no warranty for the design or for the software implementation, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide SAX "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of SAX is with you. Should SAX prove defective, you assume the cost of all necessary servicing, repair or correction.
9+
10+
In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute SAX, be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use SAX (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the SAX to operate with any other programs), even if such holder or other party has been advised of the possibility of such damages.
11+
Copyright Disclaimers
12+
13+
This page includes statements to that effect by David Megginson, who would have been able to claim copyright for the original work.
14+
SAX 1.0
15+
16+
Version 1.0 of the Simple API for XML (SAX), created collectively by the membership of the XML-DEV mailing list, is hereby released into the public domain.
17+
18+
No one owns SAX: you may use it freely in both commercial and non-commercial applications, bundle it with your software distribution, include it on a CD-ROM, list the source code in a book, mirror the documentation at your own web site, or use it in any other way you see fit.
19+
20+
David Megginson, Megginson Technologies Ltd.
21+
1998-05-11
22+
SAX 2.0
23+
24+
I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and release all of the SAX 2.0 source code, compiled code, and documentation contained in this distribution into the Public Domain. SAX comes with NO WARRANTY or guarantee of fitness for any purpose.
25+
26+
David Megginson, Megginson Technologies Ltd.
27+
2000-05-05

sonar-python-plugin/pom.xml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<tag>HEAD</tag>
2525
</scm>
2626

27+
<properties>
28+
<licenseDirectoryUri>${project.baseUri}/../license-resources</licenseDirectoryUri>
29+
</properties>
30+
2731
<dependencies>
2832
<dependency>
2933
<groupId>org.sonarsource.api.plugin</groupId>
@@ -133,6 +137,134 @@
133137
</configuration>
134138
</plugin>
135139

140+
<plugin>
141+
<groupId>org.codehaus.mojo</groupId>
142+
<artifactId>license-maven-plugin</artifactId>
143+
<version>2.6.0</version>
144+
<configuration>
145+
<errorRemedy>failFast</errorRemedy>
146+
<writeVersions>false</writeVersions>
147+
<socketTimeout>20000</socketTimeout>
148+
<licensesOutputDirectory>${project.basedir}/src/main/resources/licenses/THIRD_PARTY_LICENSES</licensesOutputDirectory>
149+
<licensesOutputFile>${project.build.directory}/licenses.xml</licensesOutputFile>
150+
<organizeLicensesByDependencies>true</organizeLicensesByDependencies>
151+
<excludedGroups>com.sonarsource|org.sonarsource.python|org.sonarsource.analyzer-commons|org.sonarsource.sslr|jaxen</excludedGroups>
152+
<licenseUrlReplacements>
153+
<licenseUrlReplacement>
154+
<regexp>https://asm.ow2.io/license.html</regexp>
155+
<replacement>${licenseDirectoryUri}/asm_ow2_bsd.txt</replacement>
156+
</licenseUrlReplacement>
157+
<licenseUrlReplacement>
158+
<regexp>http://www.opensource.org/licenses/bsd-license.php</regexp>
159+
<replacement>${licenseDirectoryUri}/bsd2_clause.txt</replacement>
160+
</licenseUrlReplacement>
161+
<licenseUrlReplacement>
162+
<regexp>https://opensource.org/licenses/BSD-3-Clause</regexp>
163+
<replacement>${licenseDirectoryUri}/bsd3_clause.txt</replacement>
164+
</licenseUrlReplacement>
165+
<licenseUrlReplacement>
166+
<regexp>http://www.saxproject.org/copying.html</regexp>
167+
<replacement>${licenseDirectoryUri}/sax.txt</replacement>
168+
</licenseUrlReplacement>
169+
</licenseUrlReplacements>
170+
<licenseUrlFileNameSanitizers>
171+
<LicenseUrlReplacement>
172+
<regexp>.txt</regexp>
173+
</LicenseUrlReplacement>
174+
<!-- Append .txt -->
175+
<LicenseUrlReplacement>
176+
<regexp>$</regexp>
177+
<replacement>.txt</replacement>
178+
</LicenseUrlReplacement>
179+
</licenseUrlFileNameSanitizers>
180+
</configuration>
181+
<executions>
182+
<execution>
183+
<phase>generate-resources</phase>
184+
<id>download-licenses</id>
185+
<goals>
186+
<goal>download-licenses</goal>
187+
</goals>
188+
</execution>
189+
</executions>
190+
</plugin>
191+
192+
<plugin>
193+
<artifactId>maven-resources-plugin</artifactId>
194+
<version>3.3.1</version>
195+
<executions>
196+
<execution>
197+
<id>copy-main-license</id>
198+
<phase>generate-resources</phase>
199+
<goals>
200+
<goal>copy-resources</goal>
201+
</goals>
202+
<configuration>
203+
<resources>
204+
<resource>
205+
<directory>..</directory>
206+
<includes>
207+
<include>LICENSE.txt</include>
208+
</includes>
209+
</resource>
210+
</resources>
211+
<outputDirectory>${project.basedir}/src/main/resources/licenses</outputDirectory>
212+
</configuration>
213+
</execution>
214+
</executions>
215+
</plugin>
216+
217+
<plugin>
218+
<artifactId>maven-antrun-plugin</artifactId>
219+
<version>3.1.0</version>
220+
<executions>
221+
<execution>
222+
<id>check-license-files</id>
223+
<phase>verify</phase>
224+
<configuration>
225+
<target>
226+
<fileset id="invalid.files" dir="${project.basedir}/src/main/resources/licenses">
227+
<exclude name="**/*.txt"/>
228+
<include name="**/*"/>
229+
</fileset>
230+
<condition property="has.invalid.files">
231+
<resourcecount refid="invalid.files" when="greater" count="0"/>
232+
</condition>
233+
<fail message="There are files in ${project.build.directory}/licenses/ that do not end with .txt">
234+
<condition>
235+
<isset property="has.invalid.files"/>
236+
</condition>
237+
</fail>
238+
</target>
239+
</configuration>
240+
<goals>
241+
<goal>run</goal>
242+
</goals>
243+
</execution>
244+
</executions>
245+
</plugin>
246+
247+
<plugin>
248+
<groupId>org.codehaus.mojo</groupId>
249+
<artifactId>build-helper-maven-plugin</artifactId>
250+
<version>3.6.0</version> <executions>
251+
<execution>
252+
<id>add-resource</id>
253+
<phase>generate-resources</phase>
254+
<goals>
255+
<goal>add-resource</goal>
256+
</goals>
257+
<configuration>
258+
<resources>
259+
<resource>
260+
<directory>${project.build.directory}/generated-resources</directory>
261+
</resource>
262+
</resources>
263+
</configuration>
264+
</execution>
265+
</executions>
266+
</plugin>
267+
136268
<plugin>
137269
<artifactId>maven-shade-plugin</artifactId>
138270
<executions>

0 commit comments

Comments
 (0)