mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-24 23:20:09 +08:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # gradle.properties
This commit is contained in:
commit
099e76b188
7
buildSrc/build.gradle.kts
Normal file
7
buildSrc/build.gradle.kts
Normal file
@ -0,0 +1,7 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
46
buildSrc/src/main/kotlin/versions.kt
Normal file
46
buildSrc/src/main/kotlin/versions.kt
Normal file
@ -0,0 +1,46 @@
|
||||
import org.gradle.kotlin.dsl.DependencyHandlerScope
|
||||
|
||||
/*
|
||||
* Copyright 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
|
||||
*/
|
||||
|
||||
object Versions {
|
||||
object Mirai {
|
||||
const val core = "0.30.0"
|
||||
const val console = "0.3.6"
|
||||
const val consoleWrapper = "0.1.3"
|
||||
}
|
||||
|
||||
object Kotlin {
|
||||
const val stdlib = "1.4-M1"
|
||||
const val coroutines = "1.3.5-1.4-M1"
|
||||
const val atomicFU = "0.14.2-1.4-M1"
|
||||
const val serialization = "0.20.0-1.4-M1"
|
||||
const val ktor = "1.3.2-1.4-M1"
|
||||
|
||||
const val io = "0.1.16"
|
||||
const val coroutinesIo = "0.1.16"
|
||||
const val dokka = "0.10.1"
|
||||
}
|
||||
|
||||
object Android {
|
||||
const val androidGradlePlugin = "3.5.3"
|
||||
}
|
||||
|
||||
object Publishing {
|
||||
const val bintray = "1.8.4-jetbrains-3"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun DependencyHandlerScope.kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
|
||||
|
||||
@Suppress("unused")
|
||||
fun DependencyHandlerScope.ktor(id: String, version: String = Versions.Kotlin.ktor) = "io.ktor:ktor-$id:$version"
|
@ -1,18 +1,20 @@
|
||||
plugins {
|
||||
id("kotlinx-serialization")
|
||||
id("org.openjfx.javafxplugin") version "0.0.8"
|
||||
// id("org.openjfx.javafxplugin") version "0.0.8"
|
||||
id("kotlin")
|
||||
id("java")
|
||||
}
|
||||
|
||||
javafx {
|
||||
version = "13.0.2"
|
||||
modules = listOf("javafx.controls")
|
||||
//mainClassName = "Application"
|
||||
}
|
||||
//javafx {
|
||||
// version = "13.0.2"
|
||||
// modules = listOf("javafx.controls")
|
||||
// //mainClassName = "Application"
|
||||
//}
|
||||
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
|
||||
version = Versions.Mirai.console
|
||||
|
||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>() {
|
||||
manifest {
|
||||
attributes["Main-Class"] = "net.mamoe.mirai.console.graphical.MiraiGraphicalLoader"
|
||||
@ -43,7 +45,7 @@ dependencies {
|
||||
api(project(":mirai-console"))
|
||||
|
||||
api(group = "no.tornado", name = "tornadofx", version = "1.7.19")
|
||||
api(group = "com.jfoenix", name = "jfoenix", version = "9.0.8")
|
||||
api(group = "com.jfoenix", name = "jfoenix", version = "8.0.8")
|
||||
|
||||
testApi(group = "org.yaml", name = "snakeyaml", version = "1.25")
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ internal fun EventTarget.jfxTabPane(op: JFXTabPane.() -> Unit = {}) = JFXTabPane
|
||||
internal fun EventTarget.jfxButton(text: String = "", graphic: Node? = null, op: Button.() -> Unit = {}) =
|
||||
JFXButton(text).attachTo(this, op) {
|
||||
if (graphic != null) it.graphic = graphic
|
||||
it.buttonType = JFXButton.ButtonType.RAISED
|
||||
}
|
||||
|
||||
fun EventTarget.jfxTextfield(value: String? = null, op: JFXTextField.() -> Unit = {}) =
|
||||
|
@ -7,6 +7,7 @@ plugins {
|
||||
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
|
||||
version = Versions.Mirai.console
|
||||
|
||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>() {
|
||||
manifest {
|
||||
|
@ -1,21 +1,10 @@
|
||||
plugins {
|
||||
id("kotlin")
|
||||
kotlin("jvm")
|
||||
kotlin("plugin.serialization")
|
||||
}
|
||||
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
|
||||
val kotlinVersion: String by rootProject.ext
|
||||
val coroutinesVersion: String by rootProject.ext
|
||||
val coroutinesIoVersion: String by rootProject.ext
|
||||
val atomicFuVersion: String by rootProject.ext
|
||||
val kotlinXIoVersion: String by rootProject.ext
|
||||
|
||||
val ktorVersion: String by rootProject.ext
|
||||
|
||||
fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
|
||||
|
||||
fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
|
||||
|
||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
||||
manifest {
|
||||
attributes["Main-Class"] = "net.mamoe.mirai.console.wrapper.WrapperMain"
|
||||
@ -23,8 +12,6 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
||||
}
|
||||
|
||||
|
||||
val miraiVersion: String by rootProject.ext
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
all {
|
||||
@ -36,15 +23,13 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
val serializationVersion: String by rootProject.ext
|
||||
|
||||
dependencies {
|
||||
//core && protocol
|
||||
api(kotlin("stdlib", kotlinVersion))
|
||||
api(kotlin("serialization", kotlinVersion))
|
||||
api(kotlin("reflect", kotlinVersion))
|
||||
api(kotlin("stdlib", Versions.Kotlin.stdlib))
|
||||
api(kotlin("serialization", Versions.Kotlin.stdlib))
|
||||
api(kotlin("reflect", Versions.Kotlin.stdlib))
|
||||
|
||||
api(kotlinx("coroutines-core-common", coroutinesVersion))
|
||||
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
||||
api(kotlinx("serialization-runtime-common", serializationVersion))
|
||||
api(kotlinx("serialization-protobuf-common", serializationVersion))
|
||||
api(kotlinx("io", kotlinXIoVersion))
|
||||
@ -73,7 +58,7 @@ dependencies {
|
||||
api(kotlinx("serialization-runtime", serializationVersion))
|
||||
|
||||
//for slf4j[ktor used]
|
||||
// api(group = "org.apache.cassandra", name = "cassandra-all", version = "0.8.1")
|
||||
// api(group = "org.apache.cassandra", name = "cassandra-all", version = "0.8.1")
|
||||
|
||||
//mirai-console
|
||||
api(group = "com.alibaba", name = "fastjson", version = "1.2.62")
|
||||
@ -84,7 +69,6 @@ dependencies {
|
||||
|
||||
}
|
||||
|
||||
val miraiConsoleWrapperVersion: String by project.ext
|
||||
version = miraiConsoleWrapperVersion
|
||||
version = Versions.Mirai.consoleWrapper
|
||||
|
||||
description = "Console with plugin support for mirai"
|
@ -1,33 +1,15 @@
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
id("kotlinx-serialization")
|
||||
id("kotlin")
|
||||
kotlin("jvm")
|
||||
kotlin("plugin.serialization")
|
||||
id("java")
|
||||
`maven-publish`
|
||||
id("com.jfrog.bintray")
|
||||
}
|
||||
|
||||
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
|
||||
val kotlinVersion: String by rootProject.ext
|
||||
val atomicFuVersion: String by rootProject.ext
|
||||
val coroutinesVersion: String by rootProject.ext
|
||||
val kotlinXIoVersion: String by rootProject.ext
|
||||
val coroutinesIoVersion: String by rootProject.ext
|
||||
|
||||
val klockVersion: String by rootProject.ext
|
||||
val ktorVersion: String by rootProject.ext
|
||||
|
||||
val serializationVersion: String by rootProject.ext
|
||||
|
||||
fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
|
||||
|
||||
fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
|
||||
|
||||
val miraiVersion: String by rootProject.ext
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
all {
|
||||
@ -39,8 +21,8 @@ kotlin {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
compileOnly("net.mamoe:mirai-core-jvm:$miraiVersion")
|
||||
compileOnly("net.mamoe:mirai-core-qqandroid-jvm:$miraiVersion")
|
||||
compileOnly("net.mamoe:mirai-core-jvm:${Versions.Mirai.core}")
|
||||
compileOnly("net.mamoe:mirai-core-qqandroid-jvm:${Versions.Mirai.core}")
|
||||
|
||||
|
||||
compileOnly(group = "com.alibaba", name = "fastjson", version = "1.2.62")
|
||||
@ -48,23 +30,23 @@ dependencies {
|
||||
compileOnly(group = "com.moandjiezana.toml", name = "toml4j", version = "0.7.2")
|
||||
|
||||
|
||||
compileOnly(kotlin("stdlib", kotlinVersion))
|
||||
compileOnly(kotlin("serialization", kotlinVersion))
|
||||
compileOnly(kotlin("reflect", kotlinVersion))
|
||||
compileOnly(kotlin("stdlib", Versions.Kotlin.stdlib))
|
||||
compileOnly(kotlin("serialization", Versions.Kotlin.stdlib))
|
||||
compileOnly(kotlin("reflect", Versions.Kotlin.stdlib))
|
||||
|
||||
compileOnly(kotlinx("coroutines-io-jvm", coroutinesIoVersion))
|
||||
compileOnly(kotlinx("coroutines-core", coroutinesVersion))
|
||||
compileOnly(kotlinx("serialization-runtime", serializationVersion))
|
||||
compileOnly("org.jetbrains.kotlinx:atomicfu:$atomicFuVersion")
|
||||
compileOnly(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo))
|
||||
compileOnly(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
||||
compileOnly(kotlinx("serialization-runtime", Versions.Kotlin.serialization))
|
||||
compileOnly("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}")
|
||||
|
||||
compileOnly("org.bouncycastle:bcprov-jdk15on:1.64")
|
||||
|
||||
compileOnly(ktor("http-cio", ktorVersion))
|
||||
compileOnly(ktor("http-jvm", ktorVersion))
|
||||
compileOnly(ktor("io-jvm", ktorVersion))
|
||||
compileOnly(ktor("client-core-jvm", ktorVersion))
|
||||
compileOnly(ktor("client-cio", ktorVersion))
|
||||
compileOnly(ktor("network", ktorVersion))
|
||||
compileOnly(ktor("http-cio"))
|
||||
compileOnly(ktor("http-jvm"))
|
||||
compileOnly(ktor("io-jvm"))
|
||||
compileOnly(ktor("client-core-jvm"))
|
||||
compileOnly(ktor("client-cio"))
|
||||
compileOnly(ktor("network"))
|
||||
}
|
||||
|
||||
val miraiConsoleVersion: String by project.ext
|
||||
|
@ -41,7 +41,7 @@ abstract class AbstractCommandSender : CommandSender {
|
||||
internal val builder = StringBuilder()
|
||||
|
||||
override fun appendMessage(message: String) {
|
||||
builder.append(message).append("\n")
|
||||
builder.appendln(message)
|
||||
}
|
||||
|
||||
internal open suspend fun flushMessage() {
|
||||
|
@ -28,18 +28,26 @@ include(':mirai-console-wrapper')
|
||||
try{
|
||||
def javaVersion = System.getProperty("java.version")
|
||||
def versionPos = javaVersion.indexOf(".")
|
||||
if (versionPos==-1) versionPos = javaVersion.indexOf("-")
|
||||
if (versionPos==-1){
|
||||
println("jdk version unknown")
|
||||
}else{
|
||||
def javaVersionNum = javaVersion.substring(0, versionPos).toInteger()
|
||||
if (javaVersionNum >= 11) {
|
||||
include(':mirai-console-graphical')
|
||||
} else {
|
||||
println("jdk版本为 "+ javaVersionNum)
|
||||
println("当前使用的 JDK 版本为 ${System.getProperty("java.version")}, 最低需要 JDK 11 才能引入模块 `:mirai-console-graphical`")
|
||||
def javaVersionNum = javaVersion.substring(0, 1).toInteger()
|
||||
|
||||
if (javaVersion.startsWith("1.")) {
|
||||
javaVersionNum = javaVersion.substring(2, 3).toInteger()
|
||||
} else {
|
||||
if (versionPos==-1) versionPos = javaVersion.indexOf("-")
|
||||
if (versionPos==-1){
|
||||
println("jdk version unknown")
|
||||
}else{
|
||||
javaVersionNum = javaVersion.substring(0, versionPos).toInteger()
|
||||
}
|
||||
}
|
||||
if (javaVersionNum <= 8) {
|
||||
include(':mirai-console-graphical')
|
||||
} else {
|
||||
println("jdk版本为 "+ javaVersionNum)
|
||||
println("当前使用的 JDK 版本为 ${System.getProperty("java.version")}, 模块 `:mirai-console-graphical`不支持JDK 9+\n" +
|
||||
"请使用OracleJDK 1.8 或使用OpenJDK 1.8并添加Java Fx依赖")
|
||||
}
|
||||
|
||||
}catch(Exception ignored){
|
||||
println("无法确定 JDK 版本, 将不会引入 `:mirai-console-graphical`")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user