Add license check

This commit is contained in:
Sebastian Sdorra
2021-01-06 17:34:24 +01:00
committed by René Pfeuffer
parent d6b655f430
commit 55507b3f35
12 changed files with 218 additions and 10 deletions

View File

@@ -33,7 +33,8 @@ apply from: file( '../gradle/dependencies.gradle' )
dependencies {
implementation gradleApi()
implementation 'com.github.node-gradle:gradle-node-plugin:2.2.4'
implementation 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.15.0'
implementation libraries.guava
implementation libraries.jettyServer
implementation libraries.jettyWebapp

View File

@@ -30,7 +30,7 @@ import org.gradle.api.Project
class IntegrationTestPlugin implements Plugin<Project> {
void apply(Project project) {
void apply(Project project) {
def extension = project.extensions.create("scmServer", ScmServerExtension, project)
project.tasks.register('write-server-config', WriteServerConfigTask) {

View File

@@ -23,6 +23,7 @@
*/
package com.cloudogu.scm
import com.hierynomus.gradle.license.tasks.LicenseCheck
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.jvm.toolchain.JavaLanguageVersion
@@ -30,6 +31,8 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion
class JavaModulePlugin implements Plugin<Project> {
void apply(Project project) {
project.plugins.apply("com.github.hierynomus.license")
project.afterEvaluate {
project.java {
toolchain {
@@ -40,6 +43,43 @@ class JavaModulePlugin implements Plugin<Project> {
options.release = 8
}
}
project.license {
header project.rootProject.file('LICENSE.txt')
strictCheck true
mapping {
tsx = 'SLASHSTAR_STYLE'
ts = 'SLASHSTAR_STYLE'
java = 'SLASHSTAR_STYLE'
gradle = 'SLASHSTAR_STYLE'
}
exclude "**/*.mustache"
exclude "**/*.json"
exclude "**/*.ini"
exclude "**/mockito-extensions/*"
exclude "**/*.txt"
exclude "**/*.md"
exclude "**/*.gz"
exclude "**/*.zip"
exclude "**/*.smp"
exclude "**/*.asc"
exclude "**/*.png"
exclude "**/*.jpg"
exclude "**/*.gif"
exclude "**/*.dump"
}
project.tasks.register("licenseBuild", LicenseCheck) {
source = project.fileTree(dir: ".").include("build.gradle", "settings.gradle", "gradle.properties")
enabled = true
}
project.tasks.getByName("license").configure {
dependsOn("licenseBuild")
enabled = true
}
}
}

View File

@@ -32,11 +32,11 @@ subprojects {
url 'https://packages.scm-manager.org/repository/public/'
}
}
apply from: rootProject.file( 'gradle/dependencies.gradle' )
}
apply from: rootProject.file( 'gradle/dependencies.gradle' )
allprojects {
apply from: rootProject.file('gradle/dependencies.gradle')
}
dependencies {
constraints {
@@ -129,11 +129,11 @@ project.ext {
if (buildNumber != null) {
snapshotVersion += "-${buildNumber}"
}
dockerTag = version.replace('SNAPSHOT', snapshotVersion)
dockerTag = version.replace('SNAPSHOT', snapshotVersion)
} else {
expandedVersion = project.version
expandedVersionWithDot = project.version
dockerRepository = 'docker.io/scmmanager/scm-manager'
dockerTag = version.replace('SNAPSHOT', snapshotVersion)
dockerTag = version.replace('SNAPSHOT', snapshotVersion)
}
}

View File

@@ -26,6 +26,7 @@ import org.gradle.util.VersionNumber
plugins {
id 'nebula.ospackage' version '8.4.1'
id 'org.scm-manager.packaging'
id 'com.github.hierynomus.license-base' version '0.15.0'
}
configurations {
@@ -159,3 +160,21 @@ artifacts {
builtBy distribution
}
}
license {
header rootProject.file("LICENSE.txt")
strictCheck true
mapping {
gradle = 'SLASHSTAR_STYLE'
}
exclude '**/build/**'
include '**/src/**'
include 'build.gradle'
include 'Vagrantfile'
}
task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
source = fileTree('.')
}

View File

@@ -25,12 +25,12 @@
plugins {
id 'com.bmuschko.docker-remote-api' version '6.6.1'
id 'org.scm-manager.packaging'
id 'com.github.hierynomus.license-base' version '0.15.0'
}
import org.gradle.util.VersionNumber
import com.bmuschko.gradle.docker.tasks.image.*
configurations {
server
webapp
@@ -102,3 +102,21 @@ artifacts {
builtBy distribution
}
}
license {
header rootProject.file("LICENSE.txt")
strictCheck true
mapping {
gradle = 'SLASHSTAR_STYLE'
}
exclude '**/build/**'
include '**/src/**'
include 'build.gradle'
include 'Dockerfile'
}
task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
source = fileTree('.')
}

View File

@@ -25,6 +25,7 @@
plugins {
id 'org.unbroken-dome.helm' version '1.4.0'
id 'org.scm-manager.packaging'
id 'com.github.hierynomus.license-base' version '0.15.0'
}
configurations {
@@ -70,3 +71,26 @@ artifacts {
builtBy distribution
}
}
license {
header rootProject.file("LICENSE.txt")
strictCheck true
mapping {
gradle = 'SLASHSTAR_STYLE'
}
// TODO
// we get a strange build error with the license header,
// so we remove it for now
exclude '**/Chart.yaml'
exclude '**/build/**'
exclude '**/*.txt'
include '**/src/**'
include 'build.gradle'
}
task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
source = fileTree('.')
}

View File

@@ -24,6 +24,7 @@
plugins {
id 'org.scm-manager.packaging'
id 'com.github.hierynomus.license-base' version '0.15.0'
}
configurations {
@@ -44,3 +45,18 @@ dependencies {
task distribution(type: ReleaseYaml) {
configuration = configurations.packageYaml
}
license {
header rootProject.file("LICENSE.txt")
strictCheck true
mapping {
gradle = 'SLASHSTAR_STYLE'
}
include 'build.gradle'
}
task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
source = fileTree('.')
}

View File

@@ -48,6 +48,7 @@ buildscript {
plugins {
id 'nebula.ospackage' version '8.4.1'
id 'org.scm-manager.packaging'
id 'com.github.hierynomus.license-base' version '0.15.0'
}
configurations {
@@ -178,3 +179,21 @@ artifacts {
builtBy distribution
}
}
license {
header rootProject.file("LICENSE.txt")
strictCheck true
mapping {
gradle = 'SLASHSTAR_STYLE'
}
exclude '**/build/**'
include '**/src/**'
include 'build.gradle'
include 'Vagrantfile'
}
task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
source = fileTree('.')
}

View File

@@ -26,6 +26,7 @@ import org.gradle.util.VersionNumber
plugins {
id 'org.scm-manager.packaging'
id 'signing'
id 'com.github.hierynomus.license-base' version '0.15.0'
}
configurations {
@@ -107,3 +108,22 @@ artifacts {
signing {
sign configurations.unixPkg
}
license {
header rootProject.file("LICENSE.txt")
strictCheck true
mapping {
gradle = 'SLASHSTAR_STYLE'
}
exclude '**/build/**'
exclude '**/*.txt'
include '**/src/**'
include 'build.gradle'
}
task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
source = fileTree('.')
}

View File

@@ -27,6 +27,7 @@ plugins {
id "de.undercouch.download" version "4.1.1"
id 'org.scm-manager.packaging'
id 'signing'
id 'com.github.hierynomus.license-base' version '0.15.0'
}
configurations {
@@ -111,3 +112,21 @@ artifacts {
signing {
sign configurations.windowsPkg
}
license {
header rootProject.file("LICENSE.txt")
strictCheck true
mapping {
gradle = 'SLASHSTAR_STYLE'
}
exclude '**/build/**'
exclude '**/*.txt'
include '**/src/**'
include 'build.gradle'
}
task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
source = fileTree('.')
}

View File

@@ -4,7 +4,7 @@
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the 'Software'), to deal
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@@ -13,7 +13,7 @@
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
@@ -22,8 +22,10 @@
* SOFTWARE.
*/
plugins {
id 'com.github.node-gradle.node' version '2.2.4'
id 'com.github.hierynomus.license-base' version '0.15.0'
}
node {
@@ -134,3 +136,33 @@ task setVersion(type: YarnTask) {
args = ['run', 'set-version', project.version]
dependsOn('yarn_install')
}
license {
header rootProject.file("LICENSE.txt")
strictCheck true
mapping {
tsx = 'SLASHSTAR_STYLE'
ts = 'SLASHSTAR_STYLE'
gradle = 'SLASHSTAR_STYLE'
}
exclude '**/node_modules/**'
exclude '**/build/**'
exclude '**/.gradle/**'
exclude '**/*.json'
exclude '**/*.jpg'
exclude '**/*.png'
exclude '**/*.gif'
exclude '**/*.svg'
exclude '**/*.ico'
exclude '**/*.md'
exclude '**/*.mustache'
exclude '**/*.snap'
exclude '**/*.iml'
}
task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
source = fileTree('.')
}