-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce strict license distribution requirements (#56642)
This commit tightens certain dependency license checks in our build. Firstly, the build will not fail if it cannot accurately identify the type of license in one of our LICENSE.txt files. Secondly, dependencies for licenses identified as requiring source redistribution will fail if a corresponding SOURCES.txt file does not exist. This file should include a hyperlink to a source artifact for the given dependency to be used for redistribution during the release process.
- v8.17.0
- v8.16.2
- v8.16.1
- v8.16.0
- v8.15.5
- v8.15.4
- v8.15.3
- v8.15.2
- v8.15.1
- v8.15.0
- v8.14.3
- v8.14.2
- v8.14.1
- v8.14.0
- v8.13.4
- v8.13.3
- v8.13.2
- v8.13.1
- v8.13.0
- v8.12.2
- v8.12.1
- v8.12.0
- v8.11.4
- v8.11.3
- v8.11.2
- v8.11.1
- v8.11.0
- v8.10.4
- v8.10.3
- v8.10.2
- v8.10.1
- v8.10.0
- v8.9.2
- v8.9.1
- v8.9.0
- v8.8.2
- v8.8.1
- v8.8.0
- v8.7.1
- v8.7.0
- v8.6.2
- v8.6.1
- v8.6.0
- v8.5.3
- v8.5.2
- v8.5.1
- v8.5.0
- v8.4.3
- v8.4.2
- v8.4.1
- v8.4.0
- v8.3.3
- v8.3.2
- v8.3.1
- v8.3.0
- v8.2.3
- v8.2.2
- v8.2.1
- v8.2.0
- v8.1.3
- v8.1.2
- v8.1.1
- v8.1.0
- v8.0.1
- v8.0.0
- v8.0.0-rc2
- v8.0.0-rc1
- v8.0.0-beta1
- v8.0.0-alpha2
- v8.0.0-alpha1
1 parent
b8801a4
commit f9847f3
Showing
11 changed files
with
732 additions
and
1,416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
205 changes: 205 additions & 0 deletions
205
buildSrc/src/main/java/org/elasticsearch/gradle/precommit/LicenseAnalyzer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.gradle.precommit; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import java.nio.file.Files; | ||
import java.util.regex.Pattern; | ||
|
||
public class LicenseAnalyzer { | ||
/* | ||
* Order here matters. License files can often contain multiple licenses for which the particular piece of software may by used under. | ||
* We should order these in order of most permissive to least permissive such that we identify the license as the most permissive for | ||
* purposes of redistribution. Search order is as defined below so the license will be identified as the first pattern to match. | ||
*/ | ||
private static final LicenseMatcher[] matchers = new LicenseMatcher[] { | ||
new LicenseMatcher("Apache-2.0", true, false, Pattern.compile("Apache.*License.*[vV]ersion.*2\\.0", Pattern.DOTALL)), | ||
new LicenseMatcher( | ||
"BSD-2-Clause", | ||
true, | ||
false, | ||
Pattern.compile( | ||
("Redistribution and use in source and binary forms, with or without\n" | ||
+ "modification, are permitted provided that the following conditions\n" | ||
+ "are met:\n" | ||
+ "\n" | ||
+ " 1\\. Redistributions of source code must retain the above copyright\n" | ||
+ " notice, this list of conditions and the following disclaimer\\.\n" | ||
+ " 2\\. Redistributions in binary form must reproduce the above copyright\n" | ||
+ " notice, this list of conditions and the following disclaimer in the\n" | ||
+ " documentation and/or other materials provided with the distribution\\.\n" | ||
+ "\n" | ||
+ "THIS SOFTWARE IS PROVIDED BY .+ (``|''|\")AS IS(''|\") AND ANY EXPRESS OR\n" | ||
+ "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" | ||
+ "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED\\.\n" | ||
+ "IN NO EVENT SHALL .+ BE LIABLE FOR ANY DIRECT, INDIRECT,\n" | ||
+ "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \\(INCLUDING, BUT\n" | ||
+ "NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" | ||
+ "DATA, OR PROFITS; OR BUSINESS INTERRUPTION\\) HOWEVER CAUSED AND ON ANY\n" | ||
+ "THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" | ||
+ "\\(INCLUDING NEGLIGENCE OR OTHERWISE\\) ARISING IN ANY WAY OUT OF THE USE OF\n" | ||
+ "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\\.").replaceAll("\\s+", "\\\\s*"), | ||
Pattern.DOTALL | ||
) | ||
), | ||
new LicenseMatcher( | ||
"BSD-3-Clause", | ||
true, | ||
false, | ||
Pattern.compile( | ||
("\n" | ||
+ "Redistribution and use in source and binary forms, with or without\n" | ||
+ "modification, are permitted provided that the following conditions\n" | ||
+ "are met:\n" | ||
+ "\n" | ||
+ " (1\\.)? Redistributions of source code must retain the above copyright\n" | ||
+ " notice, this list of conditions and the following disclaimer\\.\n" | ||
+ " (2\\.)? Redistributions in binary form must reproduce the above copyright\n" | ||
+ " notice, this list of conditions and the following disclaimer in the\n" | ||
+ " documentation and/or other materials provided with the distribution\\.\n" | ||
+ " ((3\\.)? The name of .+ may not be used to endorse or promote products\n" | ||
+ " derived from this software without specific prior written permission\\.|\n" | ||
+ " (3\\.)? Neither the name of .+ nor the names of its\n" | ||
+ " contributors may be used to endorse or promote products derived from\n" | ||
+ " this software without specific prior written permission\\.)\n" | ||
+ "\n" | ||
+ "THIS SOFTWARE IS PROVIDED BY .+ (``|''|\")AS IS(''|\") AND ANY EXPRESS OR\n" | ||
+ "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" | ||
+ "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED\\.\n" | ||
+ "IN NO EVENT SHALL .+ BE LIABLE FOR ANY DIRECT, INDIRECT,\n" | ||
+ "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \\(INCLUDING, BUT\n" | ||
+ "NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" | ||
+ "DATA, OR PROFITS; OR BUSINESS INTERRUPTION\\) HOWEVER CAUSED AND ON ANY\n" | ||
+ "THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" | ||
+ "\\(INCLUDING NEGLIGENCE OR OTHERWISE\\) ARISING IN ANY WAY OUT OF THE USE OF\n" | ||
+ "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\\.\n").replaceAll("\\s+", "\\\\s*"), | ||
Pattern.DOTALL | ||
) | ||
), | ||
new LicenseMatcher( | ||
"CDDL-1.0", | ||
true, | ||
false, | ||
Pattern.compile("COMMON DEVELOPMENT AND DISTRIBUTION LICENSE.*Version 1.0", Pattern.DOTALL) | ||
), | ||
new LicenseMatcher( | ||
"CDDL-1.1", | ||
true, | ||
false, | ||
Pattern.compile("COMMON DEVELOPMENT AND DISTRIBUTION LICENSE.*Version 1.1", Pattern.DOTALL) | ||
), | ||
new LicenseMatcher("ICU", true, false, Pattern.compile("ICU License - ICU 1.8.1 and later", Pattern.DOTALL)), | ||
new LicenseMatcher( | ||
"MIT", | ||
true, | ||
false, | ||
Pattern.compile( | ||
("\n" | ||
+ "Permission is hereby granted, free of charge, to any person obtaining a copy of\n" | ||
+ "this software and associated documentation files \\(the \"Software\"\\), to deal in\n" | ||
+ "the Software without restriction, including without limitation the rights to\n" | ||
+ "use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n" | ||
+ "of the Software, and to permit persons to whom the Software is furnished to do\n" | ||
+ "so, subject to the following conditions:\n" | ||
+ "\n" | ||
+ "The above copyright notice and this permission notice shall be included in all\n" | ||
+ "copies or substantial portions of the Software\\.\n" | ||
+ "\n" | ||
+ "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n" | ||
+ "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" | ||
+ "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\\. IN NO EVENT SHALL THE\n" | ||
+ "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" | ||
+ "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n" | ||
+ "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n" | ||
+ "SOFTWARE\\.\n").replaceAll("\\s+", "\\\\s*"), | ||
Pattern.DOTALL | ||
) | ||
), | ||
new LicenseMatcher("MPL-1.1", true, false, Pattern.compile("Mozilla Public License.*Version 1.1", Pattern.DOTALL)), | ||
new LicenseMatcher("MPL-2.0", true, false, Pattern.compile("Mozilla\\s*Public\\s*License\\s*Version\\s*2\\.0", Pattern.DOTALL)), | ||
new LicenseMatcher("XZ", false, false, Pattern.compile("Licensing of XZ for Java", Pattern.DOTALL)), | ||
new LicenseMatcher("EPL-2.0", true, false, Pattern.compile("Eclipse Public License - v 2.0", Pattern.DOTALL)), | ||
new LicenseMatcher("LGPL-2.1", true, true, Pattern.compile("GNU LESSER GENERAL PUBLIC LICENSE.*Version 2.1", Pattern.DOTALL)), | ||
new LicenseMatcher("LGPL-3.0", true, true, Pattern.compile("GNU LESSER GENERAL PUBLIC LICENSE.*Version 3", Pattern.DOTALL)) }; | ||
|
||
public static LicenseInfo licenseType(File licenseFile) { | ||
for (LicenseMatcher matcher : matchers) { | ||
boolean matches = matcher.matches(licenseFile); | ||
if (matches) { | ||
return new LicenseInfo(matcher.getIdentifier(), matcher.spdxLicense, matcher.sourceRedistributionRequired); | ||
} | ||
} | ||
|
||
throw new IllegalStateException("Unknown license for license file: " + licenseFile); | ||
} | ||
|
||
public static class LicenseInfo { | ||
private final String identifier; | ||
private final boolean spdxLicense; | ||
private final boolean sourceRedistributionRequired; | ||
|
||
public LicenseInfo(String identifier, boolean spdxLicense, boolean sourceRedistributionRequired) { | ||
this.identifier = identifier; | ||
this.spdxLicense = spdxLicense; | ||
this.sourceRedistributionRequired = sourceRedistributionRequired; | ||
} | ||
|
||
public String getIdentifier() { | ||
return identifier; | ||
} | ||
|
||
public boolean isSpdxLicense() { | ||
return spdxLicense; | ||
} | ||
|
||
public boolean isSourceRedistributionRequired() { | ||
return sourceRedistributionRequired; | ||
} | ||
} | ||
|
||
private static class LicenseMatcher { | ||
private final String identifier; | ||
private final boolean spdxLicense; | ||
private final boolean sourceRedistributionRequired; | ||
private final Pattern pattern; | ||
|
||
LicenseMatcher(String identifier, boolean spdxLicense, boolean sourceRedistributionRequired, Pattern pattern) { | ||
this.identifier = identifier; | ||
this.spdxLicense = spdxLicense; | ||
this.sourceRedistributionRequired = sourceRedistributionRequired; | ||
this.pattern = pattern; | ||
} | ||
|
||
public String getIdentifier() { | ||
return identifier; | ||
} | ||
|
||
public boolean matches(File licenseFile) { | ||
try { | ||
String content = Files.readString(licenseFile.toPath()).replaceAll("\\*", " "); | ||
return pattern.matcher(content).find(); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
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. | ||
3. The name of the author may not be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
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. | ||
3. The name of the author may not be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
795 changes: 182 additions & 613 deletions
795
plugins/discovery-azure-classic/licenses/jaxb-LICENSE.txt
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/pingidentity/ldapsdk/archive/4.0.8.tar.gz |
40 changes: 12 additions & 28 deletions
40
x-pack/plugin/watcher/licenses/jakarta.activation-LICENSE.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,13 @@ | ||
Eclipse Distribution License - v 1.0 | ||
|
||
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
- Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
- 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. | ||
|
||
- Neither the name of the Eclipse Foundation, Inc. nor the names of its | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
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 OWNER 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. | ||
Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
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. | ||
Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
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 OWNER 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. |