Skip to content

Commit 5e437d8

Browse files
authored
Merge pull request #345 from LossyDragon/updates
July Updates.
2 parents 2a5d1df + 4d7d85d commit 5e437d8

16 files changed

Lines changed: 823 additions & 860 deletions

File tree

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ Maven
7272
* Note: To eliminate any errors or warnings, you should try and match the same version JavaSteam uses.
7373
<br><br>
7474
* Content Downloading:
75-
* If you plan on working with Content Downloading, Depot files may be compressed with Zstd *(Zstandard)*.
76-
* You will need to implement the correct type
77-
of [ztd implementation](https://mvnrepository.com/artifact/com.github.luben/zstd-jni) if using JVM or Android.
78-
* Android uses `aar` for the library type.
75+
* Add the following dependencies to your project: [XZ For Java](https://mvnrepository.com/artifact/org.tukaani/xz) and [ZSTD JNI](https://mvnrepository.com/artifact/com.github.luben/zstd-jni).
76+
* ZSTD for android uses `aar` for the libray type.
7977

8078
You can find the latest version of these dependencies JavaSteam
8179
supports [here](https://github.com/Longi94/JavaSteam/blob/master/gradle/libs.versions.toml).

build.gradle.kts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ sourceSets.main {
107107
)
108108
}
109109

110+
/* Basic Java 9 JPMS support */
111+
tasks.jar {
112+
manifest {
113+
attributes["Automatic-Module-Name"] = "in.dragonbra.javasteam"
114+
}
115+
}
116+
110117
/* Dependencies */
111118
tasks["lintKotlinMain"].dependsOn("formatKotlin")
112119
tasks["check"].dependsOn("jacocoTestReport")
@@ -126,18 +133,17 @@ tasks.withType<FormatTask> {
126133

127134
dependencies {
128135
implementation(libs.bundles.ktor)
129-
implementation(libs.commons.io)
130136
implementation(libs.commons.lang3)
131-
implementation(libs.commons.validator)
132-
implementation(libs.gson)
133137
implementation(libs.kotlin.coroutines)
134138
implementation(libs.kotlin.stdib)
135139
implementation(libs.okHttp)
136140
implementation(libs.protobuf.java)
137-
implementation(libs.xz)
141+
compileOnly(libs.xz)
138142
compileOnly(libs.zstd)
139143

144+
testImplementation(platform(libs.tests.junit.bom))
140145
testImplementation(libs.bundles.testing)
146+
testRuntimeOnly(libs.tests.junit.platform)
141147
}
142148

143149
/* Artifact publishing */

buildSrc/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ dependencies {
1313
implementation(gradleApi())
1414

1515
// https://mvnrepository.com/artifact/commons-io/commons-io
16-
implementation("commons-io:commons-io:2.18.0")
16+
implementation("commons-io:commons-io:2.20.0")
1717
// https://mvnrepository.com/artifact/com.squareup/kotlinpoet
18-
implementation("com.squareup:kotlinpoet:2.0.0")
18+
implementation("com.squareup:kotlinpoet:2.2.0")
1919
}
2020

2121
gradlePlugin {

gradle/libs.versions.toml

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,37 @@
44
# ****
55

66
[versions]
7-
# Java / Kotlin versions
87
java = "11"
9-
kotlin = "2.1.20" # https://kotlinlang.org/docs/releases.html#release-details
8+
kotlin = "2.2.0" # https://kotlinlang.org/docs/releases.html#release-details
109
dokka = "2.0.0" # https://mvnrepository.com/artifact/org.jetbrains.dokka/dokka-gradle-plugin
11-
kotlinter = "5.0.2" # https://plugins.gradle.org/plugin/org.jmailen.kotlinter
10+
kotlinter = "5.1.1" # https://plugins.gradle.org/plugin/org.jmailen.kotlinter
11+
jacoco = "0.8.13" # https://www.eclemma.org/jacoco
1212

1313
# Standard Library versions
14-
bouncyCastle = "1.80" # https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on
15-
commons-io = "2.19.0" # https://mvnrepository.com/artifact/commons-io/commons-io
16-
commons-lang3 = "3.17.0" # https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
17-
commons-validator = "1.9.0" # https://mvnrepository.com/artifact/commons-validator/commons-validator
18-
gson = "2.13.1" # https://mvnrepository.com/artifact/com.google.code.gson/gson
19-
jacoco = "0.8.13" # https://www.eclemma.org/jacoco
14+
commons-lang3 = "3.18.0" # https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
2015
kotlin-coroutines = "1.10.2" # https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
21-
ktor = "3.2.1" # https://mvnrepository.com/artifact/io.ktor/ktor-client-cio
22-
okHttp = "5.0.0-alpha.14" # https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
23-
protobuf = "4.30.2" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
16+
ktor = "3.2.2" # https://mvnrepository.com/artifact/io.ktor/ktor-client-cio
17+
okHttp = "5.1.0" # https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
18+
protobuf = "4.31.1" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
2419
protobuf-gradle = "0.9.5" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-gradle-plugin
2520
publishPlugin = "2.0.0" # https://mvnrepository.com/artifact/io.github.gradle-nexus/publish-plugin
26-
qrCode = "1.0.1" # https://mvnrepository.com/artifact/pro.leaco.qrcode/console-qrcode
2721
xz = "1.10" # https://mvnrepository.com/artifact/org.tukaani/xz
28-
zstd = "1.5.7-3" # https://search.maven.org/artifact/com.github.luben/zstd-jni
22+
zstd = "1.5.7-4" # https://search.maven.org/artifact/com.github.luben/zstd-jni
2923

3024
# Testing Lib versions
31-
commonsCodec = "1.18.0" # https://mvnrepository.com/artifact/commons-codec/commons-codec
32-
junit5 = "5.11.4" # https://mvnrepository.com/artifact/org.junit/junit-bom
33-
mockWebServer = "5.0.0-alpha.14" # https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver3-junit5
34-
mockitoVersion = "5.15.2" # https://mvnrepository.com/artifact/org.mockito/mockito-core
25+
commons-io = "2.20.0" # https://mvnrepository.com/artifact/commons-io/commons-io
26+
commonsCodec = "1.19.0" # https://mvnrepository.com/artifact/commons-codec/commons-codec
27+
junit5 = "5.13.4" # https://mvnrepository.com/artifact/org.junit/junit-bom
28+
mockWebServer = "5.1.0" # https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver3-junit5
29+
mockitoVersion = "5.18.0" # https://mvnrepository.com/artifact/org.mockito/mockito-core
30+
31+
# Samples
32+
bouncyCastle = "1.81" # https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on
33+
gson = "2.13.1" # https://mvnrepository.com/artifact/com.google.code.gson/gson
34+
qrCode = "1.0.1" # https://mvnrepository.com/artifact/pro.leaco.qrcode/console-qrcode
3535

3636
[libraries]
37-
bouncyCastle = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncyCastle" }
38-
commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
3937
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commons-lang3" }
40-
commons-validator = { module = "commons-validator:commons-validator", version.ref = "commons-validator" }
41-
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
4238
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
4339
kotlin-stdib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
4440
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
@@ -47,17 +43,23 @@ ktor-client-websocket = { module = "io.ktor:ktor-client-websockets", version.ref
4743
okHttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okHttp" }
4844
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobuf" }
4945
protobuf-protoc = { module = "com.google.protobuf:protoc", version.ref = "protobuf" }
50-
qrCode = { module = "pro.leaco.qrcode:console-qrcode", version.ref = "qrCode" }
5146
xz = { module = "org.tukaani:xz", version.ref = "xz" }
5247
zstd = { module = "com.github.luben:zstd-jni", version.ref = "zstd" }
5348

49+
# Tests
5450
test-commons-codec = { module = "commons-codec:commons-codec", version.ref = "commonsCodec" }
55-
test-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5" }
56-
test-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" }
57-
test-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit5" }
51+
test-commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
52+
test-mock-core = { module = "org.mockito:mockito-core", version.ref = "mockitoVersion" }
53+
test-mock-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockitoVersion" }
5854
test-mock-webserver3 = { module = "com.squareup.okhttp3:mockwebserver3-junit5", version.ref = "mockWebServer" }
59-
test-mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoVersion" }
60-
test-mockito-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockitoVersion" }
55+
tests-junit-bom = { module = "org.junit:junit-bom", version.ref = "junit5" }
56+
tests-junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
57+
tests-junit-platform = { module = "org.junit.platform:junit-platform-launcher" }
58+
59+
# Samples
60+
bouncyCastle = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncyCastle" }
61+
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
62+
qrCode = { module = "pro.leaco.qrcode:console-qrcode", version.ref = "qrCode" }
6163

6264
[plugins]
6365
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
@@ -69,14 +71,14 @@ protobuf-gradle = { id = "com.google.protobuf", version.ref = "protobuf-gradle"
6971
[bundles]
7072
testing = [
7173
"bouncyCastle",
74+
"zstd",
75+
"xz",
7276
"test-commons-codec",
73-
"test-jupiter-api",
74-
"test-jupiter-engine",
75-
"test-jupiter-params",
77+
"test-commons-io",
78+
"test-mock-core",
79+
"test-mock-jupiter",
7680
"test-mock-webserver3",
77-
"test-mockito-core",
78-
"test-mockito-jupiter",
79-
"zstd"
81+
"tests-junit-jupiter",
8082
]
8183

8284
ktor = [

src/main/java/in/dragonbra/javasteam/steam/contentdownloader/ContentDownloader.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import `in`.dragonbra.javasteam.steam.cdn.Server
77
import `in`.dragonbra.javasteam.steam.handlers.steamapps.PICSProductInfo
88
import `in`.dragonbra.javasteam.steam.handlers.steamapps.PICSRequest
99
import `in`.dragonbra.javasteam.steam.handlers.steamapps.SteamApps
10-
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.PICSProductInfoCallback
1110
import `in`.dragonbra.javasteam.steam.handlers.steamcontent.SteamContent
1211
import `in`.dragonbra.javasteam.steam.steamclient.SteamClient
1312
import `in`.dragonbra.javasteam.types.ChunkData
@@ -104,7 +103,7 @@ class ContentDownloader(val steamClient: SteamClient) {
104103
private fun getAppDirName(app: PICSProductInfo): String {
105104
val installDirKeyValue = app.keyValues["config"]["installdir"]
106105

107-
return if (installDirKeyValue != KeyValue.INVALID) installDirKeyValue.value else app.id.toString()
106+
return if (installDirKeyValue != KeyValue.INVALID) installDirKeyValue.value!! else app.id.toString()
108107
}
109108

110109
private fun getAppInfo(
@@ -113,7 +112,7 @@ class ContentDownloader(val steamClient: SteamClient) {
113112
): Deferred<PICSProductInfo?> = parentScope.async {
114113
val steamApps = steamClient.getHandler(SteamApps::class.java)
115114
val callback = steamApps?.picsGetProductInfo(PICSRequest(appId))?.await()
116-
val apps = callback?.results?.flatMap { (it as PICSProductInfoCallback).apps.values }
115+
val apps = callback?.results?.flatMap { it.apps.values }
117116

118117
if (apps.isNullOrEmpty()) {
119118
logger.error("Received empty apps list in PICSProductInfo response for $appId")

src/main/java/in/dragonbra/javasteam/steam/handlers/steammatchmaking/Lobby.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Lobby(
7979
return metadata
8080
}
8181

82-
metadata[value.name] = value.value
82+
metadata[value.name!!] = value.value!!
8383
}
8484

8585
return metadata.toMap()

src/main/java/in/dragonbra/javasteam/steam/handlers/steamuserstats/SteamUserStats.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ class SteamUserStats : ClientMsgHandler() {
151151
}
152152

153153
// JavaSteam addition.
154+
154155
/**
155156
* Gets the Stats-Schema for the specified app. This schema includes Global Achievements and Stats,
156157
* @param appId The appID of the game.

src/main/java/in/dragonbra/javasteam/steam/steamclient/SteamClient.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class SteamClient @JvmOverloads constructor(
9696
}
9797

9898
//region Handlers
99+
99100
/**
100101
* Adds a new handler to the internal list of message handlers.
101102
* @param handler The handler to add.
@@ -150,6 +151,7 @@ class SteamClient @JvmOverloads constructor(
150151
//endregion
151152

152153
//region Callbacks
154+
153155
/**
154156
* Gets the next callback object in the queue, and removes it.
155157
* @return The next callback in the queue, or null if no callback is waiting.
@@ -196,6 +198,7 @@ class SteamClient @JvmOverloads constructor(
196198
//endregion
197199

198200
//region Jobs
201+
199202
/**
200203
* Returns the next available JobID for job based messages.
201204
* @return The next available JobID.

0 commit comments

Comments
 (0)