Initial commit

This commit is contained in:
2026-08-30 02:49:34 +08:00
commit 7e177214a9
28 files changed
+1009

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Kotlin ###
.kotlin
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
/.idea/
+30
View File
@@ -0,0 +1,30 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
}
kotlin {
explicitApi()
linuxX64()
linuxArm64()
macosArm64()
mingwX64()
jvm { compilerOptions.jvmTarget = JvmTarget.JVM_11 }
sourceSets {
val ktorVersion = "3.5.2"
commonMain.dependencies {
api(project(":bl-core"))
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-client-websockets:$ktorVersion")
}
commonTest.dependencies {
implementation(project(":bl-core"))
}
}
}
+29
View File
@@ -0,0 +1,29 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
}
kotlin {
explicitApi()
linuxX64()
linuxArm64()
macosArm64()
mingwX64()
jvm { compilerOptions.jvmTarget = JvmTarget.JVM_11 }
sourceSets {
commonMain.dependencies {
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")
api("org.kotlincrypto.hash:md:0.8.0")
api("org.jetbrains.kotlinx:kotlinx-io-core:0.9.1")
}
commonTest.dependencies {
implementation(kotlin("test"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.11.0")
}
}
}
@@ -0,0 +1,11 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/29
*/
package cn.rtast.bldm.core
public const val REAL_ROOM_ID_URL: String = "https://api.live.bilibili.com/room/v1/Room/room_init?id="
public const val DM_SERVER_CONF_URL: String = "https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo?id="
public const val USER_NAV_URL: String = "https://api.bilibili.com/x/web-interface/nav"
@@ -0,0 +1,37 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/29
*/
package cn.rtast.bldm.core.data
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
@Serializable
public data class DMServerConf(
val data: ServerConf,
) {
@Serializable
public data class ServerConf(
val token: String,
@SerialName("host_list")
val hostList: List<ServerHost>,
)
@Serializable
public data class ServerHost(
val host: String,
val port: Int,
@SerialName("wss_port")
val wssPort: Int,
@SerialName("ws_port")
val wsPort: Int,
)
@Transient
public val defaultServerHost: ServerHost = ServerHost("broadcastlv.chat.bilibili.com", 2243, 2245, 2244)
}
@@ -0,0 +1,22 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/29
*/
package cn.rtast.bldm.core.data
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
public data class RealRoomId(
val data: RoomId
) {
@Serializable
public data class RoomId(
@SerialName("room_id")
val roomId: Long
)
}
@@ -0,0 +1,87 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
@file:OptIn(ExperimentalUnsignedTypes::class)
package cn.rtast.bldm.core.data
import cn.rtast.bldm.core.util.digest
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.time.Clock
@Serializable
public data class UserNavData(
@SerialName("wbi_img")
val wbiImg: WbiImg,
) {
@Serializable
public data class WbiImg(
@SerialName("img_url")
val imgUrl: String,
@SerialName("sub_url")
val subUrl: String,
)
private companion object {
val MIXIN_KEY_ENC_TAB = intArrayOf(
46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49,
33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40,
61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11,
36, 20, 34, 44, 52
)
fun String.encodeURIComponent(): String {
val bytes = this.encodeToByteArray()
val sb = StringBuilder()
for (b in bytes) {
val c = b.toInt().and(0xFF).toChar()
if (c in 'A'..'Z' || c in 'a'..'z' || c in '0'..'9' || c == '-' || c == '_' || c == '.' || c == '~') {
sb.append(c)
} else {
val hex = (b.toInt() and 0xFF).toString(16).uppercase()
sb.append('%')
if (hex.length == 1) sb.append('0')
sb.append(hex)
}
}
return sb.toString()
}
fun Map<String, Any?>.toQueryString(): String {
return this.mapNotNull { (key, value) ->
if (value != null) {
"${key.encodeURIComponent()}=${value.toString().encodeURIComponent()}"
} else {
null
}
}.joinToString("&")
}
}
/**
* get resorted mixin key
*/
private fun getMixinKey(): String =
(wbiImg.imgUrl.substringAfterLast('/').removeSuffix(".png") +
wbiImg.subUrl.substringAfterLast('/').removeSuffix(".png")).let { s ->
buildString { repeat(32) { append(s[MIXIN_KEY_ENC_TAB[it]]) } }
}
public fun signWbi(room: Long): String {
// val payload = _wbi_sign_payload(room, 0, Clock.System.now().epochSeconds) // ref
val wts = Clock.System.now().epochSeconds
val params = mapOf("id" to room, "type" to 0)
.entries.sortedBy { it.key }.associate { it.key to it.value }.toMutableMap()
return buildString {
append(params.toQueryString())
params["wts"] = wts
append("&wts=$wts")
append("&w_rid=${(params.toQueryString() + getMixinKey()).digest()}")
}
}
}
@@ -0,0 +1,27 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.data
import kotlinx.serialization.Serializable
@Serializable
@Suppress("ClassName")
internal data class _wbi_sign_payload(
/**
* room id
*/
val id: Long,
/**
* always be 0
*/
val type: Int,
/**
* current unix timestamp (seconds)
*/
val wts: Long
)
@@ -0,0 +1,44 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.data.protocol
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
internal data class AuthPayload(
/**
* user id
*/
val uid: Int,
/**
* room id
*/
val roomid: Long,
/**
* protocol version
* always be 2
*/
val protover: Int,
/**
* device id
*/
val buvid: String,
/**
* platform always be "web"
*/
val platform: String,
/**
* always be 2
*/
val type: Int,
/**
* token
*/
val key: String
)
@@ -0,0 +1,83 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.protocol
import kotlinx.io.Buffer
import kotlinx.io.readByteArray
/**
* packet header 16 bytes length + body (variant length)
*/
public data class Packet(
/**
* total packet length
* 4 bytes
*/
val packetLength: Int = -1,
/**
* always 16
* 2 bytes
*/
val headerLength: Short = 16,
/**
* protocol = 1
* 2 bytes
*/
val protocolVersion: Short = 1,
/**
* packet type
* 4 bytes
*/
val packetType: Int,
/**
* packet sequence
* value is usually 1
* 4 bytes
*/
val sequence: Int = 1,
/**
* packet body
* variant length
*/
val body: ByteArray,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as Packet
if (packetLength != other.packetLength) return false
if (headerLength != other.headerLength) return false
if (protocolVersion != other.protocolVersion) return false
if (packetType != other.packetType) return false
if (sequence != other.sequence) return false
if (!body.contentEquals(other.body)) return false
return true
}
override fun hashCode(): Int {
var result = packetLength
result = 31 * result + headerLength
result = 31 * result + protocolVersion
result = 31 * result + packetType
result = 31 * result + sequence
result = 31 * result + body.contentHashCode()
return result
}
public fun toByteArray(): ByteArray = Buffer().apply {
writeInt(16 + body.size)
writeShort(headerLength)
writeShort(protocolVersion)
writeInt(packetType)
writeInt(sequence)
write(body, body.size)
}.readByteArray()
}
@@ -0,0 +1,11 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.protocol
class PacketDecoder {
}
@@ -0,0 +1,28 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.protocol
import cn.rtast.bldm.core.data.protocol.AuthPayload
import cn.rtast.bldm.core.util.AutoIncrementInt
import cn.rtast.bldm.core.util.encodeJson
public class PacketEncoder {
public companion object {
private val HEARTBEAT_BODY: ByteArray = "[Object object]".encodeToByteArray()
}
private val _sequence by AutoIncrementInt()
public fun authPacket(uid: Int, roomId: Long, buvid: String, token: String): Packet {
val payload = AuthPayload(uid, roomId, 2, buvid, "web", 2, token)
.encodeJson().encodeToByteArray()
return Packet(packetType = PacketType.AUTH, sequence = _sequence, body = payload)
}
public fun heartbeatPacket(): Packet = Packet(packetType = 2, sequence = _sequence, body = HEARTBEAT_BODY)
}
@@ -0,0 +1,18 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.protocol
public object PacketType {
public const val AUTH: Int = 7
public const val AUTH_REPLY: Int = 8
public const val HEARTBEAT: Int = 2
public const val HANDSHAKE_REPLY: Int = 1
public const val HEARTBEAT_REPLY: Int = 3
public const val SEND_MSG_REPLY: Int = 5
// TODO
}
@@ -0,0 +1,18 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.util
import kotlin.reflect.KProperty
internal class AutoIncrementInt(initialValue: Int = 1) {
private var count = initialValue
operator fun getValue(thisRef: Any?, property: KProperty<*>): Int {
return ++count
}
}
@@ -0,0 +1,14 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.util
import org.kotlincrypto.hash.md.MD5
internal val md5Instance = MD5()
internal fun String.digest(): String = md5Instance.digest(this.encodeToByteArray()).toHexString()
@@ -0,0 +1,14 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.util
import kotlinx.serialization.json.Json
internal inline fun <reified T> String.fromJson(): T = Json.decodeFromString(this)
internal inline fun <reified T> T.encodeJson(): String = Json.encodeToString(this)
@@ -0,0 +1,10 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.util
internal expect fun ByteArray.zlibDecompress(): ByteArray
@@ -0,0 +1,24 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package test
import org.kotlincrypto.hash.md.MD5
import kotlin.test.Test
import kotlin.test.assertEquals
class TestMd5 {
@Test
fun `test md5`() {
val target = "e10adc3949ba59abbe56e057f20f883e" // 123456
val res = MD5().digest("123456".encodeToByteArray()).toHexString()
assertEquals(target, res)
}
}
@@ -0,0 +1,22 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package test
import cn.rtast.bldm.core.data.UserNavData
import kotlin.test.Test
class TestWbiSign {
@Test
fun `test wbi sign`() {
val imgUrl = "https://i0.hdslb.com/bfs/wbi/7cd084941338484aae1ad9425b84077c.png"
val subUrl = "https://i0.hdslb.com/bfs/wbi/4932caff0ff746eab6f01bf08b70ac45.png"
val signWbi = UserNavData(UserNavData.WbiImg(imgUrl, subUrl)).signWbi(27245513)
println(signWbi)
}
}
@@ -0,0 +1,24 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
package cn.rtast.bldm.core.util
import java.io.ByteArrayOutputStream
import java.util.zip.Inflater
public actual fun ByteArray.zlibDecompress(): ByteArray {
val inflater = Inflater(true)
val outputStream = ByteArrayOutputStream(this.size)
val buffer = ByteArray(1024)
inflater.setInput(this)
while (!inflater.finished()) {
val length = inflater.inflate(buffer)
if (length > 0) outputStream.write(buffer, 0, length)
}
inflater.end()
return outputStream.toByteArray()
}
@@ -0,0 +1,61 @@
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/8/30
*/
@file:OptIn(ExperimentalForeignApi::class)
package cn.rtast.bldm.core.util
import kotlinx.cinterop.*
import platform.zlib.*
private const val MAX_WBITS = 15
public actual fun ByteArray.zlibDecompress(): ByteArray {
if (isEmpty()) return ByteArray(0)
return memScoped {
val stream = alloc<z_stream>()
stream.zalloc = null
stream.zfree = null
stream.opaque = null
check(inflateInit2_(stream.ptr, MAX_WBITS, ZLIB_VERSION, sizeOf<z_stream>().toInt()) == Z_OK) { "inflateInit2_ failed" }
val inputPinned = this@zlibDecompress.pin()
try {
stream.next_in = inputPinned.addressOf(0).reinterpret()
stream.avail_in = this@zlibDecompress.size.toUInt()
val bufferSize = 4096
val tempBuffer = ByteArray(bufferSize)
val tempPinned = tempBuffer.pin()
val output = ArrayList<Byte>(this@zlibDecompress.size * 2)
try {
do {
stream.next_out = tempPinned.addressOf(0).reinterpret()
stream.avail_out = bufferSize.toUInt()
val result = inflate(stream.ptr, Z_NO_FLUSH)
check(result == Z_OK || result == Z_STREAM_END) { "inflate error: $result" }
val bytesDecompressed = bufferSize - stream.avail_out.toInt()
for (i in 0 until bytesDecompressed) {
output.add(tempBuffer[i])
}
if (result == Z_STREAM_END) break
} while (stream.avail_out == 0u)
} finally {
tempPinned.unpin()
}
inflateEnd(stream.ptr)
return@memScoped output.toByteArray()
} finally {
inputPinned.unpin()
}
}
}
+13
View File
@@ -0,0 +1,13 @@
plugins {
kotlin("multiplatform") version "2.4.10" apply false
kotlin("plugin.serialization") version "2.4.10" apply false
}
allprojects {
group = "cn.rtast.bldm"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
}
+3
View File
@@ -0,0 +1,3 @@
kotlin.code.style=official
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError
kotlin.native.ignoreDisabledTargets=true
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
#Sat Aug 29 23:35:21 CST 2026
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+234
View File
@@ -0,0 +1,234 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+89
View File
@@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+4
View File
@@ -0,0 +1,4 @@
rootProject.name = "bldm"
include(":bl-core")
include(":bl-client")