mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0b23d3a46f
@ -13,80 +13,35 @@ plugins {
|
||||
}
|
||||
|
||||
version = Versions.console
|
||||
description = "Console backend for mirai"
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile::class.java) {
|
||||
options.encoding = "UTF8"
|
||||
}
|
||||
description = "Mirai Console Backend"
|
||||
|
||||
kotlin {
|
||||
explicitApiWarning()
|
||||
|
||||
sourceSets.all {
|
||||
target.compilations.all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||
//useIR = true
|
||||
}
|
||||
}
|
||||
languageSettings.apply {
|
||||
enableLanguageFeature("InlineClasses")
|
||||
progressiveMode = true
|
||||
|
||||
useExperimentalAnnotation("kotlin.Experimental")
|
||||
useExperimentalAnnotation("kotlin.RequiresOptIn")
|
||||
|
||||
useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiInternalAPI")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiExperimentalAPI")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.console.ConsoleFrontEndImplementation")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.console.util.ConsoleExperimentalApi")
|
||||
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
||||
useExperimentalAnnotation("kotlin.experimental.ExperimentalTypeInference")
|
||||
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
||||
useExperimentalAnnotation("kotlinx.serialization.ExperimentalSerializationApi")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.console.util.ConsoleInternalApi")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileAndTestRuntime("net.mamoe:mirai-core:${Versions.core}")
|
||||
compileAndTestRuntime(kotlin("stdlib", Versions.kotlinStdlib))
|
||||
compileAndTestRuntime(kotlin("stdlib-jdk8", Versions.kotlinStdlib))
|
||||
compileAndTestRuntime(`mirai-core`)
|
||||
compileAndTestRuntime(`kotlin-stdlib`)
|
||||
compileAndTestRuntime(`kotlin-stdlib-jdk8`)
|
||||
|
||||
compileAndTestRuntime("org.jetbrains.kotlinx:atomicfu:${Versions.atomicFU}")
|
||||
compileAndTestRuntime(kotlinx("coroutines-core", Versions.coroutines))
|
||||
compileAndTestRuntime(kotlinx("serialization-core", Versions.serialization))
|
||||
compileAndTestRuntime(kotlinx("serialization-json", Versions.serialization))
|
||||
compileAndTestRuntime(kotlin("reflect"))
|
||||
compileAndTestRuntime(`kotlinx-atomicfu`)
|
||||
compileAndTestRuntime(`kotlinx-coroutines-core`)
|
||||
compileAndTestRuntime(`kotlinx-serialization-core`)
|
||||
compileAndTestRuntime(`kotlinx-serialization-json`)
|
||||
compileAndTestRuntime(`kotlin-reflect`)
|
||||
|
||||
smartImplementation("net.mamoe.yamlkt:yamlkt:${Versions.yamlkt}")
|
||||
smartImplementation("org.jetbrains:annotations:19.0.0")
|
||||
smartApi(kotlinx("coroutines-jdk8", Versions.coroutines))
|
||||
smartImplementation(yamlkt)
|
||||
smartImplementation(`jetbrains-annotations`)
|
||||
smartApi(`kotlinx-coroutines-jdk8`)
|
||||
|
||||
testApi("net.mamoe:mirai-core-qqandroid:${Versions.core}")
|
||||
testApi(kotlin("stdlib-jdk8"))
|
||||
testApi(kotlin("test"))
|
||||
testApi(kotlin("test-junit5"))
|
||||
|
||||
testApi("org.junit.jupiter:junit-jupiter-api:5.2.0")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.2.0")
|
||||
testApi(`mirai-core-qqandroid`)
|
||||
testApi(`kotlin-stdlib-jdk8`)
|
||||
}
|
||||
|
||||
tasks {
|
||||
"test"(Test::class) {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
val compileKotlin by getting {}
|
||||
|
||||
val fillBuildConstants by registering {
|
||||
register("fillBuildConstants") {
|
||||
group = "mirai"
|
||||
doLast {
|
||||
(compileKotlin as KotlinCompile).source.filter { it.name == "MiraiConsoleBuildConstants.kt" }.single()
|
||||
@ -109,8 +64,4 @@ tasks {
|
||||
}
|
||||
}
|
||||
|
||||
// region PUBLISHING
|
||||
|
||||
setupPublishing("mirai-console")
|
||||
|
||||
// endregion
|
@ -28,3 +28,19 @@ internal inline fun <reified E : Throwable> runIgnoreException(block: () -> Unit
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
internal fun getCallerClassloader(): ClassLoader? {
|
||||
return runCatching {
|
||||
/*
|
||||
java.base/java.lang.Thread.getStackTrace(Thread.java:1598)
|
||||
net.mamoe.mirai.console.internal.util.CommonUtils.getCallerClassloader(CommonUtils.kt:37)
|
||||
net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription$Companion.loadFromResource$default(JvmPluginDescription.kt:67)
|
||||
net.mamoe.mirai.console.KotlinP.<init>(TestMiraiConosle.kt:34)
|
||||
net.mamoe.mirai.console.KotlinP.<clinit>(TestMiraiConosle.kt:34)
|
||||
net.mamoe.mirai.console.TestMiraiConosleKt.main(TestMiraiConosle.kt:37)
|
||||
net.mamoe.mirai.console.TestMiraiConosleKt.main(TestMiraiConosle.kt)
|
||||
*/
|
||||
val traces = Thread.currentThread().stackTrace
|
||||
Class.forName(traces[3].className).classLoader
|
||||
}.getOrNull()
|
||||
}
|
@ -14,12 +14,11 @@ package net.mamoe.mirai.console.plugin.jvm
|
||||
import kotlinx.serialization.Serializable
|
||||
import net.mamoe.mirai.console.compiler.common.ResolveContext
|
||||
import net.mamoe.mirai.console.compiler.common.ResolveContext.Kind.*
|
||||
import net.mamoe.mirai.console.internal.util.getCallerClassloader
|
||||
import net.mamoe.mirai.console.plugin.description.PluginDependency
|
||||
import net.mamoe.mirai.console.plugin.description.PluginDescription
|
||||
import net.mamoe.mirai.console.util.SemVersion
|
||||
import net.mamoe.yamlkt.Yaml
|
||||
import sun.reflect.CallerSensitive
|
||||
import sun.reflect.Reflection
|
||||
|
||||
/**
|
||||
* JVM 插件的描述. 通常作为 `plugin.yml`
|
||||
@ -62,12 +61,19 @@ public interface JvmPluginDescription : PluginDescription {
|
||||
block: JvmPluginDescriptionBuilder.() -> Unit = {},
|
||||
): JvmPluginDescription = error("Shouldn't be called")
|
||||
|
||||
/**
|
||||
* 从 [pluginClassloader] 读取资源文件 [filename] 并以 YAML 格式解析为 [SimpleJvmPluginDescription]
|
||||
*
|
||||
* @param filename [ClassLoader.getResourceAsStream] 的参数 `name`
|
||||
* @param pluginClassloader 默认通过 [Thread.getStackTrace] 获取调用方 [Class] 然后获取其 [Class.getClassLoader].
|
||||
*/
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
@CallerSensitive
|
||||
public fun loadFromResource(filename: String = "config.yaml"): JvmPluginDescription {
|
||||
val callerClass = Reflection.getCallerClass()
|
||||
val stream = callerClass.getResourceAsStream(filename) ?: callerClass.classLoader.getResourceAsStream(filename)
|
||||
?: error("Cannot find plugin description resource")
|
||||
public fun loadFromResource(
|
||||
filename: String = "plugin.yml",
|
||||
pluginClassloader: ClassLoader = getCallerClassloader() ?: error("Cannot find caller classloader, please specify manually."),
|
||||
): JvmPluginDescription {
|
||||
val stream = pluginClassloader.getResourceAsStream(filename) ?: error("Cannot find plugin description resource '$filename'")
|
||||
|
||||
val bytes = stream.use { it.readBytes() }
|
||||
|
||||
|
@ -26,12 +26,13 @@ import net.mamoe.mirai.console.internal.data.map
|
||||
import net.mamoe.mirai.console.internal.util.semver.SemVersionInternal
|
||||
import net.mamoe.mirai.console.util.SemVersion.Companion.equals
|
||||
import net.mamoe.mirai.console.util.SemVersion.Requirement
|
||||
import net.mamoe.mirai.console.util.SemVersion.SemVersionAsStringSerializer
|
||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
||||
|
||||
/**
|
||||
* [语义化版本](https://semver.org/lang/zh-CN/) 支持
|
||||
*
|
||||
* 解析示例:
|
||||
* ### 解析示例
|
||||
*
|
||||
* `1.0.0-M4+c25733b8` 将会解析出下面的内容,
|
||||
* [major] (主本号), [minor] (次版本号), [patch] (修订号), [identifier] (先行版本号) 和 [metadata] (元数据).
|
||||
@ -48,10 +49,13 @@ import kotlin.LazyThreadSafetyMode.PUBLICATION
|
||||
*
|
||||
* 对于核心版本号, 此实现稍微比语义化版本规范宽松一些, 允许 x.y 的存在.
|
||||
*
|
||||
* ### 序列化
|
||||
* 使用 [SemVersionAsStringSerializer], [SemVersion] 被序列化为 [toString] 的字符串.
|
||||
*
|
||||
* @see Requirement 版本号要修
|
||||
* @see SemVersion.invoke 由字符串解析
|
||||
*/
|
||||
@Serializable(with = SemVersion.SemVersionAsStringSerializer::class)
|
||||
@Serializable(with = SemVersionAsStringSerializer::class)
|
||||
public data class SemVersion
|
||||
/**
|
||||
* @see SemVersion.invoke 字符串解析
|
||||
@ -88,26 +92,43 @@ internal constructor(
|
||||
*
|
||||
* @see [SemVersion.parseRangeRequirement]
|
||||
*/
|
||||
val rule: String
|
||||
val rule: String,
|
||||
) {
|
||||
init {
|
||||
kotlin.runCatching {
|
||||
parseRangeRequirement(rule)
|
||||
}.onFailure {
|
||||
throw java.lang.IllegalArgumentException("Syntax error: $rule", it)
|
||||
}
|
||||
}
|
||||
|
||||
@Transient
|
||||
private val impl = SemVersionInternal.parseRangeRequirement(rule)
|
||||
|
||||
/** 在 [version] 满足此要求时返回 true */
|
||||
public fun test(version: SemVersion): Boolean = impl.test(version)
|
||||
|
||||
/**
|
||||
* 序列化为字符串, [rule]. 从字符串反序列化, [parseRangeRequirement].
|
||||
*/
|
||||
public object RequirementAsStringSerializer : KSerializer<Requirement> by String.serializer().map(
|
||||
serializer = { it.rule },
|
||||
deserializer = { parseRangeRequirement(it) }
|
||||
)
|
||||
|
||||
public companion object {
|
||||
/**
|
||||
* @see parseRangeRequirement
|
||||
*/
|
||||
@JvmSynthetic
|
||||
public operator fun invoke(@ResolveContext(VERSION_REQUIREMENT) requirement: String): Requirement =
|
||||
parseRangeRequirement(requirement)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用 [SemVersion.toString] 序列化, 使用 [SemVersion.invoke] 反序列化.
|
||||
*/
|
||||
public object SemVersionAsStringSerializer : KSerializer<SemVersion> by String.serializer().map(
|
||||
serializer = { it.toString() },
|
||||
deserializer = { SemVersion(it) }
|
||||
@ -170,8 +191,8 @@ internal constructor(
|
||||
*/
|
||||
@JvmStatic
|
||||
@Throws(IllegalArgumentException::class)
|
||||
public fun parseRangeRequirement(@ResolveContext(VERSION_REQUIREMENT) requirement: String): Requirement =
|
||||
Requirement(requirement)
|
||||
public fun parseRangeRequirement(@ResolveContext(VERSION_REQUIREMENT) rule: String): Requirement =
|
||||
Requirement(rule)
|
||||
|
||||
/** @see [Requirement.test] */
|
||||
@JvmStatic
|
||||
@ -223,7 +244,11 @@ internal constructor(
|
||||
public override fun toString(): String = toString
|
||||
|
||||
/**
|
||||
* 将 [SemVersion] 转为 Kotlin data class 风格的 [String]
|
||||
* 将 [SemVersion] 转为 Kotlin data class 风格的 [String].
|
||||
*
|
||||
* ```
|
||||
* return "SemVersion(major=$major, minor=$minor, patch=$patch, identifier=$identifier, metadata=$metadata)"
|
||||
* ```
|
||||
*/
|
||||
public fun toStructuredString(): String {
|
||||
return "SemVersion(major=$major, minor=$minor, patch=$patch, identifier=$identifier, metadata=$metadata)"
|
||||
|
@ -43,14 +43,22 @@ subprojects {
|
||||
}
|
||||
|
||||
val experimentalAnnotations = arrayOf(
|
||||
"kotlin.Experimental",
|
||||
"kotlin.RequiresOptIn",
|
||||
"kotlin.ExperimentalUnsignedTypes",
|
||||
// "kotlin.ExperimentalStdlibApi",
|
||||
"kotlin.ExperimentalStdlibApi",
|
||||
"kotlin.contracts.ExperimentalContracts",
|
||||
"kotlin.time.ExperimentalTime",
|
||||
"kotlin.experimental.ExperimentalTypeInference",
|
||||
// "kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"kotlinx.serialization.ExperimentalSerializationApi",
|
||||
"io.ktor.util.KtorExperimentalAPI",
|
||||
"kotlin.time.ExperimentalTime"
|
||||
|
||||
"net.mamoe.mirai.utils.MiraiInternalAPI",
|
||||
"net.mamoe.mirai.utils.MiraiExperimentalAPI",
|
||||
"net.mamoe.mirai.console.ConsoleFrontEndImplementation",
|
||||
"net.mamoe.mirai.console.util.ConsoleExperimentalApi",
|
||||
"net.mamoe.mirai.console.util.ConsoleInternalApi"
|
||||
)
|
||||
|
||||
|
||||
@ -139,10 +147,11 @@ fun Project.configureSourceSets() {
|
||||
fun Project.configureKotlinExperimentalUsages() {
|
||||
val sourceSets = kotlinSourceSets ?: return
|
||||
|
||||
for (target in sourceSets) {
|
||||
for (target in sourceSets) target.languageSettings.run {
|
||||
enableLanguageFeature("InlineClasses")
|
||||
progressiveMode = true
|
||||
experimentalAnnotations.forEach { a ->
|
||||
target.languageSettings.useExperimentalAnnotation(a)
|
||||
//target.languageSettings.enableLanguageFeature("InlineClasses")
|
||||
useExperimentalAnnotation(a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,17 +7,21 @@
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
@file:Suppress("MemberVisibilityCanBePrivate")
|
||||
@file:Suppress("MemberVisibilityCanBePrivate", "ObjectPropertyName", "unused")
|
||||
|
||||
object Versions {
|
||||
const val core = "1.3.3"
|
||||
const val console = "1.0-RC2-dev-3"
|
||||
const val console = "1.0-RC2-dev-4"
|
||||
const val consoleGraphical = "0.0.7"
|
||||
const val consoleTerminal = console
|
||||
|
||||
const val kotlinCompiler = "1.4.20-RC"
|
||||
const val kotlinStdlib = "1.4.10"
|
||||
|
||||
const val kotlinIntellijPlugin = "1.4.20-RC-IJ2020.2-1" // -release
|
||||
const val intellij = "2020.2.1"
|
||||
|
||||
|
||||
const val coroutines = "1.4.0"
|
||||
const val serialization = "1.0.1"
|
||||
const val ktor = "1.4.1"
|
||||
@ -28,5 +32,34 @@ object Versions {
|
||||
const val bintray = "1.8.5"
|
||||
|
||||
const val blockingBridge = "1.4.1"
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
const val yamlkt = "0.7.1"
|
||||
|
||||
const val intellijGradlePlugin = "0.4.16"
|
||||
}
|
||||
|
||||
const val `kotlin-compiler` = "org.jetbrains.kotlin:kotlin-compiler:${Versions.kotlinCompiler}"
|
||||
|
||||
const val `kotlin-stdlib` = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlinStdlib}"
|
||||
const val `kotlin-stdlib-jdk8` = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlinStdlib}"
|
||||
const val `kotlin-reflect` = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlinStdlib}"
|
||||
const val `kotlin-test` = "org.jetbrains.kotlin:kotlin-test:${Versions.kotlinStdlib}"
|
||||
const val `kotlin-test-junit5` = "org.jetbrains.kotlin:kotlin-test-junit5:${Versions.kotlinStdlib}"
|
||||
|
||||
const val `kotlinx-coroutines-core` = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}"
|
||||
const val `kotlinx-coroutines-jdk8` = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${Versions.coroutines}"
|
||||
|
||||
const val `kotlinx-serialization-core` = "org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.serialization}"
|
||||
const val `kotlinx-serialization-json` = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.serialization}"
|
||||
const val `kotlinx-serialization-protobuf` = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:${Versions.serialization}"
|
||||
|
||||
const val `kotlinx-atomicfu` = "org.jetbrains.kotlinx:atomicfu:${Versions.atomicFU}"
|
||||
|
||||
const val `mirai-core` = "net.mamoe:mirai-core:${Versions.core}"
|
||||
const val `mirai-core-qqandroid` = "net.mamoe:mirai-core-qqandroid:${Versions.core}"
|
||||
const val `mirai-core-api` = "net.mamoe:mirai-core-api:${Versions.core}"
|
||||
|
||||
const val yamlkt = "net.mamoe.yamlkt:yamlkt:${Versions.yamlkt}"
|
||||
|
||||
const val `jetbrains-annotations` = "org.jetbrains:annotations:19.0.0"
|
||||
|
@ -14,61 +14,12 @@ repositories {
|
||||
version = Versions.console
|
||||
description = "Mirai Console compiler common"
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile::class.java) {
|
||||
options.encoding = "UTF8"
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets.all {
|
||||
target.compilations.all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||
//useIR = true
|
||||
}
|
||||
}
|
||||
languageSettings.apply {
|
||||
progressiveMode = true
|
||||
|
||||
useExperimentalAnnotation("kotlin.Experimental")
|
||||
useExperimentalAnnotation("kotlin.RequiresOptIn")
|
||||
|
||||
useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiInternalAPI")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiExperimentalAPI")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.console.ConsoleFrontEndImplementation")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.console.util.ConsoleExperimentalApi")
|
||||
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
||||
useExperimentalAnnotation("kotlin.experimental.ExperimentalTypeInference")
|
||||
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
||||
useExperimentalAnnotation("kotlinx.serialization.ExperimentalSerializationApi")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.console.util.ConsoleInternalApi")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api("org.jetbrains:annotations:19.0.0")
|
||||
api(kotlinx("coroutines-jdk8", Versions.coroutines))
|
||||
api(`jetbrains-annotations`)
|
||||
// api(`kotlinx-coroutines-jdk8`)
|
||||
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-compiler:${Versions.kotlinCompiler}")
|
||||
testRuntimeOnly("org.jetbrains.kotlin:kotlin-compiler:${Versions.kotlinCompiler}")
|
||||
|
||||
testApi(kotlin("test"))
|
||||
testApi(kotlin("test-junit5"))
|
||||
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.2.0")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.2.0")
|
||||
}
|
||||
|
||||
tasks {
|
||||
"test"(Test::class) {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
compileOnly(`kotlin-compiler`)
|
||||
testRuntimeOnly(`kotlin-compiler`)
|
||||
}
|
||||
|
||||
setupPublishing("mirai-console-compiler-common")
|
@ -25,15 +25,7 @@ dependencies {
|
||||
compileOnly(kotlin("stdlib"))
|
||||
|
||||
api("com.github.jengelman.gradle.plugins:shadow:6.0.0")
|
||||
api("org.jetbrains:annotations:19.0.0")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testApi(kotlin("test"))
|
||||
testApi(kotlin("test-junit5"))
|
||||
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.2.0")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.2.0")
|
||||
api(`jetbrains-annotations`)
|
||||
}
|
||||
|
||||
version = Versions.console
|
||||
@ -56,35 +48,16 @@ gradlePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets.all {
|
||||
target.compilations.all {
|
||||
kotlinOptions {
|
||||
apiVersion = "1.3"
|
||||
languageVersion = "1.3"
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||
}
|
||||
}
|
||||
languageSettings.apply {
|
||||
progressiveMode = true
|
||||
|
||||
useExperimentalAnnotation("kotlin.RequiresOptIn")
|
||||
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
||||
useExperimentalAnnotation("kotlin.experimental.ExperimentalTypeInference")
|
||||
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
||||
}
|
||||
kotlin.target.compilations.all {
|
||||
kotlinOptions {
|
||||
apiVersion = "1.3"
|
||||
languageVersion = "1.3"
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
"test"(Test::class) {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
val compileKotlin by getting {}
|
||||
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val fillBuildConstants by registering {
|
||||
group = "mirai"
|
||||
doLast {
|
||||
@ -108,13 +81,4 @@ tasks {
|
||||
compileKotlin.dependsOn(fillBuildConstants)
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile::class.java) {
|
||||
options.encoding = "UTF8"
|
||||
}
|
||||
|
||||
setupPublishing("mirai-console-gradle")
|
@ -10,6 +10,6 @@
|
||||
package net.mamoe.mirai.console.gradle
|
||||
|
||||
internal object VersionConstants {
|
||||
const val CONSOLE_VERSION = "1.0-RC2-dev-3" // value is written here automatically during build
|
||||
const val CONSOLE_VERSION = "1.0-RC2-dev-4" // value is written here automatically during build
|
||||
const val CORE_VERSION = "1.3.3" // value is written here automatically during build
|
||||
}
|
@ -6,8 +6,7 @@ plugins {
|
||||
`maven-publish`
|
||||
id("com.jfrog.bintray")
|
||||
|
||||
id("org.jetbrains.intellij") version "0.4.16"
|
||||
|
||||
id("org.jetbrains.intellij") version Versions.intellijGradlePlugin
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -17,23 +16,14 @@ repositories {
|
||||
version = Versions.console
|
||||
description = "IntelliJ plugin for Mirai Console"
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile::class.java) {
|
||||
options.encoding = "UTF8"
|
||||
}
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = "2020.2.1"
|
||||
version = Versions.intellij
|
||||
isDownloadSources = true
|
||||
updateSinceUntilBuild = false
|
||||
|
||||
setPlugins(
|
||||
"org.jetbrains.kotlin:1.4.20-RC-IJ2020.2-1@eap",
|
||||
"org.jetbrains.kotlin:${Versions.kotlinIntellijPlugin}@eap",
|
||||
"java"
|
||||
)
|
||||
}
|
||||
@ -62,59 +52,18 @@ tasks.withType<org.jetbrains.intellij.tasks.PatchPluginXmlTask> {
|
||||
</ul>
|
||||
""".trimIndent())
|
||||
changeNotes("""
|
||||
Initial release
|
||||
See https://github.com/mamoe/mirai-console/releases
|
||||
""".trimIndent())
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets.all {
|
||||
target.compilations.all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||
//useIR = true
|
||||
}
|
||||
}
|
||||
languageSettings.apply {
|
||||
progressiveMode = true
|
||||
|
||||
useExperimentalAnnotation("kotlin.Experimental")
|
||||
useExperimentalAnnotation("kotlin.RequiresOptIn")
|
||||
|
||||
useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiInternalAPI")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiExperimentalAPI")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.console.ConsoleFrontEndImplementation")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.console.util.ConsoleExperimentalApi")
|
||||
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
||||
useExperimentalAnnotation("kotlin.experimental.ExperimentalTypeInference")
|
||||
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
||||
useExperimentalAnnotation("kotlinx.serialization.ExperimentalSerializationApi")
|
||||
useExperimentalAnnotation("net.mamoe.mirai.console.util.ConsoleInternalApi")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api("org.jetbrains:annotations:19.0.0")
|
||||
api(kotlinx("coroutines-jdk8", Versions.coroutines))
|
||||
api(`jetbrains-annotations`)
|
||||
api(`kotlinx-coroutines-jdk8`)
|
||||
|
||||
api(project(":mirai-console-compiler-common"))
|
||||
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-compiler:${Versions.kotlinCompiler}")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-compiler:${Versions.kotlinCompiler}")
|
||||
compileOnly(`kotlin-compiler`)
|
||||
compileOnly(files("libs/ide-common.jar"))
|
||||
|
||||
testApi(kotlin("test"))
|
||||
testApi(kotlin("test-junit5"))
|
||||
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.2.0")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.2.0")
|
||||
}
|
||||
|
||||
tasks {
|
||||
"test"(Test::class) {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
|
||||
setupPublishing("mirai-console-intellij")
|
Loading…
Reference in New Issue
Block a user