mirror of
https://github.com/czp3009/bilibili-api.git
synced 2025-02-19 20:50:28 +08:00
optimize build
This commit is contained in:
parent
10281fa1ce
commit
ce5e7e73ef
@ -39,7 +39,7 @@ dependencies {
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = jvm_target
|
||||
freeCompilerArgs = ["-Xjvm-default=enable", "-Xuse-experimental=kotlin.Experimental", "-XXLanguage:+InlineClasses"]
|
||||
freeCompilerArgs = ["-Xjvm-default=enable", "-Xopt-in=kotlin.RequiresOptIn", "-XXLanguage:+InlineClasses"]
|
||||
}
|
||||
}
|
||||
compileTestKotlin {
|
||||
@ -149,3 +149,7 @@ publishing {
|
||||
signing {
|
||||
sign publishing.publications.mavenJava
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
tasks.signMavenJavaPublication.onlyIf { taskGraph.hasTask tasks.publish }
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.hiczp.bilibili.api
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
internal inline fun <T> list(@BuilderInference block: MutableList<T>.() -> Unit): List<T> {
|
||||
val list = ArrayList<T>()
|
||||
block(list)
|
||||
|
@ -32,7 +32,7 @@ fun InputStream.readFully(length: Int): ByteArray {
|
||||
/**
|
||||
* 以大端模式从流中读取一个 int
|
||||
*/
|
||||
@UseExperimental(ExperimentalUnsignedTypes::class)
|
||||
@OptIn(ExperimentalUnsignedTypes::class)
|
||||
fun InputStream.readInt(): Int {
|
||||
val byteArray = readFully(4)
|
||||
return (byteArray[0].toUByte().toInt() shl 24) or
|
||||
@ -44,13 +44,13 @@ fun InputStream.readInt(): Int {
|
||||
/**
|
||||
* 以大端模式从流中读取一个 unsigned int
|
||||
*/
|
||||
@UseExperimental(ExperimentalUnsignedTypes::class)
|
||||
@OptIn(ExperimentalUnsignedTypes::class)
|
||||
fun InputStream.readUInt() = readInt().toUInt()
|
||||
|
||||
fun InputStream.bounded(size: Long) = BoundedInputStream(this, size)
|
||||
|
||||
@UseExperimental(ExperimentalUnsignedTypes::class)
|
||||
@OptIn(ExperimentalUnsignedTypes::class)
|
||||
fun InputStream.bounded(size: UInt) = bounded(size.toLong())
|
||||
|
||||
@UseExperimental(InternalAPI::class)
|
||||
@OptIn(InternalAPI::class)
|
||||
internal fun ByteArray.toPrettyPrintString() = joinToString(prefix = "[", postfix = "]") { "0x%02x".format(it) }
|
||||
|
@ -49,7 +49,7 @@ class LiveClient(
|
||||
/**
|
||||
* 开启连接
|
||||
*/
|
||||
@UseExperimental(KtorExperimentalAPI::class, ObsoleteCoroutinesApi::class, InternalAPI::class)
|
||||
@OptIn(KtorExperimentalAPI::class, ObsoleteCoroutinesApi::class, InternalAPI::class)
|
||||
fun launch() = GlobalScope.launch(CoroutineExceptionHandler { _, throwable ->
|
||||
callback.onError?.invoke(this, throwable) ?: logger.error(throwable)
|
||||
}) {
|
||||
|
Loading…
Reference in New Issue
Block a user