This commit is contained in:
InsanusMokrassar 2022-01-04 19:46:47 +06:00
parent ac87a140cc
commit c880d8e657
7 changed files with 64 additions and 61 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ build/
out/ out/
local.properties local.properties
kotlin-js-store/

View File

@ -7,7 +7,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.2.2' classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcount_version" classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcount_version"

View File

@ -10,7 +10,6 @@ kotlin {
jvm { jvm {
compilations.main.kotlinOptions { compilations.main.kotlinOptions {
jvmTarget = "11" jvmTarget = "11"
useIR = true
} }
} }
sourceSets { sourceSets {

View File

@ -1,6 +1,5 @@
package dev.inmo.kmppscriptbuilder.desktop package dev.inmo.kmppscriptbuilder.desktop
import androidx.compose.desktop.Window
import androidx.compose.foundation.* import androidx.compose.foundation.*
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.material.Colors import androidx.compose.material.Colors
@ -8,6 +7,8 @@ import androidx.compose.material.MaterialTheme
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import dev.inmo.kmppscriptbuilder.desktop.utils.init import dev.inmo.kmppscriptbuilder.desktop.utils.init
import dev.inmo.kmppscriptbuilder.desktop.utils.loadConfigFile import dev.inmo.kmppscriptbuilder.desktop.utils.loadConfigFile
import dev.inmo.kmppscriptbuilder.desktop.views.BuilderView import dev.inmo.kmppscriptbuilder.desktop.views.BuilderView
@ -16,49 +17,51 @@ import java.io.File
//private val uncaughtExceptionsBC = BroadcastChannel<DefaultErrorHandler.ErrorEvent>(Channel.CONFLATED) //private val uncaughtExceptionsBC = BroadcastChannel<DefaultErrorHandler.ErrorEvent>(Channel.CONFLATED)
//val uncaughtExceptionsFlow: Flow<DefaultErrorHandler.ErrorEvent> = uncaughtExceptionsBC.asFlow() //val uncaughtExceptionsFlow: Flow<DefaultErrorHandler.ErrorEvent> = uncaughtExceptionsBC.asFlow()
fun main(args: Array<String>) = Window(title = "Kotlin Multiplatform Publishing Builder") { fun main(args: Array<String>) = application {
val builder = BuilderView() Window(onCloseRequest = ::exitApplication, title = "Kotlin Multiplatform Publishing Builder") {
MaterialTheme( val builder = BuilderView()
Colors( MaterialTheme(
primary = Color(0x01, 0x57, 0x9b), Colors(
primaryVariant = Color(0x00, 0x2f, 0x6c), primary = Color(0x01, 0x57, 0x9b),
secondary = Color(0xb2, 0xeb, 0xf2), primaryVariant = Color(0x00, 0x2f, 0x6c),
secondaryVariant = Color(0x81, 0xb9, 0xbf), secondary = Color(0xb2, 0xeb, 0xf2),
background = Color(0xe1, 0xe2, 0xe1), secondaryVariant = Color(0x81, 0xb9, 0xbf),
surface = Color(0xf5, 0xf5, 0xf6), background = Color(0xe1, 0xe2, 0xe1),
error = Color(0xb7, 0x1c, 0x1c), surface = Color(0xf5, 0xf5, 0xf6),
onPrimary = Color.White, error = Color(0xb7, 0x1c, 0x1c),
onSecondary = Color.Black, onPrimary = Color.White,
onBackground = Color.Black, onSecondary = Color.Black,
onSurface = Color.Black, onBackground = Color.Black,
onError = Color.White, onSurface = Color.Black,
isLight = MaterialTheme.colors.isLight, onError = Color.White,
) isLight = MaterialTheme.colors.isLight,
) {
Box(
Modifier.fillMaxSize()
.background(color = Color(245, 245, 245))
) {
val stateVertical = rememberScrollState(0)
Box(
modifier = Modifier
.fillMaxSize()
.verticalScroll(stateVertical)
) {
builder.init()
}
VerticalScrollbar(
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(),
adapter = rememberScrollbarAdapter(stateVertical)
) )
) {
Box(
Modifier.fillMaxSize()
.background(color = Color(245, 245, 245))
) {
val stateVertical = rememberScrollState(0)
Box(
modifier = Modifier
.fillMaxSize()
.verticalScroll(stateVertical)
) {
builder.init()
}
VerticalScrollbar(
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(),
adapter = rememberScrollbarAdapter(stateVertical)
)
}
}
if (args.isNotEmpty()) {
val config = loadConfigFile(File(args.first()))
builder.config = config
} }
} }
if (args.isNotEmpty()) {
val config = loadConfigFile(File(args.first()))
builder.config = config
}
} }

View File

@ -6,27 +6,27 @@ kotlin.incremental.js=true
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
kotlin_version=1.5.21 kotlin_version=1.6.10
kotlin_coroutines_version=1.5.2 kotlin_coroutines_version=1.6.0
kotlin_serialisation_core_version=1.2.2 kotlin_serialisation_core_version=1.3.2
ktor_version=1.6.3 ktor_version=1.6.7
micro_utils_version=0.5.24 micro_utils_version=0.9.0
compose_version=1.0.0-alpha3 compose_version=1.0.1
# ANDROID # ANDROID
android_minSdkVersion=21 android_minSdkVersion=21
android_compileSdkVersion=30 android_compileSdkVersion=32
android_buildToolsVersion=30.0.3 android_buildToolsVersion=32.0.0
dexcount_version=3.0.0 dexcount_version=3.0.1
junit_version=4.12 junit_version=4.12
test_ext_junit_version=1.1.2 test_ext_junit_version=1.1.2
espresso_core=3.3.0 espresso_core=3.3.0
# Dokka # Dokka
dokka_version=1.5.0 dokka_version=1.6.0
# Project data # Project data

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip

View File

@ -48,7 +48,7 @@ class LicensesView(
emptyList() emptyList()
} else { } else {
licensesTemplates.filter { licensesTemplates.filter {
val lowercasedTitle = it.title.toLowerCase() val lowercasedTitle = it.title.lowercase()
lowercased.all { it in lowercasedTitle } lowercased.all { it in lowercasedTitle }
} }
} }
@ -57,12 +57,12 @@ class LicensesView(
} }
private val searchElement = rootElement.createTextField("Quick add", "Type some license name part to find it").apply { private val searchElement = rootElement.createTextField("Quick add", "Type some license name part to find it").apply {
oninput = { oninput = {
changeActor.offer(Unit) changeActor.trySend(Unit)
false false
} }
} }
private var searchString: String private var searchString: String
get() = searchElement.value.toLowerCase() get() = searchElement.value.lowercase()
set(value) { set(value) {
searchElement.value = value searchElement.value = value
} }
@ -71,7 +71,7 @@ class LicensesView(
createCommonButton(value.title).onclick = { createCommonButton(value.title).onclick = {
searchString = "" searchString = ""
licensesView.licenses += value licensesView.licenses += value
changeActor.offer(Unit) changeActor.trySend(Unit)
false false
} }
} }
@ -110,4 +110,4 @@ class LicensesView(
titleElement.value = to.title titleElement.value = to.title
urlElement.value = to.url ?: "" urlElement.value = to.url ?: ""
} }
} }