mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 23:50:08 +08:00
Better Android SDK checking
This commit is contained in:
parent
ddeb174aff
commit
27819d7343
@ -15,6 +15,15 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
def keyProps = new Properties()
|
||||
def keyFile = file("local.properties")
|
||||
if (keyFile.exists()) keyFile.withInputStream { keyProps.load(it) }
|
||||
if (!keyProps.getProperty("sdk.dir", "").isEmpty()) {
|
||||
project.ext.set("isAndroidSDKAvailable", true)
|
||||
} else {
|
||||
project.ext.set("isAndroidSDKAvailable", false)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
group = "net.mamoe"
|
||||
version = getProperty("mirai_version")
|
||||
|
@ -1,5 +1,4 @@
|
||||
@file:Suppress("UNUSED_VARIABLE")
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
@ -32,11 +31,8 @@ description = "QQ protocol library"
|
||||
version = rootProject.ext.get("mirai_version")!!.toString()
|
||||
|
||||
kotlin {
|
||||
|
||||
val keyProps = Properties()
|
||||
val keyFile = file("../local.properties")
|
||||
if (keyFile.exists()) keyProps.load(keyFile.inputStream())
|
||||
if (keyProps.getProperty("sdk.dir", "").isNotEmpty()) {
|
||||
val isAndroidSDKAvailable: Boolean by project
|
||||
if (isAndroidSDKAvailable) {
|
||||
android("android") {
|
||||
publishAllLibraryVariants()
|
||||
project.android {
|
||||
@ -57,7 +53,13 @@ kotlin {
|
||||
println(
|
||||
"""Android SDK 可能未安装.
|
||||
$name 的 Android 目标编译将不会进行.
|
||||
这不会影响 Android 以外的平台的编译, 因此 JVM 等平台相关的编译和测试均能正常进行.
|
||||
这不会影响 Android 以外的平台的编译.
|
||||
""".trimIndent()
|
||||
)
|
||||
println(
|
||||
"""Android SDK might not be installed.
|
||||
Android target of $name will not be compiled.
|
||||
It does no influence on the compilation of other platforms.
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
@file:Suppress("UNUSED_VARIABLE")
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
@ -32,10 +31,8 @@ description = "QQ protocol library"
|
||||
version = rootProject.ext.get("mirai_version")!!.toString()
|
||||
|
||||
kotlin {
|
||||
val keyProps = Properties()
|
||||
val keyFile = file("../local.properties")
|
||||
if (keyFile.exists()) keyProps.load(keyFile.inputStream())
|
||||
if (keyProps.getProperty("sdk.dir", "").isNotEmpty()) {
|
||||
val isAndroidSDKAvailable: Boolean by project
|
||||
if (isAndroidSDKAvailable) {
|
||||
android("android") {
|
||||
publishAllLibraryVariants()
|
||||
project.android {
|
||||
@ -56,7 +53,13 @@ kotlin {
|
||||
println(
|
||||
"""Android SDK 可能未安装.
|
||||
$name 的 Android 目标编译将不会进行.
|
||||
这不会影响 Android 以外的平台的编译, 因此 JVM 等平台相关的编译和测试均能正常进行.
|
||||
这不会影响 Android 以外的平台的编译.
|
||||
""".trimIndent()
|
||||
)
|
||||
println(
|
||||
"""Android SDK might not be installed.
|
||||
Android target of $name will not be compiled.
|
||||
It does no influence on the compilation of other platforms.
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
@file:Suppress("UNUSED_VARIABLE")
|
||||
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
id("kotlinx-atomicfu")
|
||||
@ -32,10 +30,8 @@ fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
|
||||
description = "QQ protocol library"
|
||||
|
||||
kotlin {
|
||||
val keyProps = Properties()
|
||||
val keyFile = file("../local.properties")
|
||||
if (keyFile.exists()) keyProps.load(keyFile.inputStream())
|
||||
if (keyProps.getProperty("sdk.dir", "").isNotEmpty()) {
|
||||
val isAndroidSDKAvailable: Boolean by project
|
||||
if (isAndroidSDKAvailable) {
|
||||
android("android") {
|
||||
publishAllLibraryVariants()
|
||||
project.android {
|
||||
@ -56,7 +52,13 @@ kotlin {
|
||||
println(
|
||||
"""Android SDK 可能未安装.
|
||||
$name 的 Android 目标编译将不会进行.
|
||||
这不会影响 Android 以外的平台的编译, 因此 JVM 等平台相关的编译和测试均能正常进行.
|
||||
这不会影响 Android 以外的平台的编译.
|
||||
""".trimIndent()
|
||||
)
|
||||
println(
|
||||
"""Android SDK might not be installed.
|
||||
Android target of $name will not be compiled.
|
||||
It does no influence on the compilation of other platforms.
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
@ -21,6 +21,17 @@ pluginManagement {
|
||||
|
||||
rootProject.name = 'mirai'
|
||||
|
||||
def keyProps = new Properties()
|
||||
def keyFile = file("local.properties")
|
||||
if (keyFile.exists()) keyFile.withInputStream { keyProps.load(it) }
|
||||
if (!keyProps.getProperty("sdk.dir", "").isEmpty()) {
|
||||
include(':mirai-demos:mirai-demo-android')
|
||||
project(':mirai-demos:mirai-demo-android').projectDir = file('mirai-demos/mirai-demo-android')
|
||||
} else {
|
||||
println("Android SDK 可能未安装. \n将不会加载模块 `mirai-demo-android`, 但这并不影响其他 demo 的加载 ")
|
||||
println("Android SDK might not be installed. \nModule `mirai-demo-android` will not be included, but other demos will not be influenced")
|
||||
}
|
||||
|
||||
include(':mirai-core')
|
||||
include(':mirai-core-timpc')
|
||||
include(':mirai-core-qqandroid')
|
||||
@ -32,16 +43,6 @@ include(':mirai-demos:mirai-demo-1')
|
||||
include(':mirai-demos:mirai-demo-gentleman')
|
||||
include(':mirai-demos')
|
||||
|
||||
def keyProps = new Properties()
|
||||
def keyFile = file("local.properties")
|
||||
if (keyFile.exists()) keyFile.withInputStream { keyProps.load(it) }
|
||||
if (!keyProps.getProperty("sdk.dir", "").isEmpty()) {
|
||||
include(':mirai-demos:mirai-demo-android')
|
||||
project(':mirai-demos:mirai-demo-android').projectDir = file('mirai-demos/mirai-demo-android')
|
||||
} else {
|
||||
println("Android SDK 可能未安装. \n将不会加载模块 `mirai-demo-android`, 但这并不影响其他 demo 的加载 ")
|
||||
}
|
||||
|
||||
def javaVersion = System.getProperty("java.version")
|
||||
if (javaVersion.substring(0, javaVersion.indexOf(".")).toInteger() >= 11) {
|
||||
include(':mirai-debug')
|
||||
|
Loading…
Reference in New Issue
Block a user