Skip to content

Commit

Permalink
chore: Update deps
Browse files Browse the repository at this point in the history
chore: Use versions toml for all deps
  • Loading branch information
0ffz committed May 31, 2024
1 parent be1e9bc commit f8382b5
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 28 deletions.
76 changes: 58 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import de.undercouch.gradle.tasks.download.Download
import org.apache.tools.ant.taskdefs.condition.Os
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
alias(idofrontLibs.plugins.mia.kotlin.jvm)
alias(idofrontLibs.plugins.kotlinx.serialization)
alias(idofrontLibs.plugins.compose)
alias(idofrontLibs.plugins.jetbrainsCompose)
alias(idofrontLibs.plugins.compose.compiler)
alias(idofrontLibs.plugins.dependencyversions)
alias(idofrontLibs.plugins.version.catalog.update)
id("de.undercouch.download") version "5.3.1"
}

Expand All @@ -26,25 +28,31 @@ dependencies {
implementation(compose.materialIconsExtended)
implementation(idofrontLibs.kotlinx.serialization.json)
implementation(idofrontLibs.kotlinx.serialization.kaml)
implementation("io.ktor:ktor-client-core:2.3.8")
implementation("io.ktor:ktor-client-cio:2.3.8")
implementation("io.ktor:ktor-client-cio-jvm:2.3.8")
implementation(libs.ktor.core)
implementation(libs.ktor.cio)
implementation(libs.ktor.cio.jvm)

implementation("com.darkrockstudios:mpfilepicker:3.1.0")
implementation("org.rauschig:jarchivelib:1.2.0")
implementation(libs.mpfilepicker)
implementation(libs.jarchivelib)

implementation("net.raphimc:MinecraftAuth:4.0.0")
implementation("dev.3-3:jmccc-mcdownloader:3.1.4")
implementation("dev.3-3:jmccc:3.1.4")
// implementation("dev.3-3:jmccc-microsoft-authenticator:3.1.4")
implementation(libs.minecraftAuth)
implementation(libs.jmccc.mcdownloader)
implementation(libs.jmccc)
}

tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf(
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
)
idofront {
setJvmToolchain = false
}

kotlin {
jvmToolchain(17)
compilerOptions {
freeCompilerArgs.addAll(
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
)
}
}

val appInstallerName = "Launchy-" + when {
Expand Down Expand Up @@ -74,7 +82,14 @@ compose.desktop {
else -> targetFormats(TargetFormat.AppImage)
}

modules("java.instrument", "java.management", "java.naming", "java.security.jgss", "jdk.httpserver", "jdk.unsupported")
modules(
"java.instrument",
"java.management",
"java.naming",
"java.security.jgss",
"jdk.httpserver",
"jdk.unsupported"
)
packageName = appName
packageVersion = "${project.version}"
val strippedVersion = project.version.toString().substringBeforeLast("-")
Expand Down Expand Up @@ -163,3 +178,28 @@ tasks {
}
}
}

versionCatalogUpdate {
keep {
keepUnusedPlugins = true
keepUnusedVersions = true
keepUnusedLibraries = true
}
}

tasks {
dependencyUpdates {
rejectVersionIf {
fun isNonStable(version: String): Boolean {
val unstableKeywords = listOf(
"-beta",
"-rc",
"-alpha",
)

return unstableKeywords.any { version.contains(it, ignoreCase = true) }
}
isNonStable(candidate.version)
}
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=com.mineinabyss
version=2.0.0-beta.0
idofrontVersion=0.23.0
version=2.0.0-beta.1
idofrontVersion=0.24.3
16 changes: 16 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[versions]
jarchivelib = "1.2.0"
jmccc = "3.1.4"
ktor = "2.3.11"
minecraftAuth = "4.0.2"
mpfilepicker = "3.1.0"

[libraries]
jarchivelib = { module = "org.rauschig:jarchivelib", version.ref = "jarchivelib" }
jmccc = { module = "dev.3-3:jmccc", version.ref = "jmccc" }
jmccc-mcdownloader = { module = "dev.3-3:jmccc-mcdownloader", version.ref = "jmccc" }
ktor-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-cio-jvm = { module = "io.ktor:ktor-client-cio-jvm", version.ref = "ktor" }
ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
minecraftAuth = { module = "net.raphimc:MinecraftAuth", version.ref = "minecraftAuth" }
mpfilepicker = { module = "com.darkrockstudios:mpfilepicker", version.ref = "mpfilepicker" }
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package com.mineinabyss.launchy.data.auth
import com.google.gson.GsonBuilder
import com.google.gson.JsonParser
import com.mineinabyss.launchy.data.Dirs
import kotlinx.serialization.ExperimentalSerializationApi
import com.mineinabyss.launchy.logic.Auth
import kotlinx.serialization.Serializable
import net.raphimc.minecraftauth.MinecraftAuth
import net.raphimc.minecraftauth.step.java.session.StepFullJavaSession.FullJavaSession
import java.io.InputStreamReader
import java.util.*
import kotlin.io.path.*

Expand All @@ -25,7 +23,7 @@ data class SessionStorage(
val targetFile = (Dirs.accounts / "$uuid.json")
if (!targetFile.exists()) return null
return runCatching {
MinecraftAuth.JAVA_DEVICE_CODE_LOGIN.fromJson(
Auth.JAVA_DEVICE_CODE_LOGIN.fromJson(
JsonParser.parseString(
targetFile.readText()
).asJsonObject
Expand All @@ -42,7 +40,7 @@ data class SessionStorage(
}

fun save(session: FullJavaSession) {
val json = MinecraftAuth.JAVA_DEVICE_CODE_LOGIN.toJson(session)
val json = Auth.JAVA_DEVICE_CODE_LOGIN.toJson(session)
val targetFile = (Dirs.accounts / "${session.mcProfile.id}.json").createParentDirectories()
targetFile.deleteIfExists()
targetFile.createFile()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mineinabyss.launchy.data.config

import com.charleskorn.kaml.decodeFromStream
import com.mineinabyss.launchy.data.Dirs
import com.mineinabyss.launchy.data.Formats
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.mineinabyss.launchy.data.config
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.res.loadImageBitmap
import com.charleskorn.kaml.decodeFromStream
import com.charleskorn.kaml.encodeToStream
import com.mineinabyss.launchy.data.Dirs
import com.mineinabyss.launchy.data.Formats
Expand Down
16 changes: 14 additions & 2 deletions src/main/kotlin/com/mineinabyss/launchy/logic/Auth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ import java.util.*


object Auth {
val JAVA_DEVICE_CODE_LOGIN = MinecraftAuth.ALT_JAVA_DEVICE_CODE_LOGIN
//TODO override with our own oauth app
// .builder()
// .withClientId("00000000402b5328")
// .withScope("service::user.auth.xboxlive.com::MBI_SSL")
// .deviceCode()
// .withDeviceToken("Win32")
// .sisuTitleAuthentication("rp://api.minecraftservices.com/")
// .buildMinecraftJavaProfileStep(true)

suspend fun authOrShowDialog(
state: LaunchyState,
profile: ProfileState,
Expand Down Expand Up @@ -59,14 +69,16 @@ object Auth {
onVerificationRequired: (VerificationRequired) -> Unit,
onAuthenticate: (FullJavaSession) -> Unit,
) {
MinecraftAuth.builder()
val httpClient = MinecraftAuth.createHttpClient()
val previousSession = state.currentProfile?.let { SessionStorage.load(it.uuid) }
if (previousSession != null) {
val refreshedSession = MinecraftAuth.JAVA_DEVICE_CODE_LOGIN.refresh(httpClient, previousSession)
println("refreshing token")
val refreshedSession = JAVA_DEVICE_CODE_LOGIN.refresh(httpClient, previousSession)
onAuthenticate(refreshedSession)
return
}
val javaSession = MinecraftAuth.JAVA_DEVICE_CODE_LOGIN.getFromInput(
val javaSession = JAVA_DEVICE_CODE_LOGIN.getFromInput(
httpClient,
MsaDeviceCodeCallback { msaDeviceCode: MsaDeviceCode ->
onVerificationRequired(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.material.LinearProgressIndicator
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.OpenInNew
import androidx.compose.material.icons.rounded.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
Expand Down Expand Up @@ -147,7 +148,7 @@ fun ModInfoDisplay(group: Group, mod: Mod) {
) {
IconButton(onClick = { DesktopHelpers.browse(mod.info.homepage) }) {
Icon(
imageVector = Icons.Rounded.OpenInNew,
imageVector = Icons.AutoMirrored.Rounded.OpenInNew,
contentDescription = "Homepage"
)
}
Expand Down

0 comments on commit f8382b5

Please sign in to comment.