forked from Rosemoe/sora-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
111 lines (99 loc) · 3.98 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
/*******************************************************************************
* sora-editor - the awesome code editor for Android
* https://github.com/Rosemoe/sora-editor
* Copyright (C) 2020-2024 Rosemoe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* Please contact Rosemoe by email [email protected] if you need
* additional information or have any questions
******************************************************************************/
import com.android.build.gradle.BaseExtension
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.jetbrains.kotlin.gradle.model.KotlinAndroidExtension
@Suppress("DSL_SCOPE_VIOLATION") // https://youtrack.jetbrains.com/issue/KTIJ-19369
plugins {
id("build-logic.root-project")
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.publish) apply false
}
val highApiProjects = arrayOf("editor-lsp")
fun Project.configureBaseExtension() {
extensions.findByType(BaseExtension::class)?.run {
compileSdkVersion(Versions.compileSdkVersion)
buildToolsVersion = Versions.buildToolsVersion
defaultConfig {
minSdk =
if (highApiProjects.contains([email protected])) Versions.minSdkVersionHighApi else Versions.minSdkVersion
targetSdk = Versions.targetSdkVersion
versionCode = Versions.versionCode
versionName = Versions.versionName
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
}
fun Project.configureKotlinExtension() {
extensions.findByType(KotlinAndroidProjectExtension::class)?.run {
jvmToolchain(17)
}
}
subprojects {
plugins.withId("com.android.application") {
configureBaseExtension()
}
plugins.withId("com.android.library") {
configureBaseExtension()
}
plugins.withId("org.jetbrains.kotlin.android") {
configureKotlinExtension()
}
plugins.withId("com.vanniktech.maven.publish.base") {
configure<MavenPublishBaseExtension> {
group = "io.github.Rosemoe.sora-editor"
version = Versions.versionName
pomFromGradleProperties()
publishToMavenCentral(SonatypeHost.S01)
signAllPublications()
if ("bom" != [email protected]) {
configure(
AndroidSingleVariantLibrary(
variant = "release",
sourcesJar = true,
publishJavadocJar = false
)
)
}
}
}
}
tasks.register<Delete>("clean").configure {
delete(rootProject.layout.buildDirectory)
}
val excludeProjectName = arrayOf("app", "buildSrc")
tasks.register("bundleAll") {
group = "Rosemoe"
allprojects
.filter { it.name !in excludeProjectName }
.forEach { dependsOn(it.getTasksByName("bundleReleaseAar", false)) }
}