2020-11-01 15:07:32 +08:00
|
|
|
/*
|
2023-03-19 03:19:01 +08:00
|
|
|
* Copyright 2019-2023 Mamoe Technologies and contributors.
|
2020-11-01 15:07:32 +08:00
|
|
|
*
|
2022-06-18 20:02:09 +08:00
|
|
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
|
|
|
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
2020-11-01 15:07:32 +08:00
|
|
|
*
|
2022-06-18 20:02:09 +08:00
|
|
|
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
2020-11-01 15:07:32 +08:00
|
|
|
*/
|
|
|
|
|
2021-01-21 10:08:21 +08:00
|
|
|
@file:Suppress("UnstableApiUsage", "UNUSED_VARIABLE", "NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
2020-03-25 12:18:58 +08:00
|
|
|
|
2021-12-04 23:43:09 +08:00
|
|
|
import org.jetbrains.dokka.base.DokkaBase
|
|
|
|
import org.jetbrains.dokka.base.DokkaBaseConfiguration
|
2023-04-29 22:02:05 +08:00
|
|
|
import shadow.configureMppShadow
|
2021-12-04 23:43:09 +08:00
|
|
|
import java.time.LocalDateTime
|
2020-03-01 13:00:34 +08:00
|
|
|
|
|
|
|
buildscript {
|
|
|
|
repositories {
|
2021-08-16 18:08:35 +08:00
|
|
|
if (System.getProperty("use.maven.local") == "true") {
|
|
|
|
mavenLocal()
|
|
|
|
}
|
|
|
|
|
2020-10-03 13:35:05 +08:00
|
|
|
mavenCentral()
|
2021-08-25 14:18:40 +08:00
|
|
|
gradlePluginPortal()
|
2020-03-01 13:00:34 +08:00
|
|
|
google()
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2020-10-03 13:35:05 +08:00
|
|
|
classpath("com.android.tools.build:gradle:${Versions.androidGradlePlugin}")
|
|
|
|
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${Versions.atomicFU}")
|
2021-12-04 23:43:09 +08:00
|
|
|
classpath("org.jetbrains.dokka:dokka-base:${Versions.dokka}")
|
2020-03-01 13:00:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-23 19:31:22 +08:00
|
|
|
plugins {
|
2022-06-26 16:03:15 +08:00
|
|
|
kotlin("jvm") apply false // version Versions.kotlinCompiler
|
|
|
|
kotlin("plugin.serialization") version Versions.kotlinCompiler apply false
|
2022-05-29 06:03:13 +08:00
|
|
|
id("com.google.osdetector")
|
2021-12-04 23:43:09 +08:00
|
|
|
id("org.jetbrains.dokka") version Versions.dokka
|
2021-12-12 22:37:01 +08:00
|
|
|
id("me.him188.kotlin-jvm-blocking-bridge") version Versions.blockingBridge
|
2022-06-26 16:03:15 +08:00
|
|
|
id("me.him188.kotlin-dynamic-delegation") version Versions.dynamicDelegation apply false
|
|
|
|
id("me.him188.maven-central-publish") version Versions.mavenCentralPublish apply false
|
2023-04-17 18:40:28 +08:00
|
|
|
id("com.gradle.plugin-publish") version "1.1.0" apply false
|
2021-12-30 00:16:35 +08:00
|
|
|
id("org.jetbrains.kotlinx.binary-compatibility-validator") version Versions.binaryValidator apply false
|
2023-04-17 18:40:28 +08:00
|
|
|
id("com.android.library") apply false
|
2023-05-01 17:56:16 +08:00
|
|
|
id("de.mannodermaus.android-junit5") version "1.8.2.1" apply false
|
2020-03-23 19:31:22 +08:00
|
|
|
}
|
|
|
|
|
2022-05-29 06:03:13 +08:00
|
|
|
osDetector = osdetector
|
2022-08-26 16:35:13 +08:00
|
|
|
BuildSrcRootProjectHolder.value = rootProject
|
2023-04-05 13:10:47 +08:00
|
|
|
BuildSrcRootProjectHolder.lastUpdateTime = System.currentTimeMillis()
|
2022-05-29 06:03:13 +08:00
|
|
|
|
2021-03-20 13:34:04 +08:00
|
|
|
analyzes.CompiledCodeVerify.run { registerAllVerifyTasks() }
|
|
|
|
|
2020-03-01 13:00:34 +08:00
|
|
|
allprojects {
|
|
|
|
group = "net.mamoe"
|
2020-10-03 13:35:05 +08:00
|
|
|
version = Versions.project
|
2020-03-01 13:00:34 +08:00
|
|
|
|
|
|
|
repositories {
|
2021-08-16 18:08:35 +08:00
|
|
|
if (System.getProperty("use.maven.local") == "true") {
|
|
|
|
mavenLocal()
|
|
|
|
}
|
|
|
|
|
2020-07-31 16:29:25 +08:00
|
|
|
mavenCentral()
|
2021-08-25 14:18:40 +08:00
|
|
|
gradlePluginPortal()
|
|
|
|
google()
|
2020-03-01 13:00:34 +08:00
|
|
|
}
|
2020-03-25 10:12:24 +08:00
|
|
|
|
2022-01-04 23:59:13 +08:00
|
|
|
preConfigureJvmTarget()
|
2020-10-03 13:35:05 +08:00
|
|
|
afterEvaluate {
|
|
|
|
configureJvmTarget()
|
|
|
|
configureMppShadow()
|
|
|
|
configureEncoding()
|
|
|
|
configureKotlinTestSettings()
|
2023-04-17 18:40:28 +08:00
|
|
|
configureKotlinOptIns()
|
2020-10-03 13:35:05 +08:00
|
|
|
|
|
|
|
if (isKotlinJvmProject) {
|
|
|
|
configureFlattenSourceSets()
|
|
|
|
}
|
2021-06-23 14:57:34 +08:00
|
|
|
configureJarManifest()
|
2021-09-01 18:51:13 +08:00
|
|
|
substituteDependenciesUsingExpectedVersion()
|
2021-01-12 18:57:42 +08:00
|
|
|
}
|
|
|
|
}
|
2021-01-28 09:48:14 +08:00
|
|
|
|
2021-01-12 18:57:42 +08:00
|
|
|
subprojects {
|
|
|
|
afterEvaluate {
|
2022-01-06 09:10:15 +08:00
|
|
|
if (project.path == ":mirai-core-api") configureDokka()
|
|
|
|
if (project.path == ":mirai-console") configureDokka()
|
2020-07-17 20:43:26 +08:00
|
|
|
}
|
2020-10-03 13:35:05 +08:00
|
|
|
}
|
2021-12-04 23:43:09 +08:00
|
|
|
rootProject.configureDokka()
|
2020-09-22 13:23:08 +08:00
|
|
|
|
2021-02-03 21:28:04 +08:00
|
|
|
tasks.register("cleanExceptIntellij") {
|
|
|
|
group = "build"
|
2021-02-06 22:28:09 +08:00
|
|
|
allprojects.forEach { proj ->
|
2021-02-10 09:48:44 +08:00
|
|
|
if (proj.name != "mirai-console-intellij") {
|
|
|
|
|
|
|
|
// Type mismatch
|
|
|
|
// proj.tasks.findByName("clean")?.let(::dependsOn)
|
|
|
|
|
2021-02-06 22:28:09 +08:00
|
|
|
proj.tasks.findByName("clean")?.let { dependsOn(it) }
|
2020-09-22 18:56:27 +08:00
|
|
|
}
|
2020-10-03 13:35:05 +08:00
|
|
|
}
|
2021-02-03 21:28:04 +08:00
|
|
|
}
|
2021-01-12 18:57:42 +08:00
|
|
|
|
2021-02-09 21:58:27 +08:00
|
|
|
extensions.findByName("buildScan")?.withGroovyBuilder {
|
|
|
|
setProperty("termsOfServiceUrl", "https://gradle.com/terms-of-service")
|
|
|
|
setProperty("termsOfServiceAgree", "yes")
|
|
|
|
}
|
|
|
|
|
2020-10-03 13:35:05 +08:00
|
|
|
fun Project.configureDokka() {
|
2021-12-04 23:43:09 +08:00
|
|
|
val isRoot = this@configureDokka == rootProject
|
|
|
|
if (!isRoot) {
|
|
|
|
apply(plugin = "org.jetbrains.dokka")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().configureEach {
|
|
|
|
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
|
|
|
|
this.footerMessage = """Copyright 2019-${
|
|
|
|
LocalDateTime.now().year
|
|
|
|
} <a href="https://github.com/mamoe">Mamoe Technologies</a> and contributors.
|
|
|
|
Source code:
|
|
|
|
<a href="https://github.com/mamoe/mirai">GitHub</a>
|
|
|
|
""".trimIndent()
|
|
|
|
|
|
|
|
this.customAssets = listOf(
|
|
|
|
rootProject.projectDir.resolve("mirai-dokka/frontend/ext.js"),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<org.jetbrains.dokka.gradle.DokkaTask>().configureEach {
|
|
|
|
dokkaSourceSets.configureEach {
|
|
|
|
perPackageOption {
|
|
|
|
matchingRegex.set("net\\.mamoe\\.mirai\\.*")
|
|
|
|
skipDeprecated.set(true)
|
|
|
|
}
|
|
|
|
|
|
|
|
for (suppressedPackage in arrayOf(
|
|
|
|
"""net.mamoe.mirai.internal""",
|
|
|
|
"""net.mamoe.mirai.internal.message""",
|
|
|
|
"""net.mamoe.mirai.internal.network""",
|
|
|
|
"""net.mamoe.mirai.console.internal""",
|
|
|
|
"""net.mamoe.mirai.console.compiler.common"""
|
|
|
|
)) {
|
|
|
|
perPackageOption {
|
|
|
|
matchingRegex.set(suppressedPackage.replace(".", "\\."))
|
|
|
|
suppress.set(true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isRoot) {
|
|
|
|
tasks.named<org.jetbrains.dokka.gradle.AbstractDokkaTask>("dokkaHtmlMultiModule").configure {
|
|
|
|
outputDirectory.set(
|
|
|
|
rootProject.projectDir.resolve("mirai-dokka/pages/snapshot")
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2020-10-03 13:35:05 +08:00
|
|
|
}
|