-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle.kts
151 lines (131 loc) · 4.41 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
base
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.serialization)
id("java-library")
id("maven-publish")
publishing
signing
id("jacoco-report-aggregation")
}
jacoco {
toolVersion = "0.8.8"
}
allprojects {
apply(plugin = "java")
apply(plugin = "jacoco")
repositories {
mavenCentral()
mavenLocal()
google()
}
group = "cc.unitmesh"
version = "0.4.0"
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
}
tasks.jacocoTestReport {
reports {
xml.required.set(true)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml"))
}
}
}
configure(allprojects
- project(":")
- project(":examples")
- project(":examples:project-example")
- project(":unit-gen")
) {
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "signing")
apply(plugin = "publishing")
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set("UnitGen")
description.set("Unit Mesh Eval")
url.set("https://github.com/unit-mesh/")
licenses {
license {
name.set("MIT")
url.set("https://raw.githubusercontent.com/unit-mesh/unit-gen/master/LICENSE")
}
}
licenses {
license {
name.set("MIT")
url.set("https://github.com/unit-mesh/unit-gen/raw/master/LICENSE")
}
}
developers {
developer {
id.set("Unit Mesh")
name.set("UnitMesh Team")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/unit-mesh/unit-gen.git")
developerConnection.set("scm:git:ssh://github.com/unit-mesh/unit-gen.git")
url.set("https://github.com/unit-mesh/unit-gen/")
}
}
}
}
repositories {
maven {
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = (
if (project.findProperty("sonatypeUsername") != null) project.findProperty("sonatypeUsername") else System.getenv(
"MAVEN_USERNAME"
)).toString()
password = (
if (project.findProperty("sonatypePassword") != null) project.findProperty("sonatypePassword") else System.getenv(
"MAVEN_PASSWORD"
)).toString()
}
}
}
}
signing {
sign(publishing.publications["mavenJava"])
}
java {
withJavadocJar()
withSourcesJar()
}
}