diff options
Diffstat (limited to 'gradle')
-rw-r--r-- | gradle/verify-licenses.gradle | 39 | ||||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.jar | bin | 0 -> 60756 bytes | |||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 5 |
3 files changed, 44 insertions, 0 deletions
diff --git a/gradle/verify-licenses.gradle b/gradle/verify-licenses.gradle new file mode 100644 index 0000000..a4cafd5 --- /dev/null +++ b/gradle/verify-licenses.gradle @@ -0,0 +1,39 @@ +// Source: https://github.com/abesto/zipkin/blob/8cbc69bfcd85e89c1be43f1038ecf7c200245933/gradle/verify-licenses.gradle +/** + * Gradle plugin used to verify that all dependencies of a project use allowed licenses. + * Usage: + * apply from: "${rootDir}/gradle/verify-licenses.gradle" + * + * The list of allowed licenses can be modified via `licenseBlackList` from project definitions. + */ + +ext.licenseBlackList = [ + 'No license found', + 'GNU GENERAL PUBLIC LICENSE, Version 3', + 'GNU GENERAL PUBLIC LICENSE, V3.0' +] + +// Verify that all dependency licenses are ones we like +task verifyLicenses { + description "Verify that none of the dependencies use black-listed licenses." + dependsOn 'downloadLicenses' + + doLast { + def xml = new XmlParser().parse('app/build/reports/license/license-dependency.xml') + def fail = false + xml.each { license -> + if (licenseBlackList*.toLowerCase().contains(license.@name.toLowerCase())) { + def depStrings = [] + license.dependency.each { depStrings << it.text() } + logger.error( + "License \"${license.@name}\" is not on the list of allowed licenses. " +\ + "The dependencies using it: ${depStrings}") + fail = true + } + } + if (fail) { + throw new GradleException("License verification failed.") + } + } +} +check.dependsOn verifyLicenses
\ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 0000000..249e583 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..98debb8 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists |