Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add THIRDPARTY-LICENSE notice
  • Loading branch information
nbagnard committed Feb 1, 2025
commit e7fdd521bad9b47e1e87b998d2f6f0332ff80294
4 changes: 3 additions & 1 deletion .evg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,9 @@ functions:
if [[ "${triggered_by_git_tag}" != "" ]]; then
EXTRA_PROP="-PisTagTriggered"
fi
./gradlew -Dorg.gradle.java.home=${JAVA_HOME} $EXTRA_PROP clean -x test -x integrationTest spotlessApply build shadowjar --rerun-tasks
./gradlew clean generateLicenseReport --rerun-tasks && \
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 && \
./gradlew -Dorg.gradle.java.home=${JAVA_HOME} $EXTRA_PROP -x test -x integrationTest spotlessApply build shadowjar --rerun-tasks
"check spotless":
command: shell.exec
Expand Down
40 changes: 38 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ plugins {
id "de.marcphilipp.nexus-publish" version "0.3.0"
id "com.github.johnrengelman.shadow" version "5.2.0"
id "org.cyclonedx.bom" version "1.8.2"
id 'com.github.jk1.dependency-license-report' version '1.17'
}

import com.github.jk1.license.render.TextReportRenderer

if (project.hasProperty('isTagTriggered')) {
version = getAbbreviatedGitVersion()
} else {
Expand All @@ -29,6 +32,10 @@ spotless {
}
}

licenseReport {
renderers = [new TextReportRenderer('THIRD-PARTY-LICENSE.txt')]
}

cyclonedxBom {
// includeConfigs is the list of configuration names to include when generating the BOM (leave empty to include every configuration), regex is supported
includeConfigs = ["runtimeClasspath"]
Expand Down Expand Up @@ -102,8 +109,6 @@ allprojects {
testCompile group: 'org.mockito', name: 'mockito-junit-jupiter', version: mockitoVersion
}

//ant.lifecycleLogLevel = AntBuilder.AntMessagePriority.VERBOSE

compileJava {
doLast {
ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties",
Expand Down Expand Up @@ -213,13 +218,44 @@ task runCallbackWithBadRefreshToken(type: JavaExec) {
main = 'com.mongodb.jdbc.oidc.manualtests.TestOidcCallbackWithBadRefreshToken'
}



tasks.register('copyThirdPartyLicenseNotice', Copy) {
from layout.buildDirectory.file("reports/dependency-license/THIRD-PARTY-LICENSE.txt")
into layout.projectDirectory.dir("src/main/resources/META-INF/licenses")
}

jar {
// Add the THIRD-PARTY-LICENSE to our jar
// Note that in order for this to work, the file must be present
// To generate it, run generateLicenseReport. However, ':generateLicenseReport' has a dependecy on `:jar`
// which makes it impossible to generate and bundle the THIRD-PARTY-LICENSE in one pass.
from('build/reports/dependency-license/THIRD-PARTY-LICENSE.txt') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

into 'META-INF/licenses'
}

manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
}

shadowJar {
// Add the THIRD-PARTY-LICENSE to our jar
// Note that in order for this to work, the file must be present
// To generate it, run generateLicenseReport. However, ':generateLicenseReport' has a dependecy on `:jar`
// which makes it impossible to generate and bundle the THIRD-PARTY-LICENSE in one pass.
from('build/reports/dependency-license/THIRD-PARTY-LICENSE.txt') {
into 'META-INF/licenses'
}
}

tasks.named('copyThirdPartyLicenseNotice') {
dependsOn generateLicenseReport
}



dependencies {
integrationTestImplementation "org.yaml:snakeyaml:$snakeYamlVersion"
api "org.mongodb:mongodb-driver-sync:$mongodbDriverVersion"
Expand Down
13 changes: 13 additions & 0 deletions resources/third_party_header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
MongoDB uses third-party libraries or other resources that may
be distributed under licenses different than the MongoDB software.

In the event that we accidentally failed to list a required notice,
please bring it to our attention through our JIRA system at:

https://jira.mongodb.org

The attached notices are provided for information only.


--------------------------