-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
140 lines (119 loc) · 4.26 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
import com.github.breadmoirai.githubreleaseplugin.GithubReleaseExtension
import com.gradle.publish.PublishPlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("com.gradle.plugin-publish") apply false
id("com.github.breadmoirai.github-release")
`kotlin-dsl` apply false
}
val projectVersion: String by project
val projectDescription: String by project
val projectChangelog: String by project
val kotlinVersion: String by project
val androidBuildToolsVersion: String by project
val dokkaVersion: String by project
val ideaExtVersion: String by project
val devBuildNumber: String? by project
val githubAccessToken: String? by project
fun NamedDomainObjectContainer<PluginDeclaration>.createMultiGradlePlugin(type: String, applicableTo: String) {
create("multigradle-$type-$applicableTo") {
id = "net.pearx.multigradle.$type.$applicableTo"
displayName = "MultiGradle ${type.capitalize()} [${applicableTo.capitalize()}]"
description = projectDescription.replace("%type%", type)
implementationClass = "net.pearx.multigradle.plugin.$type.MultiGradle${type.capitalize()}${applicableTo.capitalize()}"
tags.set(listOf("kotlin", "multiplatform", "modular", "kotlin-multiplatform"))
}
}
allprojects {
version = if (devBuildNumber != null) "$projectVersion-dev-$devBuildNumber" else projectVersion
}
subprojects {
apply<KotlinDslPlugin>()
apply<MavenPublishPlugin>()
apply<JavaGradlePluginPlugin>()
apply<PublishPlugin>()
apply<SigningPlugin>()
group = "net.pearx.multigradle"
description = projectDescription.replace("%type%", "modular and simple")
repositories {
mavenCentral()
gradlePluginPortal()
}
configure<PublishingExtension> {
repositories {
maven {
credentials {
username = "pearxteam"
password = githubAccessToken
}
name = "github"
url = uri("https://maven.pkg.github.com/pearxteam/multigradle")
}
}
}
configure<GradlePluginDevelopmentExtension> {
website.set("https://github.com/pearxteam/multigradle")
vcsUrl.set("https://github.com/pearxteam/multigradle")
}
tasks {
withType<Sign> {
onlyIf {
devBuildNumber == null
}
}
register("publishDevelop") {
group = "publishing"
dependsOn(withType<PublishToMavenRepository>().matching { it.repository == project.the<PublishingExtension>().repositories["github"] })
}
register("publishRelease") {
group = "publishing"
dependsOn(named("publishPlugins"))
dependsOn(withType<PublishToMavenRepository>().matching { it.repository == project.the<PublishingExtension>().repositories["github"] })
}
}
}
project(":multigradle") {
repositories {
google()
}
dependencies {
"implementation"("org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinVersion")
"api"("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
"api"("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
"api"("com.android.tools.build:gradle:$androidBuildToolsVersion")
"api"("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:$ideaExtVersion")
}
configure<GradlePluginDevelopmentExtension> {
plugins {
createMultiGradlePlugin("modular", "project")
createMultiGradlePlugin("simple", "project")
}
}
tasks.withType<KotlinCompile>().all {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.ExperimentalStdlibApi"
}
}
project(":multigradle-settings") {
configure<GradlePluginDevelopmentExtension> {
plugins {
createMultiGradlePlugin("modular", "settings")
createMultiGradlePlugin("simple", "settings")
}
}
}
configure<GithubReleaseExtension> {
setToken(githubAccessToken)
setOwner("pearxteam")
setRepo(name)
setTargetCommitish("master")
setBody(projectChangelog)
}
tasks {
register("publishDevelop") {
group = "publishing"
}
register("publishRelease") {
group = "publishing"
dependsOn(named("githubRelease"))
}
}