Skip to content
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
49 changes: 35 additions & 14 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.*
import com.netflix.gradle.plugins.deb.Deb
import dev.detekt.gradle.Detekt
import org.gradle.crypto.checksum.Checksum
import org.jetbrains.kotlin.gradle.plugin.mpp.DisableCacheInKotlinVersion
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCacheApi
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
import org.jetbrains.kotlin.konan.target.*
import org.jetbrains.kotlin.konan.target.Architecture
import java.net.URI

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
id("dev.detekt")
id("com.github.gmazzo.buildconfig")
id("com.codingfeline.buildkonfig")
id("org.gradle.crypto.checksum")
id("com.netflix.nebula.ospackage")
}
Expand All @@ -22,19 +26,25 @@ description = "The interactive and stylish replacement for ls & cd!"

val binaryName = "nav"

buildConfig {
buildConfigField("String", "VERSION", "\"$version\"")
buildConfigField("String", "BINARY_NAME", "\"$binaryName\"")
buildkonfig {
packageName = "$group"
defaultConfigs {
buildConfigField(STRING, "VERSION", "$version", const = true)
buildConfigField(STRING, "BINARY_NAME", binaryName, const = true)
}
}

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
"-Xexplicit-context-arguments",
"-Xcollection-literals",
"-Xintrinsic-const-evaluation",
"-Xallow-returns-result-of",
"-Xcontext-sensitive-resolution",
"-Xnested-type-aliases",
"-Xexpect-actual-classes",
"-Xreturn-value-checker=check",
"-Xconsistent-data-class-copy-visibility",
"-Xallow-holdsin-contract",
)
}

Expand All @@ -50,28 +60,39 @@ kotlin {
executable {
baseName = binaryName
entryPoint = "$group.main"

if (target.konanTarget == KonanTarget.LINUX_X64) {
@OptIn(KotlinNativeCacheApi::class)
disableNativeCache(
version = DisableCacheInKotlinVersion.`2_4_10`,
reason = "Cache bug with mordant",
issueUrl = URI(
"https://youtrack.jetbrains.com/issue/KT-75928/ld.lld-error-duplicate-symbol-when-enabling-.konan-cache"
)
)
}
}
}
}

sourceSets {
val ktorVersion = "3.3.1"
val ktorVersion = "3.5.1"

commonMain.dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.7.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.8.0")

val kotlinxIOVersion = "0.8.0"
val kotlinxIOVersion = "0.9.1"
implementation("org.jetbrains.kotlinx:kotlinx-io-core:$kotlinxIOVersion")
implementation("org.jetbrains.kotlinx:kotlinx-io-okio:$kotlinxIOVersion")

val ktomlVersion = "0.7.1"
implementation("com.akuleshov7:ktoml-core:$ktomlVersion")
implementation("com.akuleshov7:ktoml-file:$ktomlVersion")

implementation("com.charleskorn.kaml:kaml:0.97.0")
implementation("com.charleskorn.kaml:kaml:0.104.0")

implementation("com.github.ajalt.clikt:clikt:5.0.3")
implementation("com.github.ajalt.clikt:clikt:5.1.0")

val mordantVersion = "3.0.2"
implementation("com.github.ajalt.mordant:mordant:$mordantVersion")
Expand Down Expand Up @@ -102,7 +123,7 @@ dependencies {
}

tasks.withType<Detekt>().configureEach {
exclude("de/jonasbroeckmann/nav/app/BuildConfig.kt")
exclude("de/jonasbroeckmann/nav/BuildKonfig.kt")
}

tasks.register("detektAll") {
Expand Down
6 changes: 2 additions & 4 deletions app/src/commonMain/kotlin/de/jonasbroeckmann/nav/Constants.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package de.jonasbroeckmann.nav

import de.jonasbroeckmann.nav.app.BuildConfig

object Constants {
val BinaryName get() = BuildConfig.BINARY_NAME
val Version get() = BuildConfig.VERSION
val BinaryName get() = BuildKonfig.BINARY_NAME
val Version get() = BuildKonfig.VERSION

val RepositoryUrl get() = "https://github.com/Jojo4GH/nav"
val IssuesUrl get() = "$RepositoryUrl/issues"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ open class MacroSymbolScopeBase(
) : MacroSymbolScope {
protected open val variables = mutableMapOf<MacroSymbol.Generic, String>()

override operator fun get(symbol: MacroSymbol) = context(context, stateProvider) {
override operator fun get(symbol: MacroSymbol): String = context(context, stateProvider) {
when (symbol) {
is MacroSymbol.EnvironmentVariable -> symbol.get()
is MacroSymbol.Generic -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.jonasbroeckmann.nav.update

import de.jonasbroeckmann.nav.BuildKonfig
import de.jonasbroeckmann.nav.Constants
import de.jonasbroeckmann.nav.app.BuildConfig
import kotlin.text.get

data class Version(
Expand Down Expand Up @@ -45,7 +45,7 @@ data class Version(
}

val Current by lazy {
of(Constants.Version) ?: throw AssertionError("Could not parse current version '${BuildConfig.VERSION}'")
of(Constants.Version) ?: throw AssertionError("Could not parse current version '${BuildKonfig.VERSION}'")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ private object TerminalInterfaceNativeWindows : StandardTerminalInterface() {
}
val inputEvents = allocArray<INPUT_RECORD>(1)
val eventsRead = alloc<UIntVar>()
ReadConsoleInput!!(stdinHandle, inputEvents, 1u, eventsRead.ptr)

@Suppress("detekt:BackingPropertyNaming")
val _ = ReadConsoleInput!!(stdinHandle, inputEvents, 1u, eventsRead.ptr)

if (eventsRead.value == 0u) {
throw ConsoleException("Error reading from console input")
}
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
val kotlinVersion = "2.2.20"
val kotlinVersion = "2.4.10"
kotlin("multiplatform") version kotlinVersion apply false
kotlin("plugin.serialization") version kotlinVersion apply false
id("dev.detekt") version "2.0.0-alpha.0" apply false
id("com.github.gmazzo.buildconfig") version "5.6.8" apply false
id("com.codingfeline.buildkonfig") version "0.22.0" apply false
id("org.gradle.crypto.checksum") version "1.4.0" apply false
id("com.netflix.nebula.ospackage") version "12.1.1" apply false
id("com.netflix.nebula.ospackage") version "12.3.0" apply false
}
16 changes: 10 additions & 6 deletions framework/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ group = "de.jonasbroeckmann.nav"
kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
"-Xexplicit-context-arguments",
"-Xcollection-literals",
"-Xintrinsic-const-evaluation",
"-Xallow-returns-result-of",
"-Xcontext-sensitive-resolution",
"-Xnested-type-aliases",
"-Xconsistent-data-class-copy-visibility"
"-Xexpect-actual-classes",
"-Xreturn-value-checker=check",
"-Xconsistent-data-class-copy-visibility",
)
}

Expand All @@ -27,10 +31,10 @@ kotlin {

sourceSets {
commonMain.dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.7.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.8.0")

val kotlinxIOVersion = "0.8.0"
val kotlinxIOVersion = "0.9.1"
implementation("org.jetbrains.kotlinx:kotlinx-io-core:$kotlinxIOVersion")
implementation("org.jetbrains.kotlinx:kotlinx-io-okio:$kotlinxIOVersion")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class HintsBuilder internal constructor(private val defaultStrongSpacing: String
inputMode: InputMode?,
weakSpacing: Boolean = false,
render: context(Context) A.() -> String
) = context(context) {
): Unit = context(context) {
if (!action.isShown(inputMode)) return
add(weakSpacing) { action.render() }
}
Expand Down
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=512M
# Kotlin
kotlin.code.style=official
kotlin.incremental.native=true
# https://youtrack.jetbrains.com/issue/KT-75928/ld.lld-error-duplicate-symbol-when-enabling-.konan-cache
kotlin.native.cacheKind.linuxX64=none
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.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 3 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
}

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

// Project structure
rootProject.name = "nav"
include("framework")
include("app")

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

include("framework")
Loading