forked from apache/groovy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
269 lines (233 loc) · 10.2 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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
buildscript {
repositories {
if (rootProject.hasProperty('buildInChina')) {
// Try to use Aliyun maven repository when building in China
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
}
jcenter()
// maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url 'https://jitpack.io'
}
}
dependencies {
//classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath "gradle.plugin.com.github.jk1:gradle-license-report:1.3"
}
}
plugins {
id 'me.champeau.buildscan-recipes' version '0.2.3'
id 'com.github.ben-manes.versions' version '0.36.0'
id 'com.github.blindpirate.osgi' version '0.0.4'
id 'org.sonarqube' version '3.0'
id 'org.apache.groovy-core'
id 'java-test-fixtures'
id 'org.apache.groovy-jacoco-aggregation'
}
buildScanRecipes {
recipe 'git-commit', baseUrl: 'https://github.com/apache/groovy/tree'
recipe 'teamcity', baseUrl: 'https://ci.groovy-lang.org', guest: 'true'
recipes 'git-status', 'gc-stats', 'teamcity', 'travis-ci'
}
archivesBaseName = 'groovy'
apply plugin: "com.github.jk1.dependency-license-report"
repositories {
// todo Some repos are needed only for some configs. Declare them just for the configuration once Gradle allows this.
maven { url 'https://repository.jboss.org/nexus/content/groups/m2-release-proxy' } // tools
}
groovyLibrary {
registerOptionalFeature 'gpars'
registerOptionalFeature 'grapes'
registerOptionalFeature 'xstreamAst'
registerOptionalFeature 'logging'
repackagedDependencies = [
'antlr', 'antlr-runtime', 'antlr4', 'antlr4-runtime', 'antlr4-annotations',
'asm', 'asm-commons', 'asm-tree', 'asm-util', 'picocli'
]
withGrooid(
"org.apache.groovy:groovy-grooid:${sharedConfiguration.groovyVersion.get()}",
['openbeans'] as Set,
[
'com.googlecode.openbeans.**': 'groovyjarjaropenbeans.@1',
'org.apache.harmony.beans.**': 'groovyjarjarharmonybeans.@1',
'java.beans.**': 'groovyjarjaropenbeans.@1'
],
[
'*': ['META-INF/NOTICE']
],
['META-INF/NOTICE', 'META-INF/INDEX.LIST'],
[
(rootProject.file('notices/NOTICE-GROOIDJARJAR').absolutePath): 'META-INF/NOTICE'
]
)
}
groovyCore {
bridgedClasses 'org.codehaus.groovy.runtime.DefaultGroovyMethods',
'org.codehaus.groovy.runtime.StringGroovyMethods',
'org.codehaus.groovy.classgen.Verifier',
'org.codehaus.groovy.ast.tools.GeneralUtils'
excludeFromJavadoc '**/GroovyRecognizer.java' // generated file
}
dependencies {
// for internal CLI usage
api "info.picocli:picocli:${versions.picocli}" // marked as api but manually excluded later in assemble.gradle - modules will use shaded version
// for internal usage of things like Opcode
api "org.ow2.asm:asm:${versions.asm}" // marked as api but manually excluded later in assemble.gradle - modules will use shaded version
// for internal usage by the parser but manually excluded later in assemble.gradle - modules will use shaded version
implementation "org.ow2.asm:asm-analysis:${versions.asm}"
implementation "org.ow2.asm:asm-commons:${versions.asm}"
implementation "org.ow2.asm:asm-tree:${versions.asm}"
implementation "org.ow2.asm:asm-util:${versions.asm}"
implementation "com.googlecode:openbeans:${versions.openbeans}"
implementation "com.tunnelvisionlabs:antlr4-runtime:${versions.antlr4}"
antlr "com.tunnelvisionlabs:antlr4:${versions.antlr4}"
loggingImplementation "org.fusesource.jansi:jansi:${versions.jansi}"
xstreamAstImplementation("com.thoughtworks.xstream:xstream:${versions.xstream}") {
exclude(group: 'xpp3', module: 'xpp3_min')
exclude(group: 'junit', module: 'junit')
exclude(group: 'jmock', module: 'jmock')
exclude(group: 'xmlpull', module: 'xmlpull')
}
grapesImplementation("org.apache.ivy:ivy:${versions.ivy}") {
transitive = false
}
gparsImplementation("org.codehaus.gpars:gpars:${versions.gpars}") {
exclude(group: 'org.codehaus.groovy', module: 'groovy-all')
}
testImplementation "jmock:jmock:${versions.jmock}"
testImplementation "jmock:jmock-cglib:${versions.jmock}"
testImplementation "ch.qos.logback:logback-classic:${versions.logback}"
testImplementation "log4j:log4j:${versions.log4j}"
testImplementation "org.apache.logging.log4j:log4j-core:${versions.log4j2}"
testImplementation "org.slf4j:jcl-over-slf4j:${versions.slf4j}"
testImplementation "com.thoughtworks.qdox:qdox:${versions.qdox}"
tools "org.pantsbuild:jarjar:${versions.jarjar}"
tools "org.jboss.bridger:bridger:${versions.bridger}"
tools("net.sourceforge.cobertura:cobertura:${versions.cobertura}") {
exclude(group: 'asm')
exclude(group: 'org.ow2.asm')
exclude(module: 'ant')
}
tools "org.ow2.asm:asm:${versions.asm}"
tools "com.thoughtworks.qdox:qdox:${versions.qdox}"
testImplementation project(':groovy-ant')
testImplementation project(':groovy-xml')
testImplementation project(':groovy-dateutil')
testImplementation project(':groovy-test')
testImplementation project(':groovy-macro')
testFixturesImplementation "xmlunit:xmlunit:${versions.xmlunit}"
testFixturesImplementation project(':groovy-test')
testFixturesImplementation project(':groovy-xml')
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0'
testImplementation "net.jcip:jcip-annotations:${versions.jcipAnnotations}"
testRuntimeOnly(project(":")) {
capabilities {
requireCapability 'org.apache.groovy:groovy-grapes'
}
}
}
configurations {
javadocClasspath.extendsFrom(
loggingImplementation,
xstreamAstImplementation,
gparsImplementation,
grapesImplementation
)
groovyCompilerClasspath {
extendsFrom(implementation, compileOnly, grapesImplementation, loggingImplementation, xstreamAstImplementation, runtimeOnly)
}
}
tasks.named('jar') {
metaInf {
from("$projectDir/licenses/LICENSE-JARJAR")
from("$projectDir/licenses") {
into('licenses')
include('asm-license.txt')
include('antlr4-license.txt')
}
from("$projectDir/notices/NOTICE-JARJAR")
rename '^([A-Z]+)-([^.]*)', '$1'
}
}
// some tests require Jars, but those are not allowed in the source directory
// by the Apache policy, so we need to build them and add them to the test
// resources classpath
def extModuleFixtureDir = project.layout.projectDirectory.dir("src/test-fixtures/extmodule")
def extModuleOutputDir = project.layout.buildDirectory.dir("testFixtures/extmodule")
def extModuleRepoDir = extModuleOutputDir.map { it.dir("repo") }
def compileTestExtensionModule = tasks.register("compileTestExtensionModule", JavaCompile) {
classpath = files(tasks.named('jar'))
source fileTree(extModuleFixtureDir.dir("src/main/java"))
destinationDirectory = extModuleOutputDir.map { it.dir("classes") }
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
def testExtensionModuleJar = tasks.register("testExtensionModuleJar", Jar) {
description = 'Builds a sample extension module used in tests'
archiveBaseName = 'module-test'
archiveVersion = '1.4'
from compileTestExtensionModule
from extModuleFixtureDir.dir("src/main/resources")
// emulate Maven repo format for output
destinationDirectory = extModuleRepoDir.map { it.dir("jars/module-test/module-test/${archiveVersion.get()}") }
}
dependencies {
testRuntimeOnly files(extModuleRepoDir)
}
tasks.named('test') {
dependsOn testExtensionModuleJar
}
if (!JavaVersion.current().java9Compatible) {
logger.lifecycle '''
**************************************** WARNING ********************************************
****** You are running the build with an older JDK. NEVER try to release with 1.8. ******
****** You must use a JDK 1.9+ in order to compile all features of the language. ******
*********************************************************************************************
'''
}
apply from: 'gradle/licenses.gradle'
// CC: This can probably be removed as the native IDEA import
// works pretty nice, but it's up to the Groovy devs to decide
apply from: 'gradle/idea.gradle'
apply from: 'gradle/eclipse.gradle'
// If a local configuration file for tweaking the build is present, apply it
if (file('user.gradle').exists()) {
apply from: 'user.gradle'
}
licenseReport {
excludeGroups = [
'com.googlecode', // openbeans has no pom but is ASLv2
'org.multiverse' // we never include this optional dependency of an optional dependency
]
}
sonarqube {
properties {
property "sonar.projectName", "Apache Groovy"
property "sonar.projectKey", "apache_groovy"
property "sonar.organization", "apache"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.cpd.exclusions", "**/*"
// property "sonar.coverage.jacoco.xmlReportPaths", "${rootProject.buildDir}/reports/jacoco/jacocoAllReport/jacocoAllReport.xml"
}
}