2
0

build.gradle.kts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright 2019-2022 Mamoe Technologies and contributors.
  3. *
  4. * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
  5. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
  6. *
  7. * https://github.com/mamoe/mirai/blob/dev/LICENSE
  8. */
  9. @file:Suppress("UNUSED_VARIABLE")
  10. import BinaryCompatibilityConfigurator.configureBinaryValidators
  11. plugins {
  12. kotlin("multiplatform")
  13. // id("kotlinx-atomicfu")
  14. kotlin("plugin.serialization")
  15. id("me.him188.kotlin-jvm-blocking-bridge")
  16. id("me.him188.kotlin-dynamic-delegation")
  17. `maven-publish`
  18. }
  19. description = "Mirai Protocol implementation for QQ Android"
  20. kotlin {
  21. explicitApi()
  22. configureHMPPJvm()
  23. sourceSets.apply {
  24. val commonMain by getting {
  25. dependencies {
  26. api(project(":mirai-core-api"))
  27. api(`kotlinx-serialization-core`)
  28. api(`kotlinx-serialization-json`)
  29. api(`kotlinx-coroutines-core`)
  30. implementation(project(":mirai-core-utils"))
  31. implementation(`kotlinx-serialization-protobuf`)
  32. implementation(`kotlinx-atomicfu`)
  33. implementation(`ktor-io`)
  34. }
  35. }
  36. commonTest {
  37. dependencies {
  38. implementation(kotlin("script-runtime"))
  39. api(yamlkt)
  40. }
  41. }
  42. val jvmBaseMain by getting {
  43. dependencies {
  44. implementation(bouncycastle)
  45. implementation(`log4j-api`)
  46. implementation(`netty-all`)
  47. }
  48. }
  49. if (isAndroidSDKAvailable) {
  50. val androidMain by getting {
  51. dependsOn(commonMain)
  52. dependencies {
  53. compileOnly(`android-runtime`)
  54. }
  55. }
  56. val androidTest by getting {
  57. dependencies {
  58. implementation(kotlin("test", Versions.kotlinCompiler))
  59. implementation(kotlin("test-junit5", Versions.kotlinCompiler))
  60. implementation(kotlin("test-annotations-common"))
  61. implementation(kotlin("test-common"))
  62. //implementation("org.bouncycastle:bcprov-jdk15on:1.64")
  63. }
  64. }
  65. }
  66. val jvmMain by getting {
  67. dependencies {
  68. //implementation("org.bouncycastle:bcprov-jdk15on:1.64")
  69. // api(kotlinx("coroutines-debug", Versions.coroutines))
  70. }
  71. }
  72. val jvmTest by getting {
  73. dependencies {
  74. api(`kotlinx-coroutines-debug`)
  75. // implementation("net.mamoe:mirai-login-solver-selenium:1.0-dev-14")
  76. }
  77. }
  78. val nativeMain by getting {
  79. dependencies {
  80. }
  81. }
  82. }
  83. }
  84. if (isAndroidSDKAvailable) {
  85. tasks.register("checkAndroidApiLevel") {
  86. doFirst {
  87. analyzes.AndroidApiLevelCheck.check(
  88. buildDir.resolve("classes/kotlin/android/main"),
  89. project.property("mirai.android.target.api.level")!!.toString().toInt(),
  90. project
  91. )
  92. }
  93. group = "verification"
  94. this.mustRunAfter("androidMainClasses")
  95. }
  96. tasks.getByName("androidTest").dependsOn("checkAndroidApiLevel")
  97. }
  98. configureMppPublishing()
  99. configureBinaryValidators("jvm", "android")