-
Notifications
You must be signed in to change notification settings - Fork 113
/
build.gradle
229 lines (192 loc) · 6.45 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
// First, apply the publishing plugin
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
jcenter()
}
}
dependencies {
classpath "com.gradle.publish:plugin-publish-plugin:0.9.1"
classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:2.2.+'
}
}
plugins {
id 'groovy'
id 'idea'
id 'pl.allegro.tech.build.axion-release' version '1.11.0'
id 'com.gradle.plugin-publish' version '0.14.0'
id 'java-gradle-plugin'
id 'ru.vyarus.animalsniffer' version '1.5.3'
}
apply plugin: 'com.github.hierynomus.license'
defaultTasks 'build'
group = 'com.hierynomus.gradle.plugins'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
maven { url 'https://jitpack.io' }
mavenCentral()
google()
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
scmVersion {
tag {
prefix = 'v'
versionSeparator = ''
}
hooks {
pre 'fileUpdate', [file: 'README.adoc', pattern: { v, c -> /:license_plugin_version .*/}, replacement: { v, c -> ":license_plugin_version: $v" }]
pre 'commit'
}
}
project.version = scmVersion.version
configurations.implementation.transitive = false
sourceSets.create("integrationTest")
dependencies {
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
implementation "org.codehaus.plexus:plexus-utils:2.0.5"
implementation "com.mycila.xmltool:xmltool:3.3"
// Using implementation instead of groovy, so that it goes into the pom
implementation ('com.mycila:license-maven-plugin:3.0') {
exclude group: 'org.apache.maven', module: 'maven-plugin-api'
exclude group: 'org.apache.maven', module: 'maven-project'
}
implementation gradleApi()
def androidGradlePlugin = 'com.android.tools.build:gradle:4.1.0'
compileOnly androidGradlePlugin
testImplementation androidGradlePlugin
integrationTestImplementation(project)
integrationTestImplementation gradleTestKit()
integrationTestImplementation platform("org.spockframework:spock-bom:2.0-M5-groovy-3.0")
integrationTestImplementation 'com.netflix.nebula:nebula-test:8.1.0'
integrationTestImplementation 'org.spockframework:spock-core'
integrationTestImplementation 'org.spockframework:spock-junit4'
integrationTestImplementation 'junit:junit:4.13.1'
integrationTestImplementation 'com.google.guava:guava:17.0'
testImplementation gradleTestKit()
testImplementation 'com.netflix.nebula:nebula-test:8.1.0'
testImplementation platform("org.spockframework:spock-bom:2.0-M5-groovy-3.0")
testImplementation 'org.spockframework:spock-core'
testImplementation 'org.spockframework:spock-junit4'
testImplementation 'junit:junit:4.13.1'
testImplementation 'com.google.guava:guava:17.0'
}
def integrationTestTask = tasks.register("integrationTest", Test) {
description = 'Runs the integration tests.'
group = "verification"
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
mustRunAfter(tasks.named('test'))
useJUnitPlatform()
}
tasks.named('check') {
it.dependsOn(integrationTestTask)
}
// This disables the pedantic doclint feature of JDK8
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
license {
ignoreFailures true
}
tasks.withType(Test).all { t ->
t.afterSuite { descriptor, result ->
def indicator = "\u001B[32m✓\u001b[0m"
if (result.failedTestCount > 0) {
indicator = "\u001B[31m✘\u001b[0m"
}
logger.lifecycle("$indicator Test ${descriptor.name}; Executed: ${result.testCount}/\u001B[32m${result.successfulTestCount}\u001B[0m/\u001B[31m${result.failedTestCount}\u001B[0m")
}
}
def pomConfig = {
name project.name
description project.project_description
url project.project_url
inceptionYear '2011'
scm { url project.project_scm }
licenses {
license([:]) {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'hierynomus'
name 'Jeroen van Erp'
url 'http://www.javadude.nl/'
email '[email protected]'
roles { role 'Developer' }
}
}
contributors {
contributor {
name 'Tim Harsch'
email '[email protected]'
}
contributor {
name 'Justin Ryan'
email '[email protected]'
}
}
}
gradlePlugin {
plugins {
licensePlugin {
id = "com.github.hierynomus.license"
implementationClass = "nl.javadude.gradle.plugins.license.LicensePlugin"
}
licenseBasePlugin {
id = "com.github.hierynomus.license-base"
implementationClass = "com.hierynomus.gradle.license.LicenseBasePlugin"
}
licenseReportPlugin {
id = "com.github.hierynomus.license-report"
implementationClass = "com.hierynomus.gradle.license.LicenseReportingPlugin"
}
}
}
pluginBundle {
website = "https://github.com/hierynomus/license-gradle-plugin"
vcsUrl = "https://github.com/hierynomus/license-gradle-plugin.git"
tags = ["gradle", "plugin", "license"]
plugins {
licensePlugin {
displayName = "License plugin for Gradle"
description = "Applies a header to files, typically a license"
}
licenseBasePlugin {
displayName = "Base License plugin for Gradle"
description = "Base plugin to apply a header to files, typically a license"
}
licenseReportPlugin {
displayName = "License Report plugin for Gradle"
description = "Reports over licenses"
tags = [ "gradle", "plugin", "license", "report" ]
}
}
}
if (!System.env.containsKey("JENKINS_URL")) {
def javaVersion = System.properties['java.version']
if (JavaVersion.toVersion(javaVersion) != project.targetCompatibility) {
// throw new GradleException("Expected Java version ${project.targetCompatibility} but running with $javaVersion")
}
}