forked from nebula-plugins/gradle-dependency-lock-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
143 lines (125 loc) · 4.91 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* Copyright 2014-2019 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.gradle.util.GradleVersion
plugins {
id 'nebula.plugin-plugin' version '16.2.0'
id 'nebula.optional-base' version '3.1.0'
id "org.jetbrains.kotlin.jvm" version "1.5.30"
id 'java-gradle-plugin'
id "org.gradle.test-retry" version "1.3.1"
}
description 'Gradle plugin to allow locking of dynamic dependency versions'
group = 'com.netflix.nebula'
contacts {
moniker 'Nebula Plugins Maintainers'
github 'nebula-plugins'
}
}
dependencies {
implementation 'com.squareup.moshi:moshi:1.+'
implementation 'joda-time:joda-time:2.10'
implementation 'com.netflix.nebula:nebula-gradle-interop:latest.release'
implementation 'com.netflix.nebula:gradle-scm-plugin:latest.release'
implementation('com.netflix.nebula:nebula-dependencies-comparison:latest.release') {
exclude module: 'groovy-all'
}
implementation enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.9.10.+")
testImplementation 'com.netflix.nebula:gradle-git-scm-plugin:latest.release'
testImplementation 'com.netflix.nebula:nebula-project-plugin:latest.release'
testImplementation 'com.netflix.nebula:nebula-test:latest.release'
testImplementation gradleTestKit()
testImplementation('org.ajoberstar.grgit:grgit-core:4.1.0') {
exclude group: 'org.codehaus.groovy', module: 'groovy'
}
testImplementation "com.github.tomakehurst:wiremock:2.17.0"
testImplementation 'com.github.stefanbirkner:system-rules:1.19.0'
}
gradlePlugin {
plugins {
dependencyLock {
id = 'nebula.dependency-lock'
implementationClass = 'nebula.plugin.dependencylock.DependencyLockPlugin'
}
}
}
pluginBundle {
website = 'https://github.com/nebula-plugins/gradle-dependency-lock-plugin'
vcsUrl = 'https://github.com/nebula-plugins/gradle-dependency-lock-plugin.git'
description = 'Plugin to lock dynamic dependencies'
plugins {
dependencyLock {
id = 'nebula.dependency-lock'
displayName = 'Nebula Dependency Lock plugin'
description = 'Plugin to lock dynamic dependencies'
tags = ['nebula', 'dependencies', 'lock']
}
}
}
// Kotlin compiles first, stubbing Java dependencies, however it can't stub Groovy and we need to call Groovy code from Kotlin. For details see:
// https://discuss.gradle.org/t/kotlin-groovy-and-java-compilation/14903/10
if (GradleVersion.version(project.gradle.gradleVersion) >= (GradleVersion.version('6.1'))) {
tasks.named('compileGroovy') {
// Groovy only needs the declared dependencies
// and not the output of compileJava
classpath = sourceSets.main.compileClasspath
}
tasks.named('compileKotlin') {
// Kotlin also depends on the result of Groovy compilation
// which automatically makes it depend of compileGroovy
classpath += files(sourceSets.main.groovy.classesDirectory)
}
} else {
compileGroovy.dependsOn = compileGroovy.taskDependencies.mutableValues - 'compileJava'
compileKotlin.dependsOn compileGroovy
compileKotlin.classpath += files(compileGroovy.destinationDir)
classes.dependsOn compileKotlin
}
tasks.withType(Test) {
testLogging {
events "PASSED", "FAILED", "SKIPPED"
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
retry {
maxRetries = 2
maxFailures = 20
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
idea {
project {
jdkName = '1.8'
languageLevel = '1.8'
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = '1.8'
}
}
tasks.withType(GenerateModuleMetadata).configureEach {
suppressedValidationErrors.add('enforced-platform')
}