ZEST-15 Introduce the Gradle Honker plugin - check dependencies licensing compatibility - generates DEPENDENCIES/NOTICE/LICENSE files in META-INF folder
Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/dd112c6b Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/dd112c6b Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/dd112c6b Branch: refs/heads/develop Commit: dd112c6bc1323e9766b87c645a51bbf175f6584e Parents: 48f5dc9 Author: Paul Merlin <[email protected]> Authored: Mon Jul 6 17:59:11 2015 +0200 Committer: Paul Merlin <[email protected]> Committed: Mon Jul 6 17:59:11 2015 +0200 ---------------------------------------------------------------------- build.gradle | 35 +++++++++++++++++++++++++++++------ libraries.gradle | 26 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/dd112c6b/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 7ff01a1..44d0013 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,7 @@ buildscript { } dependencies { classpath 'gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.1.2' + classpath 'gradle.plugin.org.nosphere.honker:honker-gradle:0.2.1' classpath 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1' } } @@ -94,12 +95,6 @@ rat { ] } -buildscript { - repositories { - mavenCentral() - } -} - // External tools BEGIN --------------------------------------------------- @@ -132,6 +127,7 @@ allprojects { // apply plugin: 'checkstyle' apply plugin: 'project-report' apply plugin: 'maven' + apply plugin: 'org.nosphere.honker' defaultTasks 'classes', 'test' @@ -229,6 +225,11 @@ allprojects { } sourceSets { + main { + output.dir( honkerGenDependencies.outputDir, builtBy: honkerGenDependencies ) + output.dir( honkerGenLicense.outputDir, builtBy: honkerGenLicense ) + output.dir( honkerGenNotice.outputDir, builtBy: honkerGenNotice ) + } docs { resources { srcDir 'src/docs' @@ -236,6 +237,28 @@ allprojects { } } + honker { + // Project License, applied to all submodules + license 'Apache 2' + // Dependencies (transitive or not) with no license information, overriding them + licenseOverride { candidate -> + if( candidate.group == 'asm' || candidate.module == 'prefuse-core' ) { + candidate.license = 'BSD 3-Clause' + } + if( candidate.group == 'org.apache.httpcomponents' + || candidate.group == 'jdbm' + || candidate.group == 'org.osgi' + || candidate.group.startsWith( 'org.restlet' ) ) { + candidate.license = 'Apache 2' + } + } + } + honkerGenNotice { + header = 'Apache Zest' + footer = 'This product includes software developed at\nThe Apache Software Foundation (http://www.apache.org/).\n' + } + check.dependsOn honkerCheck + project.ext { javaDir = new File( "$projectDir/src/main/java" ) scalaDir = new File( "$projectDir/src/main/scala" ) http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/dd112c6b/libraries.gradle ---------------------------------------------------------------------- diff --git a/libraries.gradle b/libraries.gradle index cd5e35a..dbc55a4 100644 --- a/libraries.gradle +++ b/libraries.gradle @@ -264,3 +264,29 @@ rootProject.ext { ] } +// Global transitive dependencies resolution rules +// See https://docs.gradle.org/current/userguide/dependency_management.html#sec:dependency_resolve_rules +// See https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html +allprojects { + configurations.all { + resolutionStrategy { + dependencySubstitution { + eachModule { ModuleDependencySubstitution details -> + // woodstox:wstx-asl is broken (no pom), use org.codehaus.woodstox:wstx-asl instead + if( details.requested.group == 'woodstox' && details.requested.module == 'wstx-asl' ) { + details.useTarget group: 'org.codehaus.woodstox', name: 'wstx-asl', version: details.requested.version + } + // some bad citizens have SNAPSHOT parents ... + if( details.requested.module == 'commons-sandbox-parent' && details.requested.version == '3-SNAPSHOT') { + details.useTarget group: details.requested.group, name: details.requested.module, version: '3' + } + // Findbugs Annotation is LGPL, use https://github.com/stephenc/findbugs-annotations which is + // Apache 2 licensed instead + if( details.requested.group == 'net.sourceforge.findbugs' && details.requested.module == 'annotations' ) { + details.useTarget group: 'com.github.stephenc.findbugs', name: 'findbugs-annotations', version: '1.3.9-1' + } + } + } + } + } +}
