kotlin upgraded, site started
This commit is contained in:
parent
beb462fd62
commit
67e4d76f59
@ -28,4 +28,10 @@ android.useAndroidX=true
|
|||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
|
||||||
# other
|
# other
|
||||||
kotlin.native.cacheKind.linuxX64=none
|
kotlin.native.cacheKind.linuxX64=none
|
||||||
|
|
||||||
|
# Workaround: Ensure Gradle uses a JDK with `jlink` available for AGP's JDK image transform.
|
||||||
|
# On this environment, the system JDK 21 installation lacks `jlink`, causing
|
||||||
|
# :lynglib:androidJdkImage to fail. Point Gradle to JDK 17 which includes `jlink`.
|
||||||
|
# This affects only the JDK Gradle runs with; Kotlin/JVM target remains compatible.
|
||||||
|
org.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
|
||||||
@ -1,7 +1,7 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "8.5.2"
|
agp = "8.5.2"
|
||||||
clikt = "5.0.3"
|
clikt = "5.0.3"
|
||||||
kotlin = "2.2.20"
|
kotlin = "2.2.21"
|
||||||
android-minSdk = "24"
|
android-minSdk = "24"
|
||||||
android-compileSdk = "34"
|
android-compileSdk = "34"
|
||||||
kotlinx-coroutines = "1.10.2"
|
kotlinx-coroutines = "1.10.2"
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("multiplatform") version "2.2.20"
|
alias(libs.plugins.kotlinMultiplatform)
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "net.sergeych"
|
group = "net.sergeych"
|
||||||
|
|||||||
@ -23,21 +23,13 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|||||||
group = "net.sergeych"
|
group = "net.sergeych"
|
||||||
version = "1.0.0-SNAPSHOT"
|
version = "1.0.0-SNAPSHOT"
|
||||||
|
|
||||||
buildscript {
|
// Removed legacy buildscript classpath declarations; plugins are applied via the plugins DSL below
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0")
|
|
||||||
classpath("com.codingfeline.buildkonfig:buildkonfig-gradle-plugin:latest_version")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlinMultiplatform)
|
alias(libs.plugins.kotlinMultiplatform)
|
||||||
alias(libs.plugins.androidLibrary)
|
alias(libs.plugins.androidLibrary)
|
||||||
// alias(libs.plugins.vanniktech.mavenPublish)
|
// alias(libs.plugins.vanniktech.mavenPublish)
|
||||||
kotlin("plugin.serialization") version "2.1.0"
|
kotlin("plugin.serialization") version "2.2.21"
|
||||||
id("com.codingfeline.buildkonfig") version "0.17.1"
|
id("com.codingfeline.buildkonfig") version "0.17.1"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
@ -84,9 +76,10 @@ kotlin {
|
|||||||
all {
|
all {
|
||||||
languageSettings.optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
|
languageSettings.optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
|
||||||
languageSettings.optIn("kotlin.ExperimentalUnsignedTypes")
|
languageSettings.optIn("kotlin.ExperimentalUnsignedTypes")
|
||||||
languageSettings.optIn("kotlin.coroutines.DelicateCoroutinesApi")
|
// Correct opt-in markers for coroutines
|
||||||
|
languageSettings.optIn("kotlinx.coroutines.DelicateCoroutinesApi")
|
||||||
languageSettings.optIn("kotlin.contracts.ExperimentalContracts")
|
languageSettings.optIn("kotlin.contracts.ExperimentalContracts")
|
||||||
languageSettings.optIn("kotlinx.coroutines.flow.DelicateCoroutinesApi")
|
languageSettings.optIn("kotlinx.coroutines.FlowPreview")
|
||||||
}
|
}
|
||||||
|
|
||||||
val commonMain by getting {
|
val commonMain by getting {
|
||||||
|
|||||||
@ -36,3 +36,4 @@ dependencyResolutionManagement {
|
|||||||
rootProject.name = "lyng"
|
rootProject.name = "lyng"
|
||||||
include(":lynglib")
|
include(":lynglib")
|
||||||
include(":lyng")
|
include(":lyng")
|
||||||
|
include(":site")
|
||||||
|
|||||||
60
site/build.gradle.kts
Normal file
60
site/build.gradle.kts
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2025 Sergey S. Chernov real.sergeych@gmail.com
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compose HTML (JS-only) SPA module
|
||||||
|
*/
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.kotlinMultiplatform)
|
||||||
|
// Compose compiler plugin for Kotlin 2.2.21 (matches version catalog)
|
||||||
|
id("org.jetbrains.kotlin.plugin.compose") version "2.2.21"
|
||||||
|
// Compose Multiplatform plugin for convenient dependencies (compose.html.core, etc.)
|
||||||
|
id("org.jetbrains.compose") version "1.9.3"
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js(IR) {
|
||||||
|
browser {
|
||||||
|
commonWebpackConfig {
|
||||||
|
// Enable CSS handling
|
||||||
|
cssSupport {
|
||||||
|
enabled.set(true)
|
||||||
|
}
|
||||||
|
// Ensure predictable output name so we can reference it from index.html
|
||||||
|
outputFileName = "site.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binaries.executable()
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
val jsMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation("org.jetbrains.compose.runtime:runtime:1.9.3")
|
||||||
|
implementation("org.jetbrains.compose.html:html-core:1.9.3")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val jsTest by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.kotlin.test)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional: configure toolchain if needed by the project; uses root Kotlin version from version catalog
|
||||||
47
site/src/jsMain/kotlin/Main.kt
Normal file
47
site/src/jsMain/kotlin/Main.kt
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2025 Sergey S. Chernov real.sergeych@gmail.com
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import org.jetbrains.compose.web.dom.*
|
||||||
|
import org.jetbrains.compose.web.renderComposable
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
renderComposable(rootElementId = "root") {
|
||||||
|
// Minimal SPA shell
|
||||||
|
Div({ classes("container", "py-4") }) {
|
||||||
|
H1({ classes("display-6", "mb-3") }) { Text("Compose HTML SPA") }
|
||||||
|
P({ classes("lead") }) {
|
||||||
|
Text("This static site is powered by Compose for Web (JS-only) and Bootstrap 5.3.")
|
||||||
|
}
|
||||||
|
|
||||||
|
Hr()
|
||||||
|
|
||||||
|
// Example of interactive state to show SPA behavior
|
||||||
|
var count by remember { mutableStateOf(0) }
|
||||||
|
Div({ classes("d-flex", "gap-2", "align-items-center") }) {
|
||||||
|
Button(attrs = {
|
||||||
|
classes("btn", "btn-primary")
|
||||||
|
onClick { count++ }
|
||||||
|
}) { Text("Increment") }
|
||||||
|
Span({ classes("fw-bold") }) { Text("Count: $count") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
45
site/src/jsMain/resources/index.html
Normal file
45
site/src/jsMain/resources/index.html
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright 2025 Sergey S. Chernov real.sergeych@gmail.com
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
~
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Compose HTML SPA</title>
|
||||||
|
<!-- Bootstrap 5.3 CSS -->
|
||||||
|
<link
|
||||||
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||||
|
rel="stylesheet"
|
||||||
|
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
|
||||||
|
<!-- App bundle (produced by Kotlin/JS). The Gradle config forces this name. -->
|
||||||
|
<script src="site.js"></script>
|
||||||
|
|
||||||
|
<!-- Bootstrap 5.3 JS bundle (includes Popper) -->
|
||||||
|
<script
|
||||||
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user