Fix publishing keys

This commit is contained in:
Him188 2020-12-01 09:47:00 +08:00
parent 7fad444a0c
commit d532a9ffa1
4 changed files with 15 additions and 6 deletions

View File

@ -11,7 +11,7 @@
object Versions {
const val core = "1.3.3"
const val console = "1.1.0-dev-33"
const val console = "1.1.0-dev-36"
const val consoleGraphical = "0.0.7"
const val consoleTerminal = console

View File

@ -3,7 +3,6 @@ package net.mamoe.mirai.console.gradle
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputFile
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
import java.io.File
@ -19,7 +18,7 @@ public open class BuildMiraiPluginTask : ShadowJar() {
/**
* ShadowJar 打包结果
*/
@get:OutputFile
@get:Internal
public val output: File
get() = outputs.files.singleFile
}

View File

@ -10,6 +10,6 @@
package net.mamoe.mirai.console.gradle
internal object VersionConstants {
const val CONSOLE_VERSION = "1.1.0-dev-33" // value is written here automatically during build
const val CONSOLE_VERSION = "1.1.0-dev-36" // value is written here automatically during build
const val CORE_VERSION = "1.3.3" // value is written here automatically during build
}

View File

@ -34,9 +34,11 @@ private fun Project.findPropertySmart(propName: String): String? {
?: System.getenv(propName)
}
private class PropertyNotFoundException(message: String) : RuntimeException(message)
private fun Project.findPropertySmartOrFail(propName: String): String {
return findPropertySmart(propName)
?: error("[Mirai Console] Cannot find property for publication: '$propName'. Please check your 'mirai' configuration.")
?: throw PropertyNotFoundException("[Mirai Console] Cannot find property for publication: '$propName'. Please check your 'mirai' configuration.")
}
internal fun Project.configurePublishing() {
@ -48,7 +50,15 @@ internal fun Project.configurePublishing() {
registerMavenPublications(it, isSingleTarget)
}
registerBintrayPublish()
try {
registerBintrayPublish()
} catch (e: PropertyNotFoundException) {
logger.warn(e.message)
tasks.filter { it.group == "mirai" }
.filter { it.name.startsWith("publishPlugin") }
.forEach { it.enabled = false }
logger.warn("Publishing tasks disabled.")
}
}
private inline fun <reified T : Task> TaskContainer.getSingleTask(): T = filterIsInstance<T>().single()