| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- /*
- * Copyright 2019-2022 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/dev/LICENSE
- */
- @file:Suppress("UnusedImport")
- import java.util.*
- plugins {
- kotlin("jvm")
- kotlin("plugin.serialization")
- id("java")
- }
- version = Versions.console
- description = "Mirai Console Backend Real-Time Testing Unit"
- kotlin {
- explicitApiWarning()
- }
- dependencies {
- api(project(":mirai-core-api"))
- api(project(":mirai-core-utils"))
- testRuntimeOnly(project(":mirai-core"))
- api(project(":mirai-console-compiler-annotations"))
- api(project(":mirai-console"))
- api(project(":mirai-console-terminal"))
- api(`kotlin-stdlib-jdk8`)
- api(`kotlinx-atomicfu-jvm`)
- api(`kotlinx-coroutines-core-jvm`)
- api(`kotlinx-serialization-core-jvm`)
- api(`kotlinx-serialization-json-jvm`)
- api(`kotlin-reflect`)
- api(`kotlin-test-junit5`)
- api(`yamlkt-jvm`)
- api(`jetbrains-annotations`)
- api(`caller-finder`)
- api(`kotlinx-coroutines-jdk8`)
- val asmVersion = Versions.asm
- fun asm(module: String) = "org.ow2.asm:asm-$module:$asmVersion"
- api(asm("tree"))
- api(asm("util"))
- api(asm("commons"))
- }
- // requires manual run
- val deleteSandbox = tasks.register("deleteSandbox", Delete::class.java) {
- group = "mirai"
- delete("build/IntegrationTest")
- }
- //tasks.getByName("clean").dependsOn(deleteSandbox)
- val subplugins = mutableListOf<TaskProvider<Jar>>()
- val mcit_test = tasks.named<Test>("test")
- mcit_test.configure {
- val test0 = this
- doFirst {
- // For IDEA Debugging
- @Suppress("UNNECESSARY_NOT_NULL_ASSERTION")
- val extArgs = test0.jvmArgs!!.asSequence().map { extArg ->
- Base64.getEncoder().encodeToString(extArg.toByteArray())
- }.joinToString(",")
- test0.jvmArgs = mutableListOf()
- test0.environment("IT_ARGS", extArgs)
- // For plugins coping
- val jars = subplugins.asSequence()
- .map { it.get() }
- .flatMap { it.outputs.files.files.asSequence() }
- .toList()
- test0.environment("IT_PLUGINS", jars.size)
- jars.forEachIndexed { index, jar ->
- test0.environment("IT_PLUGINS_$index", jar.absolutePath)
- }
- }
- }
- val crtProject = project
- allprojects {
- if (project != crtProject) {
- project.afterEvaluate {
- val tk = tasks.named<Jar>("jar")
- subplugins.add(tk)
- mcit_test.configure { dependsOn(tk) }
- }
- }
- }
|