Skip to content

Commit 6968298

Browse files
committed
chore: #14886 add licensing plugin to grails-forge
1 parent 1982553 commit 6968298

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

gradle/dependency-licenses.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
apply plugin: 'com.github.hierynomus.license-report'
2121

2222
List<String> licenseExclusions = rootProject.subprojects.collect {
23-
"org.grails:${it.name}:${rootProject.projectVersion}" as String
23+
"org.apache.grails:${it.findProperty('pomArtifactId') ?: it.name}:${rootProject.projectVersion}" as String
2424
}
2525

2626
downloadLicenses {

grails-forge/build.gradle

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ file('../gradle.properties').withInputStream {
2828
}
2929

3030
ext {
31+
isReproducibleBuild = System.getenv("SOURCE_DATE_EPOCH") != null
3132
buildInstant = java.util.Optional.ofNullable(System.getenv('SOURCE_DATE_EPOCH'))
3233
.map(Long::parseLong)
3334
.map(Instant::ofEpochSecond)
@@ -41,7 +42,7 @@ ext {
4142

4243
allprojects {
4344
props.forEach { k, v ->
44-
if(!project.hasProperty(k as String)) {
45+
if (!project.hasProperty(k as String)) {
4546
project.ext.set(k as String, v)
4647
}
4748
}
@@ -72,6 +73,18 @@ allprojects {
7273
}
7374
}
7475

76+
subprojects {
77+
configurations.configureEach {
78+
resolutionStrategy {
79+
def cacheHours = isCiBuild || isReproducibleBuild ? 0 : 24
80+
cacheDynamicVersionsFor(cacheHours, 'hours')
81+
cacheChangingModulesFor(cacheHours, 'hours')
82+
}
83+
}
84+
85+
apply from: rootProject.layout.projectDirectory.file('gradle/dependency-licenses.gradle')
86+
}
87+
7588
apply {
7689
// we must apply the publish configuration first or the docs config will not work
7790
from layout.projectDirectory.file('gradle/publish-root-config.gradle')

grails-forge/buildSrc/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ configurations.configureEach {
6464
}
6565

6666
dependencies {
67+
implementation "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:${rootProperties.gradleLicensePluginVersion}", {
68+
// Due to https://github.com/hierynomus/license-gradle-plugin/issues/161, spring must be excluded
69+
exclude group: 'org.springframework', module: 'spring-core'
70+
}
6771
implementation "io.micronaut.build.internal:micronaut-gradle-plugins:$micronautGradlePlugins"
6872
implementation "com.fizzed:rocker-compiler:$rockerVersion"
6973
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* https://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
apply plugin: 'com.github.hierynomus.license-report'
21+
22+
List<String> licenseExclusions = rootProject.subprojects.collect {
23+
"org.apache.grails:${it.findProperty('pomArtifactId') ?: it.name}:${rootProject.projectVersion}" as String
24+
}
25+
26+
downloadLicenses {
27+
includeProjectDependencies = true
28+
dependencyConfiguration = 'runtimeClasspath'
29+
excludeDependencies = licenseExclusions
30+
}

0 commit comments

Comments
 (0)