-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
203 lines (185 loc) · 5.55 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
194
195
196
197
198
199
200
201
202
203
import java.text.SimpleDateFormat
import java.util.*
plugins {
id("java-library")
id("maven-publish")
id("signing")
id("com.github.ben-manes.versions") version "0.51.0"
id("net.ossindex.audit") version "0.4.11"
id("io.freefair.maven-central.validate-poms") version "8.11"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}
repositories {
mavenCentral()
}
dependencies {
constraints {
implementation("org.slf4j:slf4j-api") {
version {
strictly("[1.7,3)")
prefer("2.0.16")
}
}
listOf(
"com.squareup.okio:okio",
"com.squareup.okio:okio-jvm",
).forEach {
implementation(it) {
version {
strictly("[3,4)")
prefer("3.9.1")
}
}
}
api("com.squareup.okhttp3:okhttp") {
version {
strictly("[4,5)")
prefer("4.12.0")
}
}
listOf(
"com.kohlschutter.junixsocket:junixsocket-core",
"com.kohlschutter.junixsocket:junixsocket-common"
).forEach {
implementation(it) {
version {
strictly("[2.4,3)")
prefer("2.10.1")
}
}
}
listOf(
"org.jetbrains.kotlin:kotlin-stdlib",
"org.jetbrains.kotlin:kotlin-stdlib-common",
"org.jetbrains.kotlin:kotlin-stdlib-jdk7",
"org.jetbrains.kotlin:kotlin-stdlib-jdk8"
).forEach {
implementation(it) {
version {
strictly("[1.6,3)")
prefer("2.1.0")
}
}
}
}
implementation("org.slf4j:slf4j-api:2.0.16")
testRuntimeOnly("org.slf4j:jul-to-slf4j:2.0.16")
testRuntimeOnly("ch.qos.logback:logback-classic:[1.2,2)!!1.3.14")
api("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okio:okio:3.9.1")
implementation("com.kohlschutter.junixsocket:junixsocket-core:2.10.1@pom") {
isTransitive = true
}
implementation("com.kohlschutter.junixsocket:junixsocket-common:2.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.4")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.4")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.4")
}
val dependencyVersions = listOf<String>(
)
val dependencyGroupVersions = mapOf<String, String>()
configurations.all {
resolutionStrategy {
failOnVersionConflict()
force(dependencyVersions)
eachDependency {
val forcedVersion = dependencyGroupVersions[requested.group]
if (forcedVersion != null) {
useVersion(forcedVersion)
}
}
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
}
withType<Test> {
useJUnitPlatform()
}
}
val javadocJar by tasks.registering(Jar::class) {
dependsOn("classes")
archiveClassifier.set("javadoc")
from(tasks.javadoc)
}
val sourcesJar by tasks.registering(Jar::class) {
dependsOn("classes")
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
artifacts {
add("archives", sourcesJar.get())
add("archives", javadocJar.get())
}
fun findProperty(s: String) = project.findProperty(s) as String?
val isSnapshot = project.version == "unspecified"
val artifactVersion = if (!isSnapshot) project.version as String else SimpleDateFormat("yyyy-MM-dd\'T\'HH-mm-ss").format(Date())!!
val publicationName = "dockerFilesocket"
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/${property("github.package-registry.owner")}/${property("github.package-registry.repository")}")
credentials {
username = System.getenv("GITHUB_ACTOR") ?: findProperty("github.package-registry.username")
password = System.getenv("GITHUB_TOKEN") ?: findProperty("github.package-registry.password")
}
}
}
publications {
register(publicationName, MavenPublication::class) {
pom {
name.set("docker-filesocket")
description.set("Unix Domain Sockets and Named Pipes for the JVM on Linux, macOS, and Windows")
url.set("https://github.com/docker-client/docker-filesocket")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("gesellix")
name.set("Tobias Gesellchen")
email.set("tobias@gesellix.de")
}
}
scm {
connection.set("scm:git:github.com/docker-client/docker-filesocket.git")
developerConnection.set("scm:git:ssh://github.com/docker-client/docker-filesocket.git")
url.set("https://github.com/docker-client/docker-filesocket")
}
}
artifactId = "docker-filesocket"
version = artifactVersion
from(components["java"])
artifact(sourcesJar.get())
artifact(javadocJar.get())
}
}
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications[publicationName])
}
nexusPublishing {
repositories {
if (!isSnapshot) {
sonatype {
// 'sonatype' is pre-configured for Sonatype Nexus (OSSRH) which is used for The Central Repository
stagingProfileId.set(System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: findProperty("sonatype.staging.profile.id")) //can reduce execution time by even 10 seconds
username.set(System.getenv("SONATYPE_USERNAME") ?: findProperty("sonatype.username"))
password.set(System.getenv("SONATYPE_PASSWORD") ?: findProperty("sonatype.password"))
}
}
}
}