This repository has been archived by the owner on Jan 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
build.gradle.kts
180 lines (151 loc) · 5.35 KB
/
build.gradle.kts
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
import java.util.concurrent.Callable
import java.time.Year
import net.ltgt.gradle.errorprone.errorprone
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
plugins {
`java-gradle-plugin`
`maven-publish`
groovy
id("com.gradle.plugin-publish") version "0.10.0"
id("com.github.sherter.google-java-format") version "0.8"
id("net.ltgt.errorprone") version "0.6"
id("com.github.hierynomus.license") version "0.15.0"
}
googleJavaFormat {
toolVersion = "1.7"
}
group = "net.ltgt.gradle"
if (JavaVersion.current().isJava9Compatible) {
tasks.withType<JavaCompile>().configureEach { options.compilerArgs.addAll(arrayOf("--release", "8")) }
tasks.withType<GroovyCompile>().configureEach { options.compilerArgs.addAll(arrayOf("--release", "8")) }
}
gradle.taskGraph.whenReady {
if (hasTask(":publishPlugins")) {
check("git diff --quiet --exit-code".execute(null, rootDir).waitFor() == 0) { "Working tree is dirty" }
val process = "git describe --exact-match".execute(null, rootDir)
check(process.waitFor() == 0) { "Version is not tagged" }
version = process.text.trim().removePrefix("v")
}
}
repositories {
mavenCentral()
jcenter() {
content {
onlyForConfigurations("ktlint")
includeModule("com.andreapivetta.kolor", "kolor")
}
}
}
dependencies {
errorprone("com.google.errorprone:error_prone_core:2.3.2")
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
annotationProcessor("com.uber.nullaway:nullaway:0.6.4")
testImplementation(localGroovy())
testImplementation("com.netflix.nebula:nebula-test:7.1.6")
testImplementation("org.spockframework:spock-core:1.1-groovy-2.4") {
exclude(group = "org.codehaus.groovy")
}
}
// See https://github.com/gradle/kotlin-dsl/issues/492
publishing {
repositories {
maven(url = "$buildDir/repository") {
name = "test"
}
}
}
tasks {
withType<JavaCompile>().configureEach {
options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror"))
options.errorprone.option("NullAway:AnnotatedPackages", "net.ltgt.gradle.apt")
}
jar {
from(Callable { project(":kotlin-extensions").sourceSets["main"].output })
}
val publishPluginsToTestRepository by registering {
dependsOn("publishPluginMavenPublicationToTestRepository")
dependsOn("publishAptPluginMarkerMavenPublicationToTestRepository")
dependsOn("publishAptEclipsePluginMarkerMavenPublicationToTestRepository")
dependsOn("publishAptIdeaPluginMarkerMavenPublicationToTestRepository")
}
test {
dependsOn(publishPluginsToTestRepository)
val testGradleVersion = project.findProperty("test.gradle-version")
testGradleVersion?.also { systemProperty("test.gradle-version", testGradleVersion) }
systemProperty("plugin.version", version)
testLogging {
showExceptions = true
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
}
}
}
gradlePlugin {
plugins {
register("apt") {
id = "net.ltgt.apt"
displayName = "Gradle APT plugin"
implementationClass = "net.ltgt.gradle.apt.AptPlugin"
}
register("aptEclipse") {
id = "net.ltgt.apt-eclipse"
displayName = "Gradle APT plugin (Eclipse integration)"
implementationClass = "net.ltgt.gradle.apt.AptEclipsePlugin"
}
register("aptIdea") {
id = "net.ltgt.apt-idea"
displayName = "Gradle APT plugin (IDEA integration)"
implementationClass = "net.ltgt.gradle.apt.AptIdeaPlugin"
}
}
}
pluginBundle {
website = "https://github.com/tbroyer/gradle-apt-plugin"
vcsUrl = "https://github.com/tbroyer/gradle-apt-plugin"
description = "Gradle plugin making it easier/safer to use Java annotation processors"
tags = listOf("annotation-processing", "annotation-processors", "apt")
mavenCoordinates {
groupId = project.group.toString()
artifactId = project.name
}
}
val ktlint by configurations.creating
dependencies {
ktlint("com.github.shyiko:ktlint:0.29.0")
}
tasks {
val verifyKtlint by registering(JavaExec::class) {
description = "Check Kotlin code style."
classpath = ktlint
main = "com.github.shyiko.ktlint.Main"
args("**/*.gradle.kts", "**/*.kt")
}
check {
dependsOn(verifyKtlint)
}
register("ktlint", JavaExec::class) {
description = "Fix Kotlin code style violations."
classpath = ktlint
main = "com.github.shyiko.ktlint.Main"
args("-F", "**/*.gradle.kts", "**/*.kt")
}
}
allprojects {
apply {
plugin("com.github.hierynomus.license")
}
license {
header = rootProject.file("LICENSE.header")
skipExistingHeaders = true
mapping("java", "SLASHSTAR_STYLE")
mapping("kt", "SLASHSTAR_STYLE")
exclude("**/default*.*")
(this as ExtensionAware).extra["year"] = Year.now()
(this as ExtensionAware).extra["name"] = "Thomas Broyer"
}
}
fun String.execute(envp: Array<String>?, workingDir: File?) =
Runtime.getRuntime().exec(this, envp, workingDir)
val Process.text: String
get() = inputStream.bufferedReader().readText()
apply(from = "gradle/circleci.gradle.kts")