-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuild.gradle.kts
177 lines (159 loc) · 4.76 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
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jmailen.gradle.kotlinter.tasks.FormatTask
import org.jmailen.gradle.kotlinter.tasks.LintTask
plugins {
`maven-publish`
alias(libs.plugins.kotlin.dokka)
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.kotlinter)
alias(libs.plugins.maven.publish)
alias(libs.plugins.protobuf.gradle)
id("jacoco")
id("signing")
projectversiongen
steamlanguagegen
rpcinterfacegen
}
allprojects {
group = "in.dragonbra"
version = "1.6.0-SNAPSHOT"
}
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.toVersion(libs.versions.java.get())
targetCompatibility = JavaVersion.toVersion(libs.versions.java.get())
withSourcesJar()
}
/* Protobufs */
protobuf.protoc {
artifact = libs.protobuf.protoc.get().toString()
}
/* Testing */
tasks.test {
useJUnitPlatform()
testLogging {
events = setOf(
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
)
}
}
/* Test Reporting */
jacoco.toolVersion = libs.versions.jacoco.get()
tasks.jacocoTestReport {
reports {
xml.required = false
html.required = false
}
}
/* Java-Kotlin Docs */
dokka {
moduleName.set("JavaSteam")
dokkaSourceSets.main {
suppressGeneratedFiles.set(false) // Allow generated files to be documented.
perPackageOption {
// Deny most of the generated files.
matchingRegex.set("in.dragonbra.javasteam.(protobufs|enums|generated).*")
suppress.set(true)
}
}
}
// Make sure Maven Publishing gets javadoc
val javadocJar by tasks.registering(Jar::class) {
dependsOn(tasks.dokkaGenerate)
archiveClassifier.set("javadoc")
from(layout.buildDirectory.dir("dokka/html"))
}
artifacts {
archives(javadocJar)
}
/* Configuration */
configurations {
configureEach {
// Only allow junit 5
exclude("junit", "junit")
exclude("org.junit.vintage", "junit-vintage-engine")
}
}
/* Source Sets */
sourceSets.main {
java.srcDirs(
// builtBy() fixes gradle warning "Execution optimizations have been disabled for task"
files("build/generated/source/steamd/main/java").builtBy("generateSteamLanguage"),
files("build/generated/source/javasteam/main/java").builtBy("generateProjectVersion", "generateRpcMethods")
)
}
/* Dependencies */
tasks["lintKotlinMain"].dependsOn("formatKotlin")
tasks["check"].dependsOn("jacocoTestReport")
tasks["compileJava"].dependsOn("generateSteamLanguage", "generateProjectVersion", "generateRpcMethods")
// tasks["build"].finalizedBy("dokkaGenerate")
/* Kotlinter */
tasks.withType<LintTask> {
this.source = this.source.minus(fileTree("build/generated")).asFileTree
}
tasks.withType<FormatTask> {
this.source = this.source.minus(fileTree("build/generated")).asFileTree
}
dependencies {
implementation(libs.commons.io)
implementation(libs.commons.lang3)
implementation(libs.commons.validator)
implementation(libs.gson)
implementation(libs.kotlin.coroutines)
implementation(libs.kotlin.stdib)
implementation(libs.okHttp)
implementation(libs.xz)
implementation(libs.protobuf.java)
testImplementation(libs.bundles.testing)
}
/* Artifact publishing */
nexusPublishing {
repositories {
sonatype {
val ossrhUsername: String by project
val ossrhPassword: String by project
username = ossrhUsername
password = ossrhPassword
}
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(javadocJar)
pom {
name = "JavaSteam"
packaging = "jar"
description = "Java library to interact with Valve's Steam network."
url = "https://github.com/Longi94/JavaSteam"
inceptionYear = "2018"
scm {
connection = "scm:git:git://github.com/Longi94/JavaSteam.git"
developerConnection = "scm:git:ssh://github.com:Longi94/JavaSteam.git"
url = "https://github.com/Longi94/JavaSteam/tree/master"
}
licenses {
license {
name = "MIT License"
url = "https://www.opensource.org/licenses/mit-license.php"
}
}
developers {
developer {
id = "Longi"
name = "Long Tran"
email = "lngtrn94@gmail.com"
}
}
}
}
}
}
signing {
sign(publishing.publications["mavenJava"])
}