-
Notifications
You must be signed in to change notification settings - Fork 87
/
build.gradle
191 lines (162 loc) · 4.75 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
plugins {
id 'checkstyle'
id 'eclipse'
id 'java-gradle-plugin'
id 'maven-publish'
id 'io.spring.javaformat' version '0.0.39'
id 'io.spring.nohttp' version '0.0.10'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
}
group = 'io.spring.gradle'
description = 'Dependency Management Plugin'
ext {
cglibVersion = '3.1'
jarjarVersion = '1.2.1'
mavenVersion = '3.8.7'
}
repositories {
mavenCentral()
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}
gradlePlugin {
plugins {
dependencyManagement {
displayName = 'Dependency management plugin'
description = 'A Gradle plugin that provides Maven-like dependency management functionality'
id = 'io.spring.dependency-management'
implementationClass = 'io.spring.gradle.dependencymanagement.DependencyManagementPlugin'
}
}
}
checkstyle {
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
configProperties = [ 'checkstyle.config.dir' : rootProject.file('config/checkstyle') ]
}
configurations {
asciidoctorExt
jarjar
maven
}
def mavenRepackJar = tasks.register("mavenRepackJar", Jar) { repackJar ->
repackJar.archiveBaseName = "maven-repack"
repackJar.archiveVersion = mavenVersion
doLast() {
project.ant {
taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask", classpath: configurations.jarjar.asPath
jarjar(destfile: repackJar.archivePath) {
configurations.maven.each { originalJar ->
zipfileset(src: originalJar)
}
rule(pattern: 'org.**', result: 'io.spring.gradle.dependencymanagement.org.@1')
}
}
}
}
dependencies {
asciidoctorExt 'io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.4'
checkstyle 'io.spring.javaformat:spring-javaformat-checkstyle:0.0.39'
implementation(files(mavenRepackJar))
jarjar "org.gradle.jarjar:jarjar:$jarjarVersion"
maven "org.apache.maven:maven-model-builder:$mavenVersion"
testImplementation "cglib:cglib-nodep:$cglibVersion"
testImplementation "org.assertj:assertj-core:3.23.1"
testImplementation "org.mockito:mockito-core:4.6.1"
testImplementation "org.junit.jupiter:junit-jupiter:5.8.2"
}
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
java {
withJavadocJar()
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs.addAll "-Werror", "-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:rawtypes", "-Xlint:varargs"
}
tasks.named("test").configure {
useJUnitPlatform()
}
tasks.named("jar").configure {
from(zipTree(mavenRepackJar.map { it.archivePath })) {
include 'io/spring/gradle/**'
include 'META-INF/plexus/**'
}
manifest {
attributes(
'Created-By': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})".toString(),
'Implementation-Title': project.description,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Pivotal Software, Inc.'
)
}
}
tasks.named("javadoc").configure {
title = "$project.description $project.version API"
exclude 'io/spring/gradle/dependencymanagement/internal/**'
options {
links "https://docs.gradle.org/${project.gradle.gradleVersion}/javadoc/",
'https://docs.oracle.com/javase/8/docs/api/'
}
}
asciidoctorj {
fatalWarnings ".*"
}
tasks.named("asciidoctor").configure {
baseDirFollowsSourceDir()
configurations 'asciidoctorExt'
outputOptions {
backends "spring-html"
}
}
tasks.register("docsZip", Zip) {
group = 'Distribution'
archiveBaseName = 'dependency-management-plugin'
archiveClassifier = 'docs'
description = "Builds docs archive containing API and reference documentation"
destinationDirectory = file("${project.buildDir}/distributions")
from(tasks.named("asciidoctor")) {
into 'reference/html'
}
from(tasks.named("javadoc")) {
into 'api'
}
}
publishing {
publications.all {
pom {
name = 'Dependency management plugin'
description = 'A Gradle plugin that provides Maven-like dependency management functionality'
url = 'https://github.com/spring-gradle-plugins/dependency-management-plugin'
organization {
name = 'VMware, Inc.'
url = 'https://spring.io'
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
url = 'https://github.com/spring-gradle-plugins/dependency-management-plugin'
connection = 'scm:git:https://github.com/spring-gradle-plugins/dependency-management-plugin'
}
developers {
developer {
id = 'wilkinsona'
name = 'Andy Wilkinson'
email = 'wilkinsona@vmware.com'
roles = ["Project lead"]
}
}
}
if (name == "pluginMaven") {
artifact tasks.named("docsZip")
}
}
if (project.hasProperty("deploymentRepository")) {
repositories.maven {
url = "$deploymentRepository"
name = "deployment"
}
}
}