-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathbuild.gradle.kts
165 lines (140 loc) · 5.15 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
plugins {
base
val kotlinVersion = "1.9.0"
kotlin("jvm") version kotlinVersion apply false
kotlin("plugin.serialization") version "1.6.10"
id("java-library")
id("maven-publish")
publishing
signing
java
id("jacoco-report-aggregation")
id("com.github.kt3k.coveralls") version "2.9.0"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
jacoco {
toolVersion = "0.8.7"
}
allprojects {
apply(plugin = "java")
group = "com.phodal.chapi"
version = "2.5.1"
description =
"Chapi is A common hierarchical abstract parser && information convertor, streamlines code analysis by converting diverse language source code into a unified abstract model, simplifying cross-language development."
repositories {
mavenCentral()
mavenLocal()
}
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
}
subprojects {
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "signing")
apply(plugin = "publishing")
apply(plugin = "jacoco")
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set("Chapi")
description.set("Chapi is A common language meta information convertor, convert different languages to same meta-data model")
url.set("https://github.com/phodal/chapi")
licenses {
license {
name.set("MPL 2.0")
url.set("https://github.com/phodal/chapi/blob/master/LICENSE")
}
}
developers {
developer {
id.set("Modernizing")
name.set("Modernizing Team")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/phodal/chapi.git")
developerConnection.set("scm:git:ssh://github.com/phodal/chapi.git")
url.set("https://github.com/phodal/chapi/")
}
}
}
}
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()
}
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(false)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml"))
}
}
tasks.withType<JacocoReport> {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.map {
fileTree(it).apply {
exclude("chapi/ast/antlr")
}
}))
}
}
}
dependencies {
jacocoAggregation(project(":chapi-domain"))
jacocoAggregation(project(":chapi-ast-java"))
jacocoAggregation(project(":chapi-ast-typescript"))
jacocoAggregation(project(":chapi-ast-go"))
jacocoAggregation(project(":chapi-ast-python"))
jacocoAggregation(project(":chapi-ast-c"))
jacocoAggregation(project(":chapi-ast-csharp"))
jacocoAggregation(project(":chapi-ast-kotlin"))
jacocoAggregation(project(":chapi-ast-scala"))
jacocoAggregation(project(":chapi-ast-cpp"))
jacocoAggregation(project(":chapi-ast-protobuf"))
jacocoAggregation(project(":chapi-parser-toml"))
jacocoAggregation(project(":chapi-parser-cmake"))
}
reporting {
reports {
val jacocoRootReport by creating(JacocoCoverageReport::class) {
testType.set(TestSuiteType.UNIT_TEST)
}
}
}
tasks.check {
dependsOn(tasks.named<JacocoReport>("jacocoRootReport"))
}