-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
220 lines (190 loc) · 6.96 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
plugins {
id "java-gradle-plugin"
id "maven-publish"
id "idea"
id "jacoco"
id "com.gradle.plugin-publish" version "1.2.1"
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id "org.sonarqube" version "5.1.0.4882"
id "be.vbgn.ci-detect" version "0.5.0"
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
group 'eu.xenit.gradle'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
configurations {
packaged
compileOnly.extendsFrom(packaged)
testImplementation.extendsFrom(packaged)
integrationTestImplementation.extendsFrom testImplementation
}
sourceSets {
main {
java {
runtimeClasspath += configurations.packaged
}
}
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
}
idea {
module {
testSourceDirs += sourceSets.integrationTest.java.sourceDirectories
testResourceDirs += sourceSets.integrationTest.resources.srcDirs
}
}
gradlePlugin {
plugins {
dockerAlfresco {
id = "eu.xenit.docker-alfresco"
implementationClass = "eu.xenit.gradle.docker.alfresco.DockerAlfrescoPlugin"
description = "Plugin that facilitates the creation of docker images for Alfresco and Share with custom modules"
}
dockerConfig {
id = "eu.xenit.docker-config"
implementationClass = "eu.xenit.gradle.docker.config.DockerConfigPlugin"
description = "Plugin that configures the communication with the docker daemon and registries"
}
docker {
id = "eu.xenit.docker"
implementationClass = "eu.xenit.gradle.docker.core.DockerPlugin"
description = "Plugin that enables you to build docker images"
}
dockerCompose {
id = "eu.xenit.docker-compose"
implementationClass = "eu.xenit.gradle.docker.compose.DockerComposePlugin"
description = "Plugin that enables running docker-compose setups from Gradle"
}
dockerComposeAuto {
id = "eu.xenit.docker-compose.auto"
implementationClass = "eu.xenit.gradle.docker.compose.DockerComposeAutoPlugin"
description = "This plugin is an extension of eu.xenit.docker-compose that automatically uses dockerCompose.fromProject() for all projects in your Gradle build."
}
}
testSourceSets(sourceSets.test, sourceSets.integrationTest)
}
gradlePlugin {
vcsUrl = "https://github.com/xenit-eu/alfresco-docker-gradle-plugin"
website = vcsUrl
description = "A gradle plugin to create Alfresco docker images with extensions"
plugins {
dockerAlfresco {
displayName = "Alfresco docker plugin"
tags.set(["alfresco", "docker"])
}
dockerConfig {
displayName = "Docker configuration plugin"
tags.set(["alfresco", "docker"])
}
docker {
displayName = "Docker plugin"
tags.set(["alfresco", "docker"])
}
dockerCompose {
displayName = "docker-compose plugin"
tags.set(["alfresco", "docker"])
}
dockerComposeAuto {
displayName = "docker-compose plugin: automatic configuration for all projects"
tags.set(["alfresco", "docker"])
}
}
}
repositories {
mavenCentral()
gradlePluginPortal()
maven {
url "https://artifacts.alfresco.com/nexus/content/groups/public/"
}
}
dependencies {
packaged 'org.alfresco:alfresco-mmt:6.0'
packaged group: 'commons-io', name: 'commons-io', version: '2.16.1'
packaged('org.eclipse.jgit:org.eclipse.jgit:6.10.0.202406032230-r') {
exclude group: 'org.slf4j'
}
implementation 'com.bmuschko:gradle-docker-plugin:9.3.1'
implementation 'com.avast.gradle:gradle-docker-compose-plugin:0.17.7'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation 'org.hamcrest:hamcrest-core:3.0'
testImplementation gradleTestKit()
testImplementation "org.mockito:mockito-core:5.+"
testImplementation 'com.github.stefanbirkner:system-rules:1.19.0'
}
task shadowJar(type: ShadowJar) {
from sourceSets.main.output
configurations = [project.configurations.packaged]
archiveClassifier = "shadow"
mergeServiceFiles()
exclude "META-INF/*.SF"
exclude "META-INF/*.RSA"
}
task configureShadowJar(type: ConfigureShadowRelocation) {
target = shadowJar
prefix = "eu.xenit.gradle.docker.internal.shadow"
}
shadowJar.dependsOn(configureShadowJar)
jar {
from zipTree(shadowJar.outputs.files.singleFile)
dependsOn(shadowJar)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
pluginUnderTestMetadata {
pluginClasspath.from(configurations.packaged)
}
import org.gradle.util.GradleVersion
task integrationTest(type: Test, group: "verification") {
useJUnit()
if (project.hasProperty("integrationTestGradleVersions")) {
// This is used for sharding integration tests across different gradle versions
// to avoid a timeout on travis because the total build takes too long.
// See also the .travis.yml file
project.property("integrationTestGradleVersions").tokenize(",").forEach({ version ->
// The versions specified in `integrationTestGradleVersions` are major.minor.
// We only want it to match those, and eventual patches to those versions.
// In particular, we want 4.1 to match 4.1.2, but not 4.10.
// Since there is only one test parameter for every version, either the first
// pattern matches major.minor, or the second pattern matches major.minor.patch
filter.includeTestsMatching("*[Gradle v${version}]")
filter.includeTestsMatching("*[Gradle v${version}.*]")
})
}
doFirst {
if (gradle.startParameter.offline) {
systemProperty "eu.xenit.gradle.integration.useGradleVersion", GradleVersion.current().version
}
}
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
shouldRunAfter(test)
}
jacocoTestReport {
dependsOn(test, integrationTest)
executionData(test, integrationTest)
reports {
xml.enabled = true
}
}
sonarqube {
properties {
properties["sonar.tests"] += sourceSets.integrationTest.java.srcDirs
if (ci.isPullRequest()) {
properties["sonar.pullrequest.key"] = ci.pullRequest
properties["sonar.pullrequest.branch"] = ci.branch
properties["sonar.pullrequest.base"] = ci.pullRequestTargetBranch
} else {
properties["sonar.branch.name"] = ci.reference
}
}
}
check.dependsOn(integrationTest)
reckonTagCreate.dependsOn(check)
tasks.sonarqube.dependsOn(check, jacocoTestReport)