Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all gradle dependencies we have #1173

Merged
merged 6 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android.useAndroidX=true
android.nonTransitiveRClass=true
org.gradle.unsafe.configuration-cache=false

kotlinVersion=1.9.23
kotlinVersion=2.0.20
spotlessVersion=6.25.0
shadowJarVersion=8.1.1
buildconfigVersion=5.3.5
shadowJarVersion=8.3.2
buildconfigVersion=5.5.0
grgitVersion=5.2.2
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
33 changes: 18 additions & 15 deletions server/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
* For more details take a look at the Java Libraries chapter in the Gradle
* User Manual available at https://docs.gradle.org/6.3/userguide/java_library_plugin.html
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("android")
kotlin("plugin.serialization")
id("com.github.gmazzo.buildconfig")

id("com.android.application") version "8.0.2"
id("com.android.application") version "8.6.1"
id("org.ajoberstar.grgit")
}

Expand All @@ -39,8 +40,10 @@ tasks.preBuild {
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
kotlinOptions.freeCompilerArgs += "-Xvalue-classes"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
freeCompilerArgs.set(listOf("-Xvalue-classes"))
}
}

// Set compiler to use UTF-8
Expand All @@ -65,21 +68,21 @@ allprojects {
dependencies {
implementation(project(":server:core"))

implementation("commons-cli:commons-cli:1.5.0")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("commons-cli:commons-cli:1.8.0")
implementation("org.apache.commons:commons-lang3:3.15.0")

// Android stuff
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.core:core-ktx:1.10.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.core:core-ktx:1.13.1")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
// For hosting web GUI
implementation("io.ktor:ktor-server-core:2.3.0")
implementation("io.ktor:ktor-server-netty:2.3.0")
implementation("io.ktor:ktor-server-caching-headers:2.3.0")
implementation("io.ktor:ktor-server-core:2.3.12")
implementation("io.ktor:ktor-server-netty:2.3.10")
implementation("io.ktor:ktor-server-caching-headers:2.3.12")

// Serial
implementation("com.github.mik3y:usb-serial-for-android:3.7.0")
Expand All @@ -99,7 +102,7 @@ android {
compile your app. This means your app can use the API features included in
this API level and lower. */

compileSdk = 33
compileSdk = 35

/* The defaultConfig block encapsulates default settings and entries for all
build variants and can override some attributes in main/AndroidManifest.xml
Expand All @@ -119,7 +122,7 @@ android {
minSdk = 26

// Specifies the API level used to test the app.
targetSdk = 33
targetSdk = 35

// Defines the version number of your app.
versionCode = extra["gitVersionCode"] as? Int
Expand Down
4 changes: 3 additions & 1 deletion server/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />

<application
android:allowBackup="true"
Expand All @@ -16,7 +17,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.SlimeVR"
tools:targetApi="33"
tools:targetApi="35"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
Expand All @@ -31,6 +32,7 @@
<service
android:name=".ForegroundService"
android:enabled="true"
android:foregroundServiceType="connectedDevice"
android:exported="false" />
</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package dev.slimevr.android

import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.Service
import android.app.*
import android.content.Intent
import android.content.pm.ServiceInfo
import android.os.Build
import android.os.IBinder
import androidx.core.app.NotificationChannelCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.app.ServiceCompat
import io.eiren.util.logging.LogManager

/**
* ForegroundService helps to keep the SlimeVR Server on Android from being killed.
Expand Down Expand Up @@ -35,9 +38,26 @@ class ForegroundService : Service() {
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
val notification = createNotification()
startForeground(NOTIFICATION_ID, notification)

try {
val notification = createNotification()
ServiceCompat.startForeground(
this,
NOTIFICATION_ID, // Cannot be 0
notification,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
} else {
0
},
)
} catch (e: Exception) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
e is ForegroundServiceStartNotAllowedException
) {
LogManager.severe("Tried to start foreground service when not allowed:", e)
}
// ...
}
/*
* Currently being a foreground process should be enough to keep the server running.
* If it turns out to not be enough then the next option would be to return sticky here
Expand All @@ -51,13 +71,12 @@ class ForegroundService : Service() {
override fun onBind(intent: Intent?): IBinder? = null

private fun createNotificationChannel() {
val serviceChannel = NotificationChannel(
CHANNEL_ID,
"SlimeVR Foreground Service Channel",
NotificationManager.IMPORTANCE_LOW,
)
val manager = getSystemService(NotificationManager::class.java)
manager.createNotificationChannel(serviceChannel)
val serviceChannel = NotificationChannelCompat.Builder(CHANNEL_ID, NotificationManager.IMPORTANCE_LOW)
.setName("SlimeVR Foreground Service Channel")
.build()
NotificationManagerCompat
.from(this)
.createNotificationChannel(serviceChannel)
}

private fun createNotification(): Notification = NotificationCompat.Builder(this, CHANNEL_ID)
Expand Down
2 changes: 1 addition & 1 deletion server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ configure<com.diffplug.gradle.spotless.SpotlessExtension> {
"java.util.*,kotlin.math.*,dev.slimevr.autobone.errors.*" +
",io.github.axisangles.ktmath.*,kotlinx.atomicfu.*" +
",dev.slimevr.tracking.trackers.*,dev.slimevr.desktop.platform.ProtobufMessages.*" +
",com.illposed.osc.*",
",com.illposed.osc.*,android.app.*",
"ij_kotlin_allow_trailing_comma" to true,
)
val ktlintVersion = "1.2.1"
Expand Down
15 changes: 9 additions & 6 deletions server/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For more details take a look at the Java Libraries chapter in the Gradle
* User Manual available at https://docs.gradle.org/6.3/userguide/java_library_plugin.html
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -25,8 +26,10 @@ java {
}
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
kotlinOptions.freeCompilerArgs += "-Xvalue-classes"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
freeCompilerArgs.set(listOf("-Xvalue-classes"))
}
}

// Set compiler to use UTF-8
Expand Down Expand Up @@ -60,26 +63,26 @@ dependencies {
// This dependency is used internally,
// and not exposed to consumers on their own compile classpath.
implementation("com.google.flatbuffers:flatbuffers-java:22.10.26")
implementation("commons-cli:commons-cli:1.5.0")
implementation("commons-cli:commons-cli:1.8.0")
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.1")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.1")

implementation("com.github.jonpeterson:jackson-module-model-versioning:1.2.2")
implementation("org.apache.commons:commons-math3:3.6.1")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("org.apache.commons:commons-lang3:3.15.0")
implementation("org.apache.commons:commons-collections4:4.4")

implementation("com.illposed.osc:javaosc-core:0.8")
implementation("org.java-websocket:Java-WebSocket:1.+")
implementation("com.melloware:jintellitype:1.+")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")

// Jitpack
implementation("com.github.SlimeVR:oscquery-kt:566a0cba58")

testImplementation(kotlin("test"))
// Use JUnit test framework
testImplementation(platform("org.junit:junit-bom:5.9.0"))
testImplementation(platform("org.junit:junit-bom:5.10.3"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.platform:junit-platform-launcher")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class QuaternionMovingAverage(
// GUI should clamp it from 0.01 (1%) or 0.1 (10%)
// to 1 (100%).
amount = amount.coerceAtLeast(0f)
if (type === TrackerFilters.SMOOTHING) {
if (type == TrackerFilters.SMOOTHING) {
// lower smoothFactor = more smoothing
smoothFactor = SMOOTH_MULTIPLIER * (1 - amount.coerceAtMost(1f)) + SMOOTH_MIN
// Totally a hack
if (amount > 1) {
smoothFactor /= amount
}
}
if (type === TrackerFilters.PREDICTION) {
if (type == TrackerFilters.PREDICTION) {
// higher predictFactor = more prediction
predictFactor = PREDICT_MULTIPLIER * amount + PREDICT_MIN
rotBuffer = CircularArrayList(PREDICT_BUFFER)
Expand Down Expand Up @@ -95,7 +95,7 @@ class QuaternionMovingAverage(

@Synchronized
fun addQuaternion(q: Quaternion) {
if (type === TrackerFilters.PREDICTION) {
if (type == TrackerFilters.PREDICTION) {
if (rotBuffer.size == rotBuffer.capacity()) {
rotBuffer.removeLast()
}
Expand Down
8 changes: 4 additions & 4 deletions server/core/src/main/java/dev/slimevr/osc/UnityArmature.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class UnityArmature(localRot: Boolean) {
fun setLocalRotationForBone(unityBone: UnityBone, localRot: Quaternion) {
val node = getHeadNodeOfBone(unityBone)
if (node != null) {
if (unityBone === UnityBone.HIPS) {
if (unityBone == UnityBone.HIPS) {
node.worldTransform.rotation = localRot
} else {
node.localTransform.rotation = when (unityBone) {
Expand All @@ -117,7 +117,7 @@ class UnityArmature(localRot: Boolean) {
fun getGlobalTranslationForBone(unityBone: UnityBone): Vector3 {
val node = getHeadNodeOfBone(unityBone)
return if (node != null) {
if (unityBone === UnityBone.HIPS) {
if (unityBone == UnityBone.HIPS) {
val hipsAverage = (
leftHipNode.worldTransform.translation +
rightHipNode.worldTransform.translation
Expand All @@ -134,7 +134,7 @@ class UnityArmature(localRot: Boolean) {
fun getLocalTranslationForBone(unityBone: UnityBone): Vector3 {
val node = getHeadNodeOfBone(unityBone)
return if (node != null) {
if (unityBone === UnityBone.HIPS) {
if (unityBone == UnityBone.HIPS) {
val hipsAverage = (
leftHipNode.worldTransform.translation +
rightHipNode.worldTransform.translation
Expand All @@ -160,7 +160,7 @@ class UnityArmature(localRot: Boolean) {
fun getLocalRotationForBone(unityBone: UnityBone): Quaternion {
val node = getHeadNodeOfBone(unityBone)
return if (node != null) {
if (unityBone === UnityBone.HIPS) {
if (unityBone == UnityBone.HIPS) {
node.worldTransform.rotation * rootRotation
} else {
node.parent!!.worldTransform.rotation.inv() * node.worldTransform.rotation
Expand Down
2 changes: 1 addition & 1 deletion server/core/src/main/java/dev/slimevr/osc/VMCHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class VMCHandler(
try {
val addr = InetAddress.getByName(ip)
oscSender = OSCPortOut(InetSocketAddress(addr, portOut))
if ((lastPortOut != portOut && lastAddress !== addr) || !wasConnected) {
if ((lastPortOut != portOut && lastAddress != addr) || !wasConnected) {
LogManager
.info(
"[VMCHandler] Sending to port $portOut at address $ip",
Expand Down
6 changes: 3 additions & 3 deletions server/core/src/main/java/dev/slimevr/osc/VRCOSCHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class VRCOSCHandler(
override fun refreshSettings(refreshRouterSettings: Boolean) {
// Sets which trackers are enabled and force head and hands to false
for (i in computedTrackers.indices) {
if (computedTrackers[i].trackerPosition !== TrackerPosition.HEAD || computedTrackers[i].trackerPosition !== TrackerPosition.LEFT_HAND || computedTrackers[i].trackerPosition !== TrackerPosition.RIGHT_HAND) {
if (computedTrackers[i].trackerPosition != TrackerPosition.HEAD || computedTrackers[i].trackerPosition != TrackerPosition.LEFT_HAND || computedTrackers[i].trackerPosition != TrackerPosition.RIGHT_HAND) {
trackersEnabled[i] = config
.getOSCTrackerRole(
computedTrackers[i].trackerPosition!!.trackerRole!!,
Expand Down Expand Up @@ -199,7 +199,7 @@ class VRCOSCHandler(
try {
val addr = InetAddress.getByName(ip)
oscSender = OSCPortOut(InetSocketAddress(addr, portOut))
if (oscPortOut != portOut && oscIp !== addr || !wasConnected) {
if (oscPortOut != portOut && oscIp != addr || !wasConnected) {
LogManager.info("[VRCOSCHandler] Sending to port $portOut at address $ip")
}
oscPortOut = portOut
Expand Down Expand Up @@ -463,7 +463,7 @@ class VRCOSCHandler(
),
)
}
if (computedTrackers[i].trackerPosition === TrackerPosition.HEAD) {
if (computedTrackers[i].trackerPosition == TrackerPosition.HEAD) {
// Send HMD position
val (x, y, z) = computedTrackers[i].position
oscArgs.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SkeletonConfigManager(

fun setToggle(config: SkeletonConfigToggles, newValue: Boolean?) {
if (newValue != null) {
if (configToggles[config] != null && (newValue !== configToggles[config])) {
if (configToggles[config] != null && (newValue != configToggles[config])) {
changedToggles[config.id - 1] = true
}
configToggles[config] = newValue
Expand Down
Loading