Skip to content

Commit

Permalink
build: 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Nov 9, 2022
1 parent d4b1801 commit 929baee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "xyz.cssxsh.mirai"
version = "1.2.0"
version = "1.2.1"

mavenCentralPublish {
useCentralS01()
Expand Down
15 changes: 12 additions & 3 deletions src/main/kotlin/xyz/cssxsh/mirai/skia/MiraiSkiaDownloader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,20 @@ public suspend fun loadJNILibrary(folder: File) {
with(folder.resolve(skiko)) {
val version = folder.resolve("skia.version.txt")
val maven = "$SKIKO_MAVEN/org/jetbrains/skiko/$SKIKO_PACKAGE/$SKIKO_VERSION/$SKIKO_PACKAGE-$SKIKO_VERSION.jar"
val huawei = "https://repo.huaweicloud.com/repository/maven/org/jetbrains/skiko/$SKIKO_PACKAGE/$SKIKO_VERSION/$SKIKO_PACKAGE-$SKIKO_VERSION.jar"
logger.debug { maven }
if (version.exists().not() || version.readText() != SKIKO_VERSION) delete()

if (exists().not()) {
val file = download(urlString = maven, folder = folder)
val file = try {
download(urlString = maven, folder = folder)
} catch (cause: IOException) {
try {
download(urlString = huawei, folder = folder)
} catch (_: IOException) {
throw cause
}
}
val jar = JarFile(file)

outputStream().use { output ->
Expand Down Expand Up @@ -318,10 +327,10 @@ public suspend fun loadJNILibrary(folder: File) {
if (exists().not()) {
try {
download(urlString = release, folder = folder)
} catch (cause: Exception) {
} catch (cause: IOException) {
try {
download(urlString = origin, folder = folder)
} catch (_: Exception) {
} catch (_: IOException) {
throw cause
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/xyz/cssxsh/mirai/skia/MiraiSkiaPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public object MiraiSkiaPlugin : KotlinPlugin(
JvmPluginDescription(
id = "xyz.cssxsh.mirai.plugin.mirai-skia-plugin",
name = "mirai-skia-plugin",
version = "1.2.0",
version = "1.2.1",
) {
author("cssxsh")
}
Expand All @@ -28,6 +28,7 @@ public object MiraiSkiaPlugin : KotlinPlugin(
@OptIn(ConsoleExperimentalApi::class)
internal val process: Closeable? by lazy {
try {
check(SemVersion.parseRangeRequirement("> 2.13.0").test(MiraiConsole.version))
val impl = MiraiConsole.newProcessProgress()
listener = { file ->
launch {
Expand All @@ -52,6 +53,7 @@ public object MiraiSkiaPlugin : KotlinPlugin(
}
}

@PublishedApi
internal val loadJob: Job = launch(start = CoroutineStart.LAZY) {
checkPlatform()
process
Expand Down

0 comments on commit 929baee

Please sign in to comment.