This repository has been archived by the owner on Sep 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
193 lines (168 loc) · 4.97 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
181
182
183
184
185
186
187
188
189
190
191
192
193
// Copyright (c) 2020-2021 Yinsen (Tesla) Zhang.
// Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file.
import org.apache.tools.ant.taskdefs.condition.Os
import java.util.*
plugins {
java
jacoco
idea
`java-library`
`maven-publish`
signing
id("org.beryx.jlink") version "2.24.1" apply false
}
var deps: Properties by rootProject.ext
deps = Properties()
file("gradle/deps.properties").reader().use(deps::load)
allprojects {
group = "org.aya-prover"
version = deps.getProperty("version.project")
}
subprojects {
val useJacoco = name in listOf("base", "pretty")
apply {
plugin("java")
plugin("idea")
if (useJacoco) plugin("jacoco")
plugin("maven-publish")
plugin("java-library")
plugin("signing")
}
java {
withSourcesJar()
if (hasProperty("release")) withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
if (useJacoco) jacoco {
toolVersion = deps.getProperty("version.jacoco")
}
idea.module {
outputDir = file("out/production")
testOutputDir = file("out/test")
}
tasks.withType<JavaCompile>().configureEach {
modularity.inferModulePath.set(true)
options.apply {
encoding = "UTF-8"
isDeprecation = true
release.set(17)
compilerArgs.addAll(listOf("-Xlint:unchecked", "--enable-preview"))
}
}
tasks.withType<Javadoc>().configureEach {
val options = options as StandardJavadocDocletOptions
options.addBooleanOption("-enable-preview", true)
options.addStringOption("-source", "17")
options.encoding("UTF-8")
options.tags(
"apiNote:a:API Note:",
"implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:",
)
}
artifacts {
add("archives", tasks["sourcesJar"])
if (hasProperty("release")) add("archives", tasks["javadocJar"])
}
if (useJacoco) tasks.jacocoTestReport {
dependsOn(tasks.test)
reports { configureReports(false) }
}
tasks.withType<Test>().configureEach {
jvmArgs = listOf("--enable-preview")
useJUnitPlatform()
enableAssertions = true
reports.junitXml.mergeReruns.set(true)
}
tasks.withType<JavaExec>().configureEach {
jvmArgs = listOf("--enable-preview")
enableAssertions = true
}
if (hasProperty("ossrhUsername")) publishing.repositories {
maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2") {
name = "MavenCentral"
credentials {
username = property("ossrhUsername").toString()
password = property("ossrhPassword").toString()
}
}
}
val proj = this@subprojects
publishing.publications {
create<MavenPublication>("maven") {
val githubUrl = "https://github.com/aya-prover/aya-dev"
groupId = proj.group.toString()
version = proj.version.toString()
artifactId = proj.name
from(components["java"])
pom {
description.set("The Aya proof assistant")
name.set(proj.name)
url.set("https://www.aya-prover.org")
licenses {
license {
name.set("GPL-3.0")
url.set("$githubUrl/blob/master/LICENSE")
}
}
developers {
developer {
id.set("ice1000")
name.set("Tesla Ice Zhang")
email.set("[email protected]")
}
developer {
id.set("imkiva")
name.set("Kiva Oyama")
email.set("[email protected]")
}
developer {
id.set("re-xyr")
name.set("Xy Ren")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:$githubUrl")
url.set(githubUrl)
}
}
}
}
if (hasProperty("signing.keyId")) signing {
sign(publishing.publications["maven"])
}
}
val mergeJacocoReports = tasks.register<JacocoReport>("mergeJacocoReports") {
group = "verification"
subprojects.forEach { subproject ->
subproject.plugins.withType<JacocoPlugin>().configureEach {
subproject.tasks.matching { it.extensions.findByType<JacocoTaskExtension>() != null }.configureEach {
sourceSets(subproject.sourceSets.main.get())
executionData(this)
}
subproject.tasks.matching { it.extensions.findByType<JacocoTaskExtension>() != null }.forEach {
dependsOn(it)
}
}
}
reports { configureReports(true) }
doLast {
if (Os.isFamily(Os.FAMILY_WINDOWS) && System.getenv("CI") != "true") exec {
commandLine("explorer.exe", ".\\build\\reports\\jacoco\\mergeJacocoReports\\html\\index.html")
}
}
}
tasks.register("githubActions") {
group = "verification"
dependsOn(mergeJacocoReports, tasks.findByPath(":lsp:jlink"))
}
tasks.withType<Sync>().configureEach {
dependsOn(tasks.findByPath(":buildSrc:copyModuleInfo"))
}
fun JacocoReportsContainer.configureReports(merger: Boolean) {
xml.required.set(true)
csv.required.set(false)
html.required.set(merger)
}