-
Notifications
You must be signed in to change notification settings - Fork 38
/
build.gradle.kts
120 lines (101 loc) · 4.01 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
/*
* Copyright (c) 2021. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
import java.util.*
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
kotlin("multiplatform") apply false
kotlin("jvm") apply false
id("org.jetbrains.dokka") apply false
id("io.codearte.nexus-staging") apply false
id("io.github.gradle-nexus.publish-plugin")
// Add the KSP plugin before the Jupyter API to avoid ksp versions incompatibility.
// May be removed when using further versions of the jupyter api
id("com.google.devtools.ksp") apply false
kotlin("jupyter.api") apply false
}
val localProps = Properties()
if (project.file("local.properties").exists()) {
localProps.load(project.file("local.properties").inputStream())
}
allprojects {
group = "org.jetbrains.lets-plot"
version = when (name) {
"dokka" -> "4.9.3"
else -> "4.9.4-SNAPSHOT"
// else -> "0.0.0-SNAPSHOT" // for local publishing only
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
kotlinOptions {
jvmTarget = "1.8"
}
}
tasks.withType<JavaCompile>().all {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
}
subprojects {
repositories {
// GeoTools repository must be before Maven Central
// See: https://stackoverflow.com/questions/26993105/i-get-an-error-downloading-javax-media-jai-core1-1-3-from-maven-central
// See also Jupyter Kotlin issue: https://github.com/Kotlin/kotlin-jupyter/issues/107
maven(url = "https://repo.osgeo.org/repository/release")
mavenCentral()
google()
// Repositories where other projects publish their artifacts locally to.
localProps["maven.repo.local"]?.let {
(it as String).split(",").forEach { repo ->
mavenLocal {
url = uri(repo)
}
}
}
// SNAPSHOTS
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
mavenLocal()
}
// Repository path for "MavenLocalRepository"
var localMavenRepository: String by extra
localMavenRepository = "$rootDir/.maven-publish-dev-repo"
// ------------------------------------------
// Workaround for the error when signing published artifacts.
// It seems to appear after switching to Gradle 8.3
// For details see: https://github.com/gradle/gradle/issues/26091 :
// Publishing a KMP project with signing fails with "Task ... uses this output of task ... without declaring an explicit or implicit dependency"
// https://github.com/gradle/gradle/issues/26091
tasks.withType<AbstractPublishToMaven>().configureEach {
val signingTasks = tasks.withType<Sign>()
mustRunAfter(signingTasks)
}
afterEvaluate {
// Add LICENSE file to the META-INF folder inside published JAR files
tasks.filterIsInstance(org.gradle.jvm.tasks.Jar::class.java)
.forEach {
it.metaInf {
from("$rootDir") {
include("LICENSE")
}
}
}
}
}
// Nexus publish plugin settings:
val sonatypeUsername = localProps["sonatype.username"] as String?
val sonatypePassword = localProps["sonatype.password"] as String?
val sonatypeProfileId = localProps["sonatype.profileID"] as String?
if (!(sonatypeUsername.isNullOrBlank()
|| sonatypePassword.isNullOrBlank()
|| sonatypeProfileId.isNullOrBlank())) {
nexusPublishing.repositories {
sonatype {
username.set(sonatypeUsername)
password.set(sonatypePassword)
stagingProfileId.set(sonatypeProfileId)
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
}
}
}