Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement package license scanner for backend components. #1579

Merged
merged 4 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions projects/pluto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,12 @@ To format the code, run the following command:

NOTE: The Spotless plugin also runs as part of the CI pipeline. Build will fail if the code is not formatted correctly.

### Licenses

The project uses the Gradle license plugin to manage licenses. To check if the licenses of the dependencies
are compatible with list of allowed licenses defined in [allowed-licenses.json](allowed-licenses.json),
run the following command:

```bash
./gradlew :checkLicense
```
28 changes: 28 additions & 0 deletions projects/pluto/allowed-licenses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"allowedLicenses": [
{
"moduleLicense": "Apache License, Version 2.0"
},
{
"moduleLicense": "MIT License"
},
{
"moduleLicense": "MIT-0"
},
{
"moduleLicense": "Eclipse Public License - v 1.0"
},
{
"moduleLicense": "Eclipse Public License - v 2.0"
},
{
"moduleLicense": "Creative Commons Legal Code"
},
{
"moduleLicense": "Bouncy Castle Licence"
},
{
"moduleLicense": "PUBLIC DOMAIN"
}
]
}
7 changes: 7 additions & 0 deletions projects/pluto/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ plugins {
id "org.owasp.dependencycheck" version '8.2.1'
id 'io.spring.dependency-management' version '1.1.4'
id "com.diffplug.spotless" version "6.25.0"
id 'com.github.jk1.dependency-license-report' version '2.9'
}

group 'nl.fairspace'
Expand Down Expand Up @@ -98,3 +99,9 @@ dependencyManagement {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

import com.github.jk1.license.filter.LicenseBundleNormalizer
licenseReport {
filters = [new LicenseBundleNormalizer(bundlePath: "$projectDir/license-normalizer-bundle.json")]
allowedLicensesFile = new File("$projectDir/allowed-licenses.json")
}
10 changes: 10 additions & 0 deletions projects/pluto/license-normalizer-bundle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"bundles" : [
{ "bundleName" : "apache2", "licenseName" : "Apache License, Version 2.0", "licenseUrl" : "http://www.apache.org/licenses/LICENSE-2.0" }
],
"transformationRules" : [
{ "bundleName" : "apache2", "licenseNamePattern" : ".*The Apache Software License, Version 2.0.*" },
{ "bundleName" : "apache2", "licenseNamePattern" : "Apache 2" },
{ "bundleName" : "apache2", "licenseNamePattern" : "Apache License 2.0" }
]
}
8 changes: 8 additions & 0 deletions projects/saturn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,12 @@ To format the code, run the following command:

NOTE: The Spotless plugin also runs as part of the CI pipeline. Build will fail if the code is not formatted correctly.

### Licenses

The project uses the Gradle license plugin to manage licenses. To check if the licenses of the dependencies
are compatible with list of allowed licenses defined in [allowed-licenses.json](allowed-licenses.json),
run the following command:

```bash
./gradlew :checkLicense
```
37 changes: 37 additions & 0 deletions projects/saturn/allowed-licenses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"allowedLicenses": [
{
"moduleLicense": "Apache License, Version 2.0"
},
{
"moduleLicense": "MIT License"
},
{
"moduleLicense": "MIT-0"
},
{
"moduleLicense": "Eclipse Public License - v 1.0"
},
{
"moduleLicense": "Eclipse Public License - v 2.0"
},
{
"moduleLicense": "The 3-Clause BSD License"
},
{
"moduleLicense": "The 2-Clause BSD License"
},
{
"moduleLicense": "Creative Commons Legal Code"
},
{
"moduleLicense": "Bouncy Castle Licence"
},
{
"moduleLicense": "Similar to Apache License but with the acknowledgment clause removed"
},
{
"moduleLicense": "PUBLIC DOMAIN"
}
]
}
7 changes: 7 additions & 0 deletions projects/saturn/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ plugins {
id 'jacoco'
id "org.owasp.dependencycheck" version "8.2.1"
id "com.diffplug.spotless" version "6.25.0"
id 'com.github.jk1.dependency-license-report' version '2.9'
}

group 'io.fairspace'
Expand Down Expand Up @@ -116,3 +117,9 @@ test {
jvmArgs = ['--add-opens', 'java.base/java.util=ALL-UNNAMED']
useJUnitPlatform()
}

import com.github.jk1.license.filter.LicenseBundleNormalizer
licenseReport {
filters = [new LicenseBundleNormalizer(bundlePath: "$projectDir/license-normalizer-bundle.json")]
allowedLicensesFile = new File("$projectDir/allowed-licenses.json")
}
10 changes: 10 additions & 0 deletions projects/saturn/license-normalizer-bundle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"bundles" : [
{ "bundleName" : "apache2", "licenseName" : "Apache License, Version 2.0", "licenseUrl" : "http://www.apache.org/licenses/LICENSE-2.0" }
],
"transformationRules" : [
{ "bundleName" : "apache2", "licenseNamePattern" : ".*The Apache Software License, Version 2.0.*" },
{ "bundleName" : "apache2", "licenseNamePattern" : "Apache 2" },
{ "bundleName" : "apache2", "licenseNamePattern" : "Apache License 2.0" }
]
}
Loading