From d7a7a5044bfd2b2997ff26331b83c48db674add4 Mon Sep 17 00:00:00 2001 From: Him188 <Him188@mamoe.net> Date: Sun, 29 Jan 2023 08:33:30 +0000 Subject: [PATCH] [build] Delete unused Groovy code --- gradle/android.gradle | 20 ----- gradle/api-validation.gradle | 22 ------ gradle/mpp.gradle.kts | 8 -- gradle/publish.gradle | 145 ----------------------------------- 4 files changed, 195 deletions(-) delete mode 100644 gradle/android.gradle delete mode 100644 gradle/api-validation.gradle delete mode 100644 gradle/mpp.gradle.kts delete mode 100644 gradle/publish.gradle diff --git a/gradle/android.gradle b/gradle/android.gradle deleted file mode 100644 index 001c42409..000000000 --- a/gradle/android.gradle +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 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. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -apply plugin: "com.android.library" - -android { - dexOptions{ - javaMaxHeapSize "4g" - } - compileSdkVersion(29) - defaultConfig { - minSdkVersion(15) - } -} \ No newline at end of file diff --git a/gradle/api-validation.gradle b/gradle/api-validation.gradle deleted file mode 100644 index f0836c84f..000000000 --- a/gradle/api-validation.gradle +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 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. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -apiValidation { - ignoredPackages += [ - "net.mamoe.mirai.event.internal", - "net.mamoe.mirai.utils.internal" - ] - - ignoredPackages += [ - "net.mamoe.mirai.internal.contact", - "net.mamoe.mirai.internal.message", - "net.mamoe.mirai.internal.network", - "net.mamoe.mirai.internal.utils" - ] -} \ No newline at end of file diff --git a/gradle/mpp.gradle.kts b/gradle/mpp.gradle.kts deleted file mode 100644 index f1f0b6d22..000000000 --- a/gradle/mpp.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2019-2021 Mamoe Technologies and contributors. - * - * 此源代码的使用受 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. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ diff --git a/gradle/publish.gradle b/gradle/publish.gradle deleted file mode 100644 index 380ae8395..000000000 --- a/gradle/publish.gradle +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2019-2021 Mamoe Technologies and contributors. - * - * 此源代码的使用受 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. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -// 部分源码来自 kotlinx.coroutines -// Source code from kotlinx.coroutines - -tasks.register("ensureBintrayAvailable") { - doLast { - if (!Bintray.isBintrayAvailable(project)) { - throw new IllegalStateException("bintray isn't available. ") - } - } -} - -try { - -// empty xxx-javadoc.jar - task javadocJar(type: Jar) { - archiveClassifier = 'javadoc' - } -} catch (Exception ignored) { - -} - -try { - task stubJavadoc(type: Jar) { - archiveClassifier = 'javadoc' - } -} catch (Exception ignored) { - -} - -/** - * Publish the platform JAR and POM so that consumers who depend on this module and can't read Gradle module - * metadata can still get the platform artifact and transitive dependencies from the POM - * (see details in https://youtrack.jetbrains.com/issue/KT-39184#focus=streamItem-27-4115233.0-0) - */ -project.ext.publishPlatformArtifactsInRootModule = { platformPublication -> - def platformPomBuilder = null - - platformPublication.pom.withXml { platformPomBuilder = asString() } - - publishing.publications.kotlinMultiplatform { - platformPublication.artifacts.forEach { - println("Adding artiface to root: $it") - artifact(it) - } - - pom.withXml { - def pomStringBuilder = asString() - pomStringBuilder.setLength(0) - // The platform POM needs its artifact ID replaced with the artifact ID of the root module: - def platformPomString = platformPomBuilder.toString() - platformPomString.eachLine { line -> - if (!line.contains("<!--")) { // Remove the Gradle module metadata marker as it will be added anew - pomStringBuilder.append(line.replace(platformPublication.artifactId, artifactId)) - pomStringBuilder.append("\n") - } - } - } - } - - tasks.matching { it.name == "generatePomFileForKotlinMultiplatformPublication" }.configureEach { - dependsOn(tasks["generatePomFileFor${platformPublication.name.capitalize()}Publication"]) - } -} - -def isKotlin137x = false - -afterEvaluate { - - publishing { - def variantName = "${project.name}" - - // Rename artifacts for backward compatibility - publications.all { - // add empty javadocs - if (it.name != "kotlinMultiplatform") { - it.artifact(javadocJar) - } - - // Rename MPP artifacts for backward compatibility - def type = it.name - switch (type) { - case 'kotlinMultiplatform': - // With Kotlin 1.4 & HMPP, the root module should have no suffix in the ID, but for compatibility with - // the consumers who can't read Gradle module metadata, we publish the JVM artifacts in it, too - it.artifactId = isKotlin137x ? "$project.name-native" : project.name - if (!isKotlin137x) { - publishPlatformArtifactsInRootModule(publications["jvm"]) - } - break - case 'metadata': - // As the old -common dependencies will fail to resolve with Gradle module metadata, rename the module - // to '*-metadata' so that the resolution failure are more clear - it.artifactId = isKotlin137x ? "$project.name-common" : "$project.name-metadata" - break - case 'jvm': - it.artifactId = isKotlin137x ? project.name : "$project.name-jvm" - break - case 'js': - case 'native': - it.artifactId = "$project.name-$type" - break - } - // Hierarchical project structures are not fully supported in 1.3.7x MPP - if (isKotlin137x) { - // disable metadata everywhere, but in native and js modules - if (type == 'maven' || type == 'metadata' || type == 'jvm') { - moduleDescriptorGenerator = null - } - } - - } - - if (isKotlin137x) { - disableMetadataPublication() - } - } -} - -tasks.matching { it.name == "generatePomFileForKotlinMultiplatformPublication" }.configureEach { - dependsOn(tasks["generatePomFileForJvmPublication"]) -} - - -if (Bintray.isBintrayAvailable(project)) { - project.configureBintray() -} - -/* -task bintrayUpload(dependsOn: publish) - -// This is required for K/N publishing -bintrayUpload.dependsOn publishToMavenLocal - - -bintrayUpload.dependsOn generatePomFileForKotlinMultiplatformPublication - */ \ No newline at end of file