Skip to content

Commit bd11891

Browse files
authored
SQL-2534: Add THIRDPARTY-LICENSE notice (#324)
* Add THIRDPARTY-LICENSE notice * Clean-up
1 parent 4b1bd9a commit bd11891

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

.evg.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,9 @@ functions:
556556
if [[ "${triggered_by_git_tag}" != "" ]]; then
557557
EXTRA_PROP="-PisTagTriggered"
558558
fi
559-
./gradlew -Dorg.gradle.java.home=${JAVA_HOME} $EXTRA_PROP clean -x test -x integrationTest spotlessApply build shadowjar --rerun-tasks
559+
./gradlew clean generateLicenseReport --rerun-tasks && \
560+
echo -e "$(cat resources/third_party_header.txt)\n$(cat build/reports/dependency-license/THIRD-PARTY-LICENSE.txt)" > build/reports/dependency-license/THIRD-PARTY-LICENSE.txt && \
561+
./gradlew -Dorg.gradle.java.home=${JAVA_HOME} $EXTRA_PROP -x test -x integrationTest spotlessApply build shadowjar --rerun-tasks
560562
561563
"check spotless":
562564
command: shell.exec

build.gradle

+25-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ plugins {
55
id "de.marcphilipp.nexus-publish" version "0.3.0"
66
id "com.github.johnrengelman.shadow" version "5.2.0"
77
id "org.cyclonedx.bom" version "1.8.2"
8+
id 'com.github.jk1.dependency-license-report' version '1.17'
89
}
910

11+
import com.github.jk1.license.render.TextReportRenderer
12+
1013
if (project.hasProperty('isTagTriggered')) {
1114
version = getAbbreviatedGitVersion()
1215
} else {
@@ -29,6 +32,10 @@ spotless {
2932
}
3033
}
3134

35+
licenseReport {
36+
renderers = [new TextReportRenderer('THIRD-PARTY-LICENSE.txt')]
37+
}
38+
3239
cyclonedxBom {
3340
// includeConfigs is the list of configuration names to include when generating the BOM (leave empty to include every configuration), regex is supported
3441
includeConfigs = ["runtimeClasspath"]
@@ -102,8 +109,6 @@ allprojects {
102109
testCompile group: 'org.mockito', name: 'mockito-junit-jupiter', version: mockitoVersion
103110
}
104111

105-
//ant.lifecycleLogLevel = AntBuilder.AntMessagePriority.VERBOSE
106-
107112
compileJava {
108113
doLast {
109114
ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties",
@@ -214,12 +219,30 @@ task runCallbackWithBadRefreshToken(type: JavaExec) {
214219
}
215220

216221
jar {
222+
// Add the THIRD-PARTY-LICENSE to our jar
223+
// Note that in order for this to work, the file must be present
224+
// To generate it, run generateLicenseReport. However, ':generateLicenseReport' has a dependecy on `:jar`
225+
// which makes it impossible to generate and bundle the THIRD-PARTY-LICENSE in one pass.
226+
from('build/reports/dependency-license/THIRD-PARTY-LICENSE.txt') {
227+
into 'META-INF/licenses'
228+
}
229+
217230
manifest {
218231
attributes('Implementation-Title': project.name,
219232
'Implementation-Version': project.version)
220233
}
221234
}
222235

236+
shadowJar {
237+
// Add the THIRD-PARTY-LICENSE to our jar
238+
// Note that in order for this to work, the file must be present
239+
// To generate it, run generateLicenseReport. However, ':generateLicenseReport' has a dependecy on `:jar`
240+
// which makes it impossible to generate and bundle the THIRD-PARTY-LICENSE in one pass.
241+
from('build/reports/dependency-license/THIRD-PARTY-LICENSE.txt') {
242+
into 'META-INF/licenses'
243+
}
244+
}
245+
223246
dependencies {
224247
integrationTestImplementation "org.yaml:snakeyaml:$snakeYamlVersion"
225248
api "org.mongodb:mongodb-driver-sync:$mongodbDriverVersion"

resources/third_party_header.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
MongoDB uses third-party libraries or other resources that may
2+
be distributed under licenses different than the MongoDB software.
3+
4+
In the event that we accidentally failed to list a required notice,
5+
please bring it to our attention through our JIRA system at:
6+
7+
https://jira.mongodb.org
8+
9+
The attached notices are provided for information only.
10+
11+
12+
--------------------------
13+

0 commit comments

Comments
 (0)