This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
168 lines (146 loc) · 4.8 KB
/
build.gradle
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
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.9.0'
id "org.jetbrains.dokka" version "1.8.20"
id "org.jmailen.kotlinter" version "3.16.0"
id "com.github.ben-manes.versions" version "0.47.0"
id 'jacoco'
}
allprojects {
kotlin {
jvmToolchain(17)
}
}
subprojects {
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: "org.jetbrains.dokka"
apply plugin: "org.jmailen.kotlinter"
apply plugin: 'jacoco'
repositories {
mavenLocal()
mavenCentral()
}
group = 'dev.angerm.ag_server'
version = "1.5.0"
dependencies {
implementation platform('org.jetbrains.kotlin:kotlin-bom')
api 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
api 'org.jetbrains.kotlin:kotlin-reflect'
['kotlinx-coroutines-core',
'kotlinx-coroutines-reactor',
'kotlinx-coroutines-jdk8',
'kotlinx-coroutines-slf4j',
].each {
api "org.jetbrains.kotlinx:${it}:1.7.3"
}
api platform("com.linecorp.armeria:armeria-bom:1.24.3")
['armeria',
'armeria-kotlin',
'armeria-retrofit2',
'armeria-rxjava3',
].each {
api "com.linecorp.armeria:${it}"
}
api 'io.github.microutils:kotlin-logging-jvm:3.0.5'
api 'com.uchuhimo:konf:1.1.2'
['simpleclient',
'simpleclient_hotspot',
'simpleclient_httpserver',
].each {
api "io.prometheus:${it}:0.16.0"
}
api "com.google.inject:guice:7.0.0"
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation(platform('org.junit:junit-bom:5.10.0'))
testImplementation('org.junit.jupiter:junit-jupiter')
dokkaHtmlPlugin "org.jetbrains.dokka:kotlin-as-java-plugin:1.8.20"
}
tasks.withType(JavaCompile) {
options.compilerArgs += '-parameters'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "17"
}
}
test {
useJUnitPlatform()
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
repositories {
maven {
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
publications {
agLibrary(MavenPublication) {
from components.java
pom {
name = 'AG Server'
description = 'A combination of Armeria+Guice'
url = 'https://github.com/AngerM/ag_server'
licenses {
license {
name = 'APACHE LICENSE, VERSION 2.0'
url = 'https://github.com/AngerM/ag_server/blob/main/LICENSE'
}
}
developers {
developer {
id = 'AngerM'
name = 'Matt Anger'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/AngerM/ag_server.git'
developerConnection = 'scm:git:https://github.com/AngerM/ag_server.git'
url = 'https://github.com/AngerM/ag_server'
}
}
}
}
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign configurations.archives
sign publishing.publications.agLibrary
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = false
xml.destination file("${buildDir}/reports/jacoco/report.xml")
}
}
check.dependsOn jacocoTestReport
}
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}
check {
dependsOn "installKotlinterPrePushHook"
}