Skip to content

Commit

Permalink
chore: fix missing manifest entries when executing task: buildPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
asforest committed Jun 12, 2022
1 parent 6256d4a commit 1be43c4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import java.text.SimpleDateFormat
import java.util.Date
import java.io.File
import net.mamoe.mirai.console.gradle.BuildMiraiPluginTask
import net.mamoe.mirai.console.gradle.BuildMiraiPluginV2

fun getVersionName(tagName: String) = if(tagName.startsWith("v")) tagName.substring(1) else tagName
val gitTagName: String? get() = Regex("(?<=refs/tags/).*").find(System.getenv("GITHUB_REF") ?: "")?.value
Expand All @@ -13,7 +12,7 @@ version = gitTagName?.run { getVersionName(this) } ?: System.getenv("VERSION") ?

plugins {
val kotlinVersion = "1.6.10"
val miraiVersion = "2.11.0-RC"
val miraiVersion = "2.11.0"
kotlin("jvm") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion
id("net.mamoe.mirai-console") version miraiVersion
Expand All @@ -34,8 +33,10 @@ dependencies {

mirai {
jvmTarget = JavaVersion.VERSION_11
}

configureShadow {
afterEvaluate {
tasks.named<BuildMiraiPluginV2>("buildPlugin") {
// 在manifest里添加信息
manifest {
attributes("Mirai-Plugin-Version" to archiveVersion.get())
Expand All @@ -47,10 +48,10 @@ mirai {

// 注册开发任务
tasks.register<Copy>("develop") {
val buildMiraiPluginTask = tasks.withType<BuildMiraiPluginTask>()
val buildMiraiPluginTask = tasks.named<BuildMiraiPluginV2>("buildPlugin")
dependsOn(buildMiraiPluginTask)

val archive = buildMiraiPluginTask.first().archiveFile.get().asFile
val archive = buildMiraiPluginTask.get().archiveFile.get().asFile
val outputPath = System.getenv()["DBG"]?.replace("/", "\\")
val outputDir = outputPath?.run { File(this) }
?.run { if(!exists() || !isDirectory) null else this }
Expand Down

0 comments on commit 1be43c4

Please sign in to comment.