6.3.1 - 新增发布通知权限 / WS 实例创建; 修复 floaty 模块异常 / 安卓 7.x 异常; UI 模式增强; 迁移至 View Binding
This commit is contained in:
198
build.gradle.kts
198
build.gradle.kts
@@ -2,11 +2,110 @@
|
||||
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
extra {
|
||||
extra["configurationName"] = "default"
|
||||
extra.apply {
|
||||
set("configurationName", "default")
|
||||
}
|
||||
|
||||
buildscript {
|
||||
|
||||
/* --== variables ==-- */
|
||||
|
||||
// @Hint by SuperMonster003 on May 3, 2023.
|
||||
// ! To download archives of Android Studio,
|
||||
// ! visit https://developer.android.com/studio/archive
|
||||
// ! To check the compatibility and released date of kotlin plugins,
|
||||
// ! visit https://plugins.jetbrains.com/plugin/6954-kotlin/versions/eap
|
||||
|
||||
val gradlePluginVersionList = mapOf(
|
||||
"as" to mapOf(
|
||||
"abbr" to mapOf(
|
||||
"Preview2023.1" to "H", /* May 13, 2023. */
|
||||
"Preview2022.3" to "G", /* May 3, 2023. */
|
||||
"2022.2" to "F", /* May 3, 2023. */
|
||||
"Preview2022.2" to "F", /* May 3, 2023. */
|
||||
"2022.1" to "E", /* May 3, 2023. */
|
||||
),
|
||||
"android" to mapOf(
|
||||
"Preview2023.1" to "8.2.0-alpha05", /* May 26, 2023. */
|
||||
"Preview2022.3" to "8.1.0-beta03", /* May 26 2023. */
|
||||
"2022.2" to "8.0.2", /* May 26, 2023. */
|
||||
"Preview2022.2" to "8.0.0-beta05", /* Mar 25, 2023. */
|
||||
"2022.1" to "7.4.2", /* Mar 25, 2023. */
|
||||
"fallback" to "7.4.2", /* May 3, 2023. */
|
||||
),
|
||||
"kotlin" to mapOf(
|
||||
"Preview2023.1" to "1.8.0", /* May 13, 2023. */
|
||||
"Preview2022.3" to "1.8.0", /* May 13, 2023. */
|
||||
"2022.2" to "1.8.20-RC2", /* Mar 23, 2023. */
|
||||
"Preview2022.2" to "1.8.0", /* Mar 23, 2023. */
|
||||
"2022.1" to "1.8.0-RC2", /* Dec 20, 2022. */
|
||||
"fallback" to "1.8.0-RC2", /* May 3, 2023. */
|
||||
)
|
||||
),
|
||||
"idea" to mapOf(
|
||||
"android" to mapOf(
|
||||
"2023.1" to "7.4.2", /* May 26, 2023. */
|
||||
"2022.3" to "7.4.0-beta02", /* Mar 25, 2023. */
|
||||
"fallback" to "7.4.0", /* May 3, 2023. */
|
||||
),
|
||||
"kotlin" to mapOf(
|
||||
// CAUTION by SuperMonster003 on May 26, 2023.
|
||||
// ! Do not update to "1.9.0-Beta" for now.
|
||||
"2023.1" to "1.8.21", /* Apr 25, 2023. */
|
||||
"2022.3" to "1.8.21", /* Apr 25, 2023. */
|
||||
"fallback" to "1.8.21", /* May 3, 2023. */
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val platform = System.getProperty("idea.paths.selector")
|
||||
val platformIdentifierForAS = "AndroidStudio"
|
||||
val platformIdentifierForIdea = "IntelliJIdea"
|
||||
|
||||
val isPlatformAS = platform.startsWith(platformIdentifierForAS)
|
||||
val isPlatformIdea = platform.startsWith(platformIdentifierForIdea)
|
||||
|
||||
val platformVersion = when {
|
||||
isPlatformAS -> platform.substring(platformIdentifierForAS.length)
|
||||
isPlatformIdea -> platform.substring(platformIdentifierForIdea.length)
|
||||
else -> "Unknown"
|
||||
}
|
||||
|
||||
val platformType = when {
|
||||
isPlatformAS -> "as"
|
||||
isPlatformIdea -> "idea"
|
||||
else -> throw Exception("Unknown platform: $platform")
|
||||
}
|
||||
|
||||
val platformNicknameForAS = mapOf(
|
||||
"A" to "Arctic Fox",
|
||||
"B" to "Bumblebee",
|
||||
"C" to "Chipmunk",
|
||||
"D" to "Dolphin",
|
||||
"E" to "Electric Eel",
|
||||
"F" to "Flamingo",
|
||||
"G" to "Giraffe",
|
||||
"H" to "Hedgehog",
|
||||
)
|
||||
|
||||
fun printCurrentPlatformInfo() = when {
|
||||
isPlatformAS -> {
|
||||
val platformNickAbbr = gradlePluginVersionList["as"]!!["abbr"]!![platformVersion]
|
||||
val platformNick = platformNickAbbr?.let { abbr -> platformNicknameForAS[abbr]?.let { " $it" } } ?: ""
|
||||
|
||||
val previewIdentifier = "Preview"
|
||||
val isPreview = platformVersion.contains(previewIdentifier, true)
|
||||
val previewSuffix = if (isPreview) " ($previewIdentifier)" else ""
|
||||
val niceVersion = if (isPreview) platformVersion.substring(previewIdentifier.length) else platformVersion
|
||||
|
||||
"Android Studio$platformNick$previewSuffix | $niceVersion"
|
||||
}
|
||||
isPlatformIdea -> "IntelliJ IDEA $platformVersion"
|
||||
else -> "Unknown"
|
||||
}.let { println("Platform: $it") }
|
||||
|
||||
/* --== repositories ==-- */
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
@@ -18,94 +117,27 @@ buildscript {
|
||||
maven("https://repo.huaweicloud.com/repository/maven")
|
||||
}
|
||||
|
||||
dependencies /* Kotlin Gradle Plugin */ {
|
||||
// @Alter classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20-RC2")
|
||||
classpath(kotlin(module = "gradle-plugin", version = "1.8.20-RC2"))
|
||||
/* --== dependencies ==-- */
|
||||
|
||||
// @Histories for latest three. */
|
||||
/* [ 1.8.0-RC2, 1.8.20-Beta, 1.8.20-RC ] */
|
||||
dependencies /* Print Information. */ {
|
||||
printCurrentPlatformInfo()
|
||||
}
|
||||
|
||||
dependencies /* Android Gradle Plugin */ {
|
||||
val platform = System.getProperty("idea.paths.selector")
|
||||
dependencies /* Android/Kotlin Gradle Plugin. */ {
|
||||
val android = gradlePluginVersionList[platformType]!!["android"]!!
|
||||
val kotlin = gradlePluginVersionList[platformType]!!["kotlin"]!!
|
||||
|
||||
fun fallback(classpath: String) {
|
||||
println("Current platform info: $platform")
|
||||
println("Dependency to the script classpath may need be specified manually")
|
||||
println("The fallback classpath is \"$classpath\"")
|
||||
this.classpath(classpath)
|
||||
}
|
||||
|
||||
fun setClasspath(classpath: String) {
|
||||
println("Current classpath: $classpath")
|
||||
this.classpath(classpath)
|
||||
}
|
||||
|
||||
// @Updated by SuperMonster003 on Mar 25, 2023.
|
||||
val fallbackClasspathForAS = "com.android.tools.build:gradle:7.4.2"
|
||||
|
||||
// @Updated by SuperMonster003 on Mar 30, 2023.
|
||||
val fallbackClasspathForIDEA = "com.android.tools.build:gradle:7.4.0"
|
||||
|
||||
// @Updated by SuperMonster003 on Mar 25, 2023.
|
||||
val fallbackClasspathForUnknown = fallbackClasspathForAS
|
||||
|
||||
when {
|
||||
platform.startsWith("AndroidStudio") || System.getProperty("idea.platform.prefix") == "AndroidStudio" -> {
|
||||
when (platform) {
|
||||
// @Created by SuperMonster003 on Apr 16, 2023.
|
||||
"AndroidStudio2022.2" -> {
|
||||
println("Current platform: Android Studio Flamingo | 2022.2")
|
||||
setClasspath("com.android.tools.build:gradle:8.0.0")
|
||||
}
|
||||
// @Created by SuperMonster003 on Mar 25, 2023.
|
||||
"AndroidStudio2022.1" -> {
|
||||
println("Current platform: Android Studio Electric Eel | 2022.1")
|
||||
setClasspath("com.android.tools.build:gradle:7.4.2")
|
||||
}
|
||||
// @Created by SuperMonster003 on Mar 25, 2023.
|
||||
"AndroidStudioPreview2022.2" -> {
|
||||
println("Current platform: Android Studio Flamingo | 2022.2")
|
||||
setClasspath("com.android.tools.build:gradle:8.0.0-beta05")
|
||||
}
|
||||
// @Created by SuperMonster003 on Mar 25, 2023.
|
||||
"AndroidStudioPreview2022.3" -> {
|
||||
println("Current platform: Android Studio Giraffe | 2022.3")
|
||||
setClasspath("com.android.tools.build:gradle:8.1.0-alpha10")
|
||||
}
|
||||
else -> {
|
||||
println("Current platform: $platform")
|
||||
println("Fallback classpass for Android Studio will be used")
|
||||
setClasspath(fallbackClasspathForAS)
|
||||
}
|
||||
}
|
||||
}
|
||||
platform.startsWith("IntelliJIdea") -> {
|
||||
when (platform) {
|
||||
// @Created by SuperMonster003 on Mar 30, 2023.
|
||||
"IntelliJIdea2023.1" -> {
|
||||
println("Current platform: IntelliJ IDEA 2022.3")
|
||||
setClasspath("com.android.tools.build:gradle:7.4.0")
|
||||
}
|
||||
// @Created by SuperMonster003 on Mar 25, 2023.
|
||||
"IntelliJIdea2022.3" -> {
|
||||
println("Current platform: IntelliJ IDEA 2022.3")
|
||||
setClasspath("com.android.tools.build:gradle:7.4.0-beta02")
|
||||
}
|
||||
else -> {
|
||||
println("Current platform: $platform")
|
||||
println("Fallback classpass for IntelliJ IDEA will be used")
|
||||
fallback(fallbackClasspathForIDEA)
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> fallback(fallbackClasspathForUnknown)
|
||||
arrayOf(
|
||||
arrayOf("com.android.tools.build:gradle", android[platformVersion], android["fallback"]),
|
||||
arrayOf("org.jetbrains.kotlin:kotlin-gradle-plugin", kotlin[platformVersion], kotlin["fallback"]),
|
||||
).forEach { data ->
|
||||
val classpathNotation = "${data[0]}:${data[1] ?: data[2]}"
|
||||
val suffix = data[1]?.let { "" } ?: " [fallback]"
|
||||
println("Classpath: \"$classpathNotation\"$suffix")
|
||||
classpath(classpathNotation)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies /* ButterKnife Gradle Plugin */ {
|
||||
classpath("com.jakewharton:butterknife-gradle-plugin:10.2.3")
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
||||
Reference in New Issue
Block a user