Skip to content

Commit

Permalink
Dependency updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DrewCarlson committed Nov 10, 2023
1 parent ecf6ddf commit 5cbe464
Show file tree
Hide file tree
Showing 28 changed files with 132 additions and 160 deletions.
9 changes: 6 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
root = true

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ktlint_standard_no-wildcard-imports = disabled
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ktlint_code_style = ktlint_official
ktlint_standard = enabled
ktlint_standard_no-wildcard-imports = disabled
ktlint_function_naming_ignore_when_annotated_with = Composable
14 changes: 7 additions & 7 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ main ]

concurrency:
group: ${{ github.head_ref || github.run_id }}
group: code-quality-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- uses: gradle/gradle-build-action@v2
name: Spotless Check
with:
arguments: -p anystream-client-ui spotlessCheck lintKotlin
arguments: -p anystream-client-ui spotlessCheck

client-android:
runs-on: ubuntu-latest
Expand All @@ -127,7 +127,7 @@ jobs:
- uses: gradle/gradle-build-action@v2
name: Spotless Check
with:
arguments: -p anystream-client-android spotlessCheck lintKotlin
arguments: -p anystream-client-android spotlessCheck

client-core:
runs-on: ubuntu-latest
Expand All @@ -154,7 +154,7 @@ jobs:
- uses: gradle/gradle-build-action@v2
name: Spotless Check
with:
arguments: -p anystream-client-core spotlessCheck lintKotlin
arguments: -p anystream-client-core spotlessCheck

client-web:
runs-on: ubuntu-latest
Expand All @@ -181,7 +181,7 @@ jobs:
- uses: gradle/gradle-build-action@v2
name: Spotless Check
with:
arguments: -p anystream-client-web spotlessCheck lintKotlin
arguments: -p anystream-client-web spotlessCheck

data-models:
runs-on: ubuntu-latest
Expand All @@ -208,7 +208,7 @@ jobs:
- uses: gradle/gradle-build-action@v2
name: Spotless Check
with:
arguments: -p anystream-data-models spotlessCheck lintKotlin
arguments: -p anystream-data-models spotlessCheck

server:
runs-on: ubuntu-latest
Expand All @@ -235,4 +235,4 @@ jobs:
- uses: gradle/gradle-build-action@v2
name: Spotless Check
with:
arguments: -p anystream-server spotlessCheck lintKotlin
arguments: -p anystream-server spotlessCheck
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'v*'

concurrency:
group: ${{ github.head_ref || github.run_id }}
group: release-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ main ]

concurrency:
group: ${{ github.head_ref || github.run_id }}
group: tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yarn-lock-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'renovate/**'

concurrency:
group: ${{ github.head_ref || github.run_id }}
group: yarn-upgrade-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gradle/
.fleet/
/.idea
!/.idea/codeStyles
out/
Expand Down
16 changes: 15 additions & 1 deletion anystream-client-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("com.android.application")
kotlin("android")
alias(libsCommon.plugins.spotless)
}

android {
Expand Down Expand Up @@ -61,7 +62,9 @@ dependencies {
implementation(libsAndroid.androidx.activity.compose)
implementation(libsAndroid.androidx.lifecycle.viewmodel.compose)
implementation(libsAndroid.bundles.compose)
implementation(libsAndroid.coil)
implementation(libsClient.compose.foundation)
implementation(libsClient.compose.material)
implementation(libsClient.coil)
implementation(libsAndroid.bundles.exoplayer)
implementation(libsAndroid.zxing.core)
implementation(libsAndroid.quickie.bundled)
Expand All @@ -80,3 +83,14 @@ dependencies {
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-debug")
}
}

afterEvaluate {
spotless {
kotlin {
target("**/**.kt")
licenseHeaderFile(rootDir.resolve("licenseHeader.txt"))
//ktlint(libsCommon.versions.ktlint.get())
// .setEditorConfigPath(rootDir.resolve(".editorconfig"))
}
}
}
3 changes: 2 additions & 1 deletion anystream-client-android/src/main/kotlin/router/BackStack.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class BackStack<T> internal constructor(
} else {
onElementRemoved.invoke(lastIndex)
elements = ArrayList(
elements.subList(0, lastIndex), // exclusive
// exclusive
elements.subList(0, lastIndex),
)
true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fun PairingScanner(
if (result is QRResult.QRSuccess) {
val user = client.user.filterNotNull().first()
try {
client.login(user.username, result.content.rawValue, pairing = true)
client.login(user.username, result.content.rawValue.orEmpty(), pairing = true)
} catch (e: ClientRequestException) {
e.printStackTrace()
}
Expand Down
15 changes: 0 additions & 15 deletions anystream-client-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,9 @@ dependencies {
add("kspCommonMainMetadata", libsClient.mobiuskt.updateGenerator)
}

tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}

tasks.findByName("lintKotlinCommonMain")?.apply {
dependsOn("kspCommonMainKotlinMetadata")
}

tasks.findByName("formatKotlinCommonMain")?.apply {
dependsOn("kspCommonMainKotlinMetadata")
}

kotlin {
sourceSets {
val commonMain by getting {
kotlin.srcDir("build/generated/ksp/metadata/$name/kotlin")
dependencies {
api(projects.anystreamDataModels)
implementation(libsCommon.atomicfu)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ class AnyStreamClient(
val token: String?
get() = sessionManager.fetchToken()

private val _serverUrl = atomic("")
private val _serverUrlWss = atomic("")
private val serverUrlInternal = atomic("")
private val serverUrlWssInternal = atomic("")
var serverUrl: String
get() = _serverUrl.value
get() = serverUrlInternal.value
private set(value) {
val trimmedUrl = value.trimEnd('/')
_serverUrl.value = trimmedUrl
_serverUrlWss.value = trimmedUrl
serverUrlInternal.value = trimmedUrl
serverUrlWssInternal.value = trimmedUrl
.replace("https://", "wss://", ignoreCase = true)
.replace("http://", "ws://", ignoreCase = true)
}
private val serverUrlWs: String
get() = _serverUrlWss.value
get() = serverUrlWssInternal.value

init {
this.serverUrl = serverUrl ?: sessionManager.fetchServerUrl() ?: ""
Expand Down
2 changes: 1 addition & 1 deletion anystream-client-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (hasAndroidSdk) {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.0"
kotlinCompilerExtensionVersion = libsAndroid.versions.composeCompiler.get()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class BackStack<T> internal constructor(
} else {
onElementRemoved.invoke(lastIndex)
elements = ArrayList(
elements.subList(0, lastIndex), // exclusive
// exclusive
elements.subList(0, lastIndex),
)
true
}
Expand Down
3 changes: 3 additions & 0 deletions anystream-data-models/src/IsoLanguageCodes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ internal data class LangCode(

internal object IsoLanguageCodes {

@Suppress("ktlint:standard:function-naming")
fun by639_2(code: String): LangCode? {
val lowercaseCode = code.lowercase()
return by639_2T[lowercaseCode] ?: by639_2B[lowercaseCode]
}

@Suppress("ktlint:standard:function-naming")
fun by639_2T(code: String): LangCode? {
return by639_2T[code.lowercase()]
}

@Suppress("ktlint:standard:function-naming")
fun by639_2B(code: String): LangCode? {
return by639_2B[code.lowercase()]
}
Expand Down
9 changes: 6 additions & 3 deletions anystream-data-models/src/PlaybackState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ import kotlinx.serialization.Serializable
data class PlaybackState(
val id: String,
val mediaLinkGid: String,
val metadataGid: String, // TODO: Make optional
// TODO: Make optional
val metadataGid: String,
val userId: Int,
val position: Double, // TODO: Use Duration
val runtime: Double, // TODO: Use Duration
// TODO: Use Duration
val position: Double,
// TODO: Use Duration
val runtime: Double,
val updatedAt: Instant,
) {
val completedPercent: Float
Expand Down
1 change: 0 additions & 1 deletion anystream-server/server-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("server-lib")
alias(libsCommon.plugins.serialization)
Expand Down
9 changes: 0 additions & 9 deletions anystream-server/server-db-models/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("server-lib")
alias(libsCommon.plugins.ksp)
Expand Down Expand Up @@ -30,11 +29,3 @@ dependencies {
testImplementation(kotlin("test"))
testImplementation(kotlin("test-junit"))
}

tasks.named("formatKotlinMain").configure {
dependsOn("kspKotlin")
}

tasks.named("lintKotlinMain").configure {
dependsOn("kspKotlin")
}
1 change: 0 additions & 1 deletion anystream-server/server-library-manager/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("server-lib")
alias(libsCommon.plugins.serialization)
Expand Down
1 change: 1 addition & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies {
implementation(libsCommon.agp)
implementation(libsCommon.kotlin.gradle.plugin)
implementation(libsCommon.ksp)
implementation("com.diffplug.spotless:spotless-plugin-gradle:${libsCommon.versions.spotless.get()}")
implementation("org.gradle.kotlin:gradle-kotlin-dsl-conventions:0.8.0")
}

Expand Down
23 changes: 0 additions & 23 deletions build-logic/src/main/kotlin/IosBuildUtils.kt
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
import org.gradle.kotlin.dsl.creating
import org.gradle.kotlin.dsl.getValue
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

fun KotlinMultiplatformExtension.configureCommonIosSourceSets() {
val iosMain by sourceSets.creating {
dependsOn(sourceSets.getByName("commonMain"))
}

val iosTest by sourceSets.creating {
dependsOn(sourceSets.getByName("commonTest"))
}

sourceSets.filter { sourceSet ->
sourceSet.name.run {
startsWith("iosX64") ||
startsWith("iosArm") ||
startsWith("iosSimulator")
}
}.forEach { sourceSet ->
if (sourceSet.name.endsWith("Main")) {
sourceSet.dependsOn(iosMain)
} else {
sourceSet.dependsOn(iosTest)
}
}
}
35 changes: 31 additions & 4 deletions build-logic/src/main/kotlin/multiplatform-lib.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import org.gradle.kotlin.dsl.*

plugins {
kotlin("multiplatform")
id("com.diffplug.spotless")
}

apply(plugin = "kotlinx-atomicfu")
Expand All @@ -20,6 +21,21 @@ if (hasAndroidSdk) {
sourceCompatibility = JAVA_TARGET
targetCompatibility = JAVA_TARGET
}
packaging {
resources.excludes.add("META-INF/versions/*/*.bin")
}
}
}

afterEvaluate {
spotless {
kotlin {
target("**/**.kt")
licenseHeaderFile(rootDir.resolve("licenseHeader.txt"))
val libsCommon = extensions.getByType<VersionCatalogsExtension>().named("libsCommon")
//ktlint(libsCommon.findVersion("ktlint").get().requiredVersion)
// .setEditorConfigPath(rootDir.resolve(".editorconfig"))
}
}
}

Expand Down Expand Up @@ -55,6 +71,15 @@ kotlin {
iosSimulatorArm64()
iosX64()
}
applyDefaultHierarchyTemplate()

targets.all {
compilations.configureEach {
compilerOptions.configure {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}

@Suppress("UNUSED_VARIABLE")
sourceSets {
Expand Down Expand Up @@ -135,10 +160,12 @@ kotlin {
}
}

if (tasks.any { it.name == "kspCommonMainKotlinMetadata" }) {
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
afterEvaluate {
if (extensions.findByName("ksp") != null) {
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
}
}
Loading

0 comments on commit 5cbe464

Please sign in to comment.