mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-27 00:30:17 +08:00
Fix publishing
This commit is contained in:
parent
3b2b056be0
commit
98ade74ae6
@ -15,8 +15,8 @@ import org.gradle.api.Plugin
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
import org.gradle.kotlin.dsl.attributes
|
import org.gradle.kotlin.dsl.attributes
|
||||||
|
import org.gradle.kotlin.dsl.getByName
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.math.pow
|
|
||||||
|
|
||||||
class MiraiConsoleBuildPlugin : Plugin<Project> {
|
class MiraiConsoleBuildPlugin : Plugin<Project> {
|
||||||
override fun apply(target: Project) = target.run {
|
override fun apply(target: Project) = target.run {
|
||||||
@ -97,7 +97,11 @@ class MiraiConsoleBuildPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.findLatestFile(): Map.Entry<String, File> {
|
fun Project.findLatestFile(): Pair<String, File> {
|
||||||
|
return tasks.getByName("shadowJar", ShadowJar::class).run {
|
||||||
|
val file = archiveFile.get().asFile
|
||||||
|
this@findLatestFile.version.toString() to file
|
||||||
|
}/*
|
||||||
return File(projectDir, "build/libs").walk()
|
return File(projectDir, "build/libs").walk()
|
||||||
.filter { it.isFile }
|
.filter { it.isFile }
|
||||||
.onEach { println("all files=$it") }
|
.onEach { println("all files=$it") }
|
||||||
@ -112,7 +116,7 @@ fun Project.findLatestFile(): Map.Entry<String, File> {
|
|||||||
}.reversed().foldIndexed(0) { index: Int, acc: Int, s: String ->
|
}.reversed().foldIndexed(0) { index: Int, acc: Int, s: String ->
|
||||||
acc + 100.0.pow(index).toInt() * (s.toIntOrNull() ?: 0)
|
acc + 100.0.pow(index).toInt() * (s.toIntOrNull() ?: 0)
|
||||||
}
|
}
|
||||||
} ?: error("cannot find any file to upload")
|
} ?: error("cannot find any file to upload")*/
|
||||||
}
|
}
|
||||||
|
|
||||||
val gitVersion: String by lazy {
|
val gitVersion: String by lazy {
|
||||||
|
@ -63,6 +63,18 @@ object GitHub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project.file("token.txt").let { local ->
|
||||||
|
if (local.exists()) {
|
||||||
|
return local.readText().trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project.rootProject.file("token.txt").let { local ->
|
||||||
|
if (local.exists()) {
|
||||||
|
return local.readText().trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
error(
|
error(
|
||||||
"Cannot find github token, " +
|
"Cannot find github token, " +
|
||||||
"please specify by creating a file token.txt in project dir, " +
|
"please specify by creating a file token.txt in project dir, " +
|
||||||
|
Loading…
Reference in New Issue
Block a user