-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle.kts
93 lines (83 loc) · 2.99 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
plugins {
`maven-publish`
kotlin("jvm") version "1.4.20" apply false
id("net.researchgate.release") version "2.8.1"
id("io.kotest") version "0.2.6" apply false
id("org.jetbrains.dokka") version "1.4.10.2" apply false
}
val localRepository = "$buildDir/openapi-repo"
allprojects {
apply(plugin = "maven-publish")
project.extra["localRepository"] = localRepository
repositories {
mavenCentral()
jcenter()
}
publishing {
repositories {
maven {
name = "central"
gradle.taskGraph.whenReady {
url = uri (
when {
hasTask(":afterReleaseBuild") -> {
val mavenCentralStagingUrl: String by project.extra
mavenCentralStagingUrl
}
project.hasProperty("publishToCentral") && project.version.toString().contains("SNAPSHOT") -> {
val mavenCentralSnapshotUrl: String by project.extra
mavenCentralSnapshotUrl
}
else -> {
"$buildDir/localRepo"
}
}
)
if (hasTask(":afterReleaseBuild") || project.hasProperty("publishToCentral")) {
val mavenCentralUsername: String by project.extra
val mavenCentralPassword: String by project.extra
credentials {
username = mavenCentralUsername
password = mavenCentralPassword
}
}
}
}
maven {
name = "local"
url = uri(localRepository)
}
}
}
}
subprojects {
apply(plugin = "java")
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
val publishMergerApp = project(":openapi-merger-app").tasks.named("publish")
val publishGradlePlugin = project(":openapi-merger-gradle-plugin").tasks.named("publish")
val publishMavenPlugin = project(":openapi-merger-maven-plugin").tasks.named("publish")
val build by tasks.registering {
dependsOn(publishMergerApp)
dependsOn(publishGradlePlugin)
dependsOn(publishMavenPlugin)
}
val afterReleaseBuild by tasks.existing {
dependsOn(build)
}
project(":openapi-merger-gradle-plugin").afterEvaluate {
afterReleaseBuild {
dependsOn(project(":openapi-merger-gradle-plugin").tasks.named("publishPlugins"))
}
}
val clean by tasks.registering(Delete::class) {
delete = setOf(buildDir)
}
release {
(getProperty("git") as net.researchgate.release.GitAdapter.GitConfig).apply {
requireBranch = "main"
}
}