-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
75 lines (66 loc) · 2.54 KB
/
build.gradle.kts
File metadata and controls
75 lines (66 loc) · 2.54 KB
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
import java.text.SimpleDateFormat
import java.util.*
rootProject.extra.set("artifactVersion", SimpleDateFormat("yyyy-MM-dd\'T\'HH-mm-ss").format(Date()))
plugins {
id("maven-publish")
id("com.github.ben-manes.versions") version "0.54.0"
id("org.sonatype.gradle.plugins.scan") version "3.1.5"
id("io.freefair.maven-central.validate-poms") version "9.5.0"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}
val dependencyVersions = listOf(
"com.squareup.okhttp3:okhttp:${libs.versions.okhttp.get()}",
"com.squareup.okhttp3:okhttp-jvm:${libs.versions.okhttp.get()}",
"org.jetbrains:annotations:26.1.0"
)
val dependencyVersionsByGroup = mapOf<String, String>(
)
subprojects {
repositories {
// mavenLocal()
// fun findProperty(s: String) = project.findProperty(s) as String?
// maven {
// name = "github"
// setUrl("https://maven.pkg.github.com/docker-client/*")
// credentials {
// username = System.getenv("PACKAGE_REGISTRY_USER") ?: findProperty("github.package-registry.username")
// password = System.getenv("PACKAGE_REGISTRY_TOKEN") ?: findProperty("github.package-registry.password")
// }
// }
mavenCentral()
}
}
allprojects {
configurations.all {
resolutionStrategy {
failOnVersionConflict()
force(dependencyVersions)
eachDependency {
val forcedVersion = dependencyVersionsByGroup[requested.group]
if (forcedVersion != null) {
useVersion(forcedVersion)
}
}
}
}
}
ossIndexAudit {
username = System.getenv("SONATYPE_INDEX_USERNAME") ?: findProperty("sonatype.index.username")
password = System.getenv("SONATYPE_INDEX_PASSWORD") ?: findProperty("sonatype.index.password")
}
fun findProperty(s: String) = project.findProperty(s) as String?
val isSnapshot = project.version == "unspecified"
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"))
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
}