From f1710b0bed5d2a78322300048c844b8c99d741f5 Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 5 Mar 2020 17:29:12 +0800 Subject: [PATCH] Add module `mirai-console-wrapper` --- gradle.properties | 1 + mirai-console-wrapper/build.gradle.kts | 51 +++++++++++++++++++ .../mirai/console/wrapper/WrapperMain.kt | 16 ++++++ settings.gradle | 1 + 4 files changed, 69 insertions(+) create mode 100644 mirai-console-wrapper/build.gradle.kts create mode 100644 mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/WrapperMain.kt diff --git a/gradle.properties b/gradle.properties index d86a7b009..18658932f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,7 @@ kotlin.code.style=official # config miraiVersion=0.24.1 miraiConsoleVersion=0.3.1 +miraiConsoleWrapperVersion=1.0.0 kotlin.incremental.multiplatform=true kotlin.parallel.tasks.in.project=true # kotlin diff --git a/mirai-console-wrapper/build.gradle.kts b/mirai-console-wrapper/build.gradle.kts new file mode 100644 index 000000000..fd3f2b4d5 --- /dev/null +++ b/mirai-console-wrapper/build.gradle.kts @@ -0,0 +1,51 @@ +plugins { + id("kotlin") +} + +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 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 { + manifest { + attributes["Main-Class"] = "net.mamoe.mirai.console.wrapper.WrapperMain" + } +} + + +val miraiVersion: String by rootProject.ext + +kotlin { + sourceSets { + all { + languageSettings.enableLanguageFeature("InlineClasses") + + languageSettings.useExperimentalAnnotation("kotlin.Experimental") + languageSettings.useExperimentalAnnotation("kotlin.OptIn") + } + } +} +dependencies { + compileOnly("net.mamoe:mirai-core-jvm:$miraiVersion") + + api(kotlin("stdlib", kotlinVersion)) + api(kotlin("reflect", kotlinVersion)) + + api(kotlinx("coroutines-core", coroutinesVersion)) + + api(ktor("client-core-jvm", ktorVersion)) + api(ktor("client-cio", ktorVersion)) +} + +val miraiConsoleWrapperVersion: String by project.ext +version = miraiConsoleWrapperVersion + +description = "Console with plugin support for mirai" \ No newline at end of file diff --git a/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/WrapperMain.kt b/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/WrapperMain.kt new file mode 100644 index 000000000..94989df9f --- /dev/null +++ b/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/WrapperMain.kt @@ -0,0 +1,16 @@ +/* + * 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 + */ + +package net.mamoe.mirai.console.wrapper + +object WrapperMain { + @JvmStatic + fun main(args: Array) { + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 36b061578..6c0f7da5c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -23,6 +23,7 @@ rootProject.name = 'mirai-console' include(':mirai-console') include(':mirai-console-terminal') +include(':mirai-console-wrapper') try{ def javaVersion = System.getProperty("java.version")