diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2417ad1..14db420 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -301,7 +301,7 @@ dokka:
script:
- >
- ./gradlew :dokkatooGeneratePublicationHtml
+ ./gradlew :dokkaGeneratePublicationHtml
--no-configuration-cache
-PappVersion=$project_version
diff --git a/.idea/runConfigurations/Documentation.xml b/.idea/runConfigurations/Documentation.xml
index 862dd23..e31ca5b 100644
--- a/.idea/runConfigurations/Documentation.xml
+++ b/.idea/runConfigurations/Documentation.xml
@@ -10,7 +10,7 @@
diff --git a/build.gradle.kts b/build.gradle.kts
index 813b5eb..56f3094 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -21,7 +21,7 @@ plugins {
dependencies {
// List the 'library' projects
- // dokkatoo(projects.core)
+ // dokka(projects.core)
}
// region Check the users of the project didn't forget to rename the group
diff --git a/gradle.properties b/gradle.properties
index 75d1cef..30acaaf 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -20,3 +20,7 @@ org.gradle.caching=true
# Configuration on demand allows Gradle to only configure projects which take part in the build.
# See https://docs.gradle.org/current/userguide/multi_project_configuration_and_execution.html#sec:configuration_on_demand
org.gradle.configureondemand=true
+
+# Dokka v2
+# See https://kotl.in/dokka-gradle-migration
+org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
diff --git a/gradle/conventions/settings.gradle.kts b/gradle/conventions/settings.gradle.kts
index 768d181..299d08e 100644
--- a/gradle/conventions/settings.gradle.kts
+++ b/gradle/conventions/settings.gradle.kts
@@ -45,7 +45,7 @@ pluginManagement {
}
plugins {
- id("dev.opensavvy.conventions.settings") version "1.5.2"
+ id("dev.opensavvy.conventions.settings") version "1.6.0"
}
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 30990b4..ee219fe 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -49,7 +49,7 @@ pluginManagement {
}
plugins {
- id("dev.opensavvy.conventions.settings") version "1.5.2"
+ id("dev.opensavvy.conventions.settings") version "1.6.0"
}
include(
--
2.51.2
From 71699b3a0c181f68fa79000f6bdbb35e70f07f83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Sat, 21 Dec 2024 15:13:59 +0100
Subject: [PATCH 02/16] docs(website): Embed the Dokka output into the docs
website
---
.idea/runConfigurations/Documentation.xml | 1 +
docs/website/.gitignore | 3 +++
docs/website/.gitlab-ci.yml | 3 +++
docs/website/build.gradle.kts | 9 +++++++++
docs/website/mkdocs.yml | 5 ++++-
.../template-lib/src/commonMain/kotlin/HelloWorld.kt | 3 +++
settings.gradle.kts | 1 +
7 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 docs/website/build.gradle.kts
diff --git a/.idea/runConfigurations/Documentation.xml b/.idea/runConfigurations/Documentation.xml
index e31ca5b..c2c66d2 100644
--- a/.idea/runConfigurations/Documentation.xml
+++ b/.idea/runConfigurations/Documentation.xml
@@ -11,6 +11,7 @@
+
diff --git a/docs/website/.gitignore b/docs/website/.gitignore
index 16d3c4d..329639a 100644
--- a/docs/website/.gitignore
+++ b/docs/website/.gitignore
@@ -1 +1,4 @@
.cache
+
+# Dokka output
+api/
diff --git a/docs/website/.gitlab-ci.yml b/docs/website/.gitlab-ci.yml
index 4cf2735..da39ede 100644
--- a/docs/website/.gitlab-ci.yml
+++ b/docs/website/.gitlab-ci.yml
@@ -2,8 +2,11 @@
mkdocs:
image: registry.gitlab.com/opensavvy/automation/containers/mkdocs:$ci_containers
stage: build
+ extends: [ .os.gradle ]
+ needs: [ os.version ]
before_script:
+ - ./gradlew docs:website:embedDokkaIntoMkDocs -PappVersion=$project_version
- cd docs/website
- ls
- 'echo "repo_url: $CI_PROJECT_URL">>mkdocs.yml'
diff --git a/docs/website/build.gradle.kts b/docs/website/build.gradle.kts
new file mode 100644
index 0000000..2546603
--- /dev/null
+++ b/docs/website/build.gradle.kts
@@ -0,0 +1,9 @@
+plugins {
+ alias(opensavvyConventions.plugins.base)
+ id("dev.opensavvy.dokka-mkdocs")
+}
+
+dependencies {
+ // List the 'library' projects
+ // dokka(projects.core)
+}
diff --git a/docs/website/mkdocs.yml b/docs/website/mkdocs.yml
index 9ead25d..937da81 100644
--- a/docs/website/mkdocs.yml
+++ b/docs/website/mkdocs.yml
@@ -91,5 +91,8 @@ nav:
- Module2: []
- - Reference:
+# !!! EMBEDDED DOKKA START, DO NOT COMMIT !!! #
+# !!! EMBEDDED DOKKA END, DO NOT COMMIT !!! #
+
+ - Reference (external):
- reference.md
diff --git a/gradle/templates/template-lib/src/commonMain/kotlin/HelloWorld.kt b/gradle/templates/template-lib/src/commonMain/kotlin/HelloWorld.kt
index b87d0d9..fb7defd 100644
--- a/gradle/templates/template-lib/src/commonMain/kotlin/HelloWorld.kt
+++ b/gradle/templates/template-lib/src/commonMain/kotlin/HelloWorld.kt
@@ -1,3 +1,6 @@
package opensavvy.playground.core
+/**
+ * A hello world message.
+ */
const val message = "Hello World!"
diff --git a/settings.gradle.kts b/settings.gradle.kts
index ee219fe..be40203 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -53,6 +53,7 @@ plugins {
}
include(
+ "docs:website",
"gradle:templates:template-app",
"gradle:templates:template-lib",
)
--
2.51.2
From 6768e6a0b6a1ac86b4336144343f3edc8878f014 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Wed, 8 Jan 2025 15:20:33 +0100
Subject: [PATCH 03/16] build(gradle): Increase allocated RAM for Gradle and
Kotlin
---
gradle.properties | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gradle.properties b/gradle.properties
index 30acaaf..f8c302a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -24,3 +24,7 @@ org.gradle.configureondemand=true
# Dokka v2
# See https://kotl.in/dokka-gradle-migration
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
+
+# System resource usage
+org.gradle.jvmargs=-Xmx1024m -XX:MaxMetaspaceSize=1024m
+kotlin.daemon.jvmargs=-Xmx1024m -XX:MaxMetaspaceSize=512m
--
2.51.2
From 73ad1089a9f3649a324252d0cd96ac94021d10c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Sat, 8 Feb 2025 16:29:56 +0100
Subject: [PATCH 04/16] docs(website): Include the project changelog in the
News section of the website
---
docs/website/.gitlab-ci.yml | 1 +
docs/website/docs/news/index.md | 1 +
docs/website/docs/news/tags.md | 1 +
docs/website/generate-news.sh | 20 ++++++++++++++++++++
docs/website/mkdocs.yml | 18 +++++++++++++++++-
5 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 docs/website/docs/news/index.md
create mode 100644 docs/website/docs/news/tags.md
create mode 100755 docs/website/generate-news.sh
diff --git a/docs/website/.gitlab-ci.yml b/docs/website/.gitlab-ci.yml
index 03d65b2..d6f539b 100644
--- a/docs/website/.gitlab-ci.yml
+++ b/docs/website/.gitlab-ci.yml
@@ -11,6 +11,7 @@ mkdocs:
script:
- pwd
+ - ./generate-news.sh
- mkdocs build --site-dir ../../docs-website
after_script:
diff --git a/docs/website/docs/news/index.md b/docs/website/docs/news/index.md
new file mode 100644
index 0000000..e614590
--- /dev/null
+++ b/docs/website/docs/news/index.md
@@ -0,0 +1 @@
+# News
diff --git a/docs/website/docs/news/tags.md b/docs/website/docs/news/tags.md
new file mode 100644
index 0000000..920c8a4
--- /dev/null
+++ b/docs/website/docs/news/tags.md
@@ -0,0 +1 @@
+# News by category
diff --git a/docs/website/generate-news.sh b/docs/website/generate-news.sh
new file mode 100755
index 0000000..b61ae4b
--- /dev/null
+++ b/docs/website/generate-news.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+mkdir -p docs/news/posts/releases
+
+for tag in $(git tag --list -n1 | cut -d' ' -f1); do
+ echo "Found tag $tag"
+ tag_file="docs/news/posts/releases/release-$tag.md"
+
+ git for-each-ref \
+ --format="---%ndate:%n created: %(taggerdate:short)%nslug: v$tag%ntags: [New version]%n---%n%n# $tag • %(subject)%n%n%(contents:body)" \
+ "refs/tags/$tag" \
+ | sed 's/%n/\n/g' \
+ | sed -r "s~\#([0-9]+)~[#\1]($CI_PROJECT_URL/-/issues/\1)~g" \
+ | sed -r "s~([0-9a-f]{4,40})([,\)])~[#\1]($CI_PROJECT_URL/-/commit/\1)\2~g" \
+ | sed -r "s~!([0-9]+)~[!\1]($CI_PROJECT_URL/-/merge_requests/\1)~g" \
+ >"$tag_file"
+
+ echo -e "\n\n" >>"$tag_file"
+ echo -e "\n\n***\n\n[Browse the documentation for this version]($CI_PROJECT_URL/-/jobs/artifacts/$tag/browse/docs-website?job=mkdocs) • [View release in GitLab]($CI_PROJECT_URL/-/releases/$tag)" >>"$tag_file"
+done
diff --git a/docs/website/mkdocs.yml b/docs/website/mkdocs.yml
index fe08434..d937971 100644
--- a/docs/website/mkdocs.yml
+++ b/docs/website/mkdocs.yml
@@ -60,9 +60,21 @@ theme:
name: "Dark theme (click to switch to system)"
plugins:
- - social
+ # - social # https://github.com/squidfunk/mkdocs-material/issues/7818
- search
- privacy
+ - blog:
+ post_excerpt: optional
+ authors: false
+ blog_dir: news
+ - tags:
+ tag_file: news/tags.md
+ - rss:
+ match_path: 'news/posts/.*'
+ date_from_meta:
+ as_creation: date.created
+ as_update: date.updated
+ use_git: false
markdown_extensions:
- admonition
@@ -90,3 +102,7 @@ nav:
- Module1: []
- Module2: []
+
+ - News:
+ - news/index.md
+ - news/tags.md
--
2.51.2
From 143f6dd3a9c98bdfe6e4c2ba510d32628c738795 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Mon, 10 Feb 2025 14:59:49 +0100
Subject: [PATCH 05/16] upgrade: OpenSavvy Conventions 1.6.1
See https://gitlab.com/opensavvy/automation/gradle-conventions/-/releases/1.6.1
---
gradle/conventions/settings.gradle.kts | 2 +-
settings.gradle.kts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gradle/conventions/settings.gradle.kts b/gradle/conventions/settings.gradle.kts
index 299d08e..ad45bfd 100644
--- a/gradle/conventions/settings.gradle.kts
+++ b/gradle/conventions/settings.gradle.kts
@@ -45,7 +45,7 @@ pluginManagement {
}
plugins {
- id("dev.opensavvy.conventions.settings") version "1.6.0"
+ id("dev.opensavvy.conventions.settings") version "1.6.1"
}
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
diff --git a/settings.gradle.kts b/settings.gradle.kts
index be40203..9275d1a 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -49,7 +49,7 @@ pluginManagement {
}
plugins {
- id("dev.opensavvy.conventions.settings") version "1.6.0"
+ id("dev.opensavvy.conventions.settings") version "1.6.1"
}
include(
--
2.51.2
From af37c3b533e08d64d70fb3709d08591c9ba2a048 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Sat, 22 Feb 2025 21:19:36 +0100
Subject: [PATCH 06/16] build(website): Enable definition lists
---
docs/website/mkdocs.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/website/mkdocs.yml b/docs/website/mkdocs.yml
index d937971..0e44abd 100644
--- a/docs/website/mkdocs.yml
+++ b/docs/website/mkdocs.yml
@@ -79,6 +79,7 @@ plugins:
markdown_extensions:
- admonition
- attr_list
+ - def_list
- md_in_html
- pymdownx.details
- pymdownx.superfences
--
2.51.2
From 72425fb4d4075a1328a9e110a3bd3f5200a80230 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Sat, 22 Feb 2025 21:22:19 +0100
Subject: [PATCH 07/16] build(website): Enable footnotes
---
docs/website/mkdocs.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/website/mkdocs.yml b/docs/website/mkdocs.yml
index 0e44abd..b50d863 100644
--- a/docs/website/mkdocs.yml
+++ b/docs/website/mkdocs.yml
@@ -81,6 +81,7 @@ markdown_extensions:
- attr_list
- def_list
- md_in_html
+ - footnotes
- pymdownx.details
- pymdownx.superfences
- pymdownx.highlight:
--
2.51.2
From 0d90021d18ddc3fb2ec56ba3fbc1a9ebb899667a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Sat, 22 Feb 2025 21:24:51 +0100
Subject: [PATCH 08/16] build(website): Generate permalink anchors next to
titles
---
docs/website/mkdocs.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/website/mkdocs.yml b/docs/website/mkdocs.yml
index b50d863..143378c 100644
--- a/docs/website/mkdocs.yml
+++ b/docs/website/mkdocs.yml
@@ -91,6 +91,8 @@ markdown_extensions:
- pymdownx.inlinehilite
- pymdownx.tabbed:
alternate_style: true
+ - toc:
+ permalink: true
edit_uri: edit/main/docs/website/docs
--
2.51.2
From 00e7c2a296e50ccf4f6c9c3aa7a03a02f460ad1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Sat, 22 Feb 2025 21:25:14 +0100
Subject: [PATCH 09/16] build(website): Enable tables
---
docs/website/mkdocs.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/website/mkdocs.yml b/docs/website/mkdocs.yml
index 143378c..a6f6b92 100644
--- a/docs/website/mkdocs.yml
+++ b/docs/website/mkdocs.yml
@@ -82,6 +82,7 @@ markdown_extensions:
- def_list
- md_in_html
- footnotes
+ - tables
- pymdownx.details
- pymdownx.superfences
- pymdownx.highlight:
--
2.51.2
From 1036db046be45a159a083e5fc58c856d907ece38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Sun, 2 Mar 2025 11:29:57 +0100
Subject: [PATCH 10/16] upgrade: Gradle Conventions 1.6.2
See https://gitlab.com/opensavvy/automation/gradle-conventions/-/releases/1.6.2
---
gradle/conventions/settings.gradle.kts | 2 +-
settings.gradle.kts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gradle/conventions/settings.gradle.kts b/gradle/conventions/settings.gradle.kts
index ad45bfd..374fdf7 100644
--- a/gradle/conventions/settings.gradle.kts
+++ b/gradle/conventions/settings.gradle.kts
@@ -45,7 +45,7 @@ pluginManagement {
}
plugins {
- id("dev.opensavvy.conventions.settings") version "1.6.1"
+ id("dev.opensavvy.conventions.settings") version "1.6.2"
}
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 9275d1a..5cab16c 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -49,7 +49,7 @@ pluginManagement {
}
plugins {
- id("dev.opensavvy.conventions.settings") version "1.6.1"
+ id("dev.opensavvy.conventions.settings") version "1.6.2"
}
include(
--
2.51.2
From 9d1182412511acc31e6e73ebb1bdb1e1a3919551 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Sun, 2 Mar 2025 11:32:03 +0100
Subject: [PATCH 11/16] upgrade: CI Containers 0.7.0
---
.gitlab-ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 060d851..517d679 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,7 +12,7 @@ include:
variables:
# https://gitlab.com/opensavvy/automation/containers
- ci_containers: 0.6.0
+ ci_containers: 0.7.0
workflow:
rules:
--
2.51.2
From 7fa93efc6d6b0648c49fd50afea8578540fa4979 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Fri, 4 Apr 2025 16:49:11 +0200
Subject: [PATCH 12/16] upgrade: Gradle Conventions 1.6.3
See https://gitlab.com/opensavvy/automation/gradle-conventions/-/releases/1.6.3
---
gradle/conventions/settings.gradle.kts | 2 +-
gradle/templates/template-app/build.gradle.kts | 11 +++++------
settings.gradle.kts | 2 +-
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/gradle/conventions/settings.gradle.kts b/gradle/conventions/settings.gradle.kts
index 374fdf7..504e1e1 100644
--- a/gradle/conventions/settings.gradle.kts
+++ b/gradle/conventions/settings.gradle.kts
@@ -45,7 +45,7 @@ pluginManagement {
}
plugins {
- id("dev.opensavvy.conventions.settings") version "1.6.2"
+ id("dev.opensavvy.conventions.settings") version "1.6.3"
}
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
diff --git a/gradle/templates/template-app/build.gradle.kts b/gradle/templates/template-app/build.gradle.kts
index db2a969..47e8666 100644
--- a/gradle/templates/template-app/build.gradle.kts
+++ b/gradle/templates/template-app/build.gradle.kts
@@ -1,19 +1,18 @@
plugins {
alias(opensavvyConventions.plugins.base)
alias(opensavvyConventions.plugins.kotlin.application)
- application
}
kotlin {
jvm {
- withJava() // required by the application plugin
+ binaries {
+ executable {
+ mainClass.set("opensavvy.playground.app.MainKt")
+ }
+ }
}
sourceSets.commonMain.dependencies {
implementation(projects.gradle.templates.templateLib)
}
}
-
-application {
- mainClass.set("opensavvy.playground.app.MainKt")
-}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 5cab16c..15475e7 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -49,7 +49,7 @@ pluginManagement {
}
plugins {
- id("dev.opensavvy.conventions.settings") version "1.6.2"
+ id("dev.opensavvy.conventions.settings") version "1.6.3"
}
include(
--
2.51.2
From d22e03b05f2dd2909a95c2d874668986431db5d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Fri, 18 Apr 2025 20:20:42 +0200
Subject: [PATCH 13/16] feat(vite-kotlin): Support Kotlin 2.1.20
---
examples/multi-project/app/build.gradle.kts | 2 +-
examples/multi-project/build.gradle.kts | 2 +-
examples/multi-project/core/build.gradle.kts | 2 +-
examples/simple/build.gradle.kts | 2 +-
vite-kotlin/src/main/kotlin/tasks/Copy.kt | 2 +-
.../src/main/kotlin/tasks/ViteExecTask.kt | 31 ++++++++++---------
6 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/examples/multi-project/app/build.gradle.kts b/examples/multi-project/app/build.gradle.kts
index 197707a..024b90e 100644
--- a/examples/multi-project/app/build.gradle.kts
+++ b/examples/multi-project/app/build.gradle.kts
@@ -1,5 +1,5 @@
plugins {
- kotlin("multiplatform") version "1.9.10"
+ kotlin("multiplatform")
// List of releases: https://gitlab.com/opensavvy/kotlin-vite/-/releases
id("dev.opensavvy.vite.kotlin") // version "REPLACE THIS"
diff --git a/examples/multi-project/build.gradle.kts b/examples/multi-project/build.gradle.kts
index 77eb5fc..48cb32f 100644
--- a/examples/multi-project/build.gradle.kts
+++ b/examples/multi-project/build.gradle.kts
@@ -1,6 +1,6 @@
plugins {
base
- kotlin("multiplatform") version "1.9.10" apply false
+ kotlin("multiplatform") version "2.1.20" apply false
}
repositories {
diff --git a/examples/multi-project/core/build.gradle.kts b/examples/multi-project/core/build.gradle.kts
index 2ebf3a8..d7896fb 100644
--- a/examples/multi-project/core/build.gradle.kts
+++ b/examples/multi-project/core/build.gradle.kts
@@ -1,5 +1,5 @@
plugins {
- kotlin("multiplatform") version "1.9.10"
+ kotlin("multiplatform")
}
repositories {
diff --git a/examples/simple/build.gradle.kts b/examples/simple/build.gradle.kts
index 12d55ce..01b70d4 100644
--- a/examples/simple/build.gradle.kts
+++ b/examples/simple/build.gradle.kts
@@ -1,5 +1,5 @@
plugins {
- kotlin("multiplatform") version "1.9.10"
+ kotlin("multiplatform") version "2.1.20"
// List of releases: https://gitlab.com/opensavvy/kotlin-vite/-/releases
id("dev.opensavvy.vite.kotlin") // version "REPLACE THIS"
diff --git a/vite-kotlin/src/main/kotlin/tasks/Copy.kt b/vite-kotlin/src/main/kotlin/tasks/Copy.kt
index cc7c1d8..16e3a6d 100644
--- a/vite-kotlin/src/main/kotlin/tasks/Copy.kt
+++ b/vite-kotlin/src/main/kotlin/tasks/Copy.kt
@@ -20,7 +20,7 @@ internal fun createCopyTask(project: Project, name: String, sourceTask: String,
group = KotlinVitePlugin.GROUP
description = "Prepares the Vite working directory"
- dependsOn("jsPackageJson", ":kotlinNodeJsSetup")
+ dependsOn("jsPackageJson", "kotlinNodeJsSetup")
from(project.tasks.named(sourceTask))
into(destination.map { it.dir("kotlin") })
diff --git a/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt b/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
index 87e0cba..04c3656 100644
--- a/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
+++ b/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
@@ -6,27 +6,28 @@ import opensavvy.gradle.vite.kotlin.viteBuildDevDir
import opensavvy.gradle.vite.kotlin.viteBuildDistDir
import opensavvy.gradle.vite.kotlin.viteBuildProdDir
import org.gradle.api.Project
-import org.gradle.api.file.RegularFile
-import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin.Companion.kotlinNodeJsExtension
-import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject
+import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin
+import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import java.io.File
private fun ViteExec.execConventions() {
dependsOn(":kotlinNpmInstall")
group = KotlinVitePlugin.GROUP
- val kotlinEnvironment = project.rootProject.kotlinNodeJsExtension
- nodePath.set(
- kotlinEnvironment
- .requireConfigured()
- .let { RegularFile { File(it.nodeExecutable) } }
- )
-
- vitePath.set(
- kotlinEnvironment
- .projectPackagesDir.parentFile.resolve(NpmProject.NODE_MODULES)
- .let { RegularFile { File("$it/vite/bin/vite.js") } }
- )
+ fun File.child(name: String) = File(this, name)
+
+ nodePath.set {
+ File(NodeJsPlugin.apply(project).executable.get())
+ }
+
+ vitePath.set {
+ NodeJsRootPlugin.apply(project.rootProject)
+ .projectPackagesDirectory.get()
+ .asFile.parentFile
+ .child("node_modules")
+ .child(".bin")
+ .child("vite")
+ }
}
internal fun createExecTasks(project: Project) {
--
2.51.2
From 42309af3d61c1f50489f460146268c1c19f26ef6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Tue, 3 Jun 2025 12:27:33 +0200
Subject: [PATCH 14/16] feat(vite-kotlin): Reorganize the Kotlin plugin to use
RequiresNpmDependencies
---
.../src/main/kotlin/tasks/ViteExecTask.kt | 59 +++++++++++++------
1 file changed, 40 insertions(+), 19 deletions(-)
diff --git a/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt b/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
index 04c3656..b6a08e5 100644
--- a/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
+++ b/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
@@ -6,35 +6,57 @@ import opensavvy.gradle.vite.kotlin.viteBuildDevDir
import opensavvy.gradle.vite.kotlin.viteBuildDistDir
import opensavvy.gradle.vite.kotlin.viteBuildProdDir
import org.gradle.api.Project
+import org.gradle.api.tasks.CacheableTask
+import org.gradle.api.tasks.Internal
+import org.gradle.kotlin.dsl.getByType
+import org.gradle.process.ExecOperations
+import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
+import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
+import org.jetbrains.kotlin.gradle.targets.js.NpmPackageVersion
+import org.jetbrains.kotlin.gradle.targets.js.RequiredKotlinJsDependency
+import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin
-import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
+import org.jetbrains.kotlin.gradle.targets.js.npm.RequiresNpmDependencies
+import org.jetbrains.kotlin.gradle.targets.js.npm.npmProject
import java.io.File
+import javax.inject.Inject
-private fun ViteExec.execConventions() {
- dependsOn(":kotlinNpmInstall")
- group = KotlinVitePlugin.GROUP
+/**
+ * A specialization of [ViteExec] that uses the Kotlin Gradle Plugin to download
+ * Vite.
+ */
+@CacheableTask
+abstract class KotlinViteExec @Inject constructor(
+ process: ExecOperations,
+) : ViteExec(process), RequiresNpmDependencies {
- fun File.child(name: String) = File(this, name)
+ @get:Internal
+ override val compilation: KotlinJsIrCompilation
+ get() = project.extensions.getByType().js()
+ .compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME)
- nodePath.set {
- File(NodeJsPlugin.apply(project).executable.get())
- }
+ @get:Internal
+ override val requiredNpmDependencies: Set
+ get() = setOf(NpmPackageVersion("vite", config.version.get()))
+
+ init {
+ dependsOn(":kotlinNpmInstall", "kotlinNodeJsSetup", "jsPackageJson")
+ group = KotlinVitePlugin.GROUP
+
+ nodePath.set {
+ File(NodeJsPlugin.apply(project.rootProject).executable.get())
+ }
- vitePath.set {
- NodeJsRootPlugin.apply(project.rootProject)
- .projectPackagesDirectory.get()
- .asFile.parentFile
- .child("node_modules")
- .child(".bin")
- .child("vite")
+ vitePath.set {
+ File(compilation.npmProject.require("vite"))
+ }
}
}
internal fun createExecTasks(project: Project) {
- project.tasks.register("viteBuild", ViteExec::class.java) {
+ project.tasks.register("viteBuild", KotlinViteExec::class.java) {
description = "Builds the production variant of the project"
dependsOn("viteConfigureProd", "viteCompileProd")
- execConventions()
command.set("build")
@@ -43,10 +65,9 @@ internal fun createExecTasks(project: Project) {
outputs.dir(project.viteBuildDistDir)
}
- project.tasks.register("viteRun", ViteExec::class.java) {
+ project.tasks.register("viteRun", KotlinViteExec::class.java) {
description = "Hosts the development variant of the project"
dependsOn("viteConfigureDev", "viteCompileDev")
- execConventions()
config.root.set(project.viteBuildDevDir.map { it.dir("kotlin") })
configurationFile.set(project.viteBuildDevDir.map { it.file("vite.config.js") })
--
2.51.2
From 9951de8f4d5f2d4b7610aee0f46567365125294e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Wed, 25 Jun 2025 17:59:06 +0200
Subject: [PATCH 15/16] fix(vite-base): Workaround for KT78612
Previously, the Kotlin plugin created tasks to install NodeJS only in the root project. Since 2.1.0, each Multiplatform project has its own `kotlinNodeJsSetup` tasks, which all install NodeJS in the same location.
When we create a task that uses the NodeJS path, Gradle detects that other tasks output it and requests that our task declares a dependency on all such tasks. However, this is meaningless, as only the task in the current project matters.
As a workaround, we mark the NodeJS installation path as a String instead of a File. This disables Gradle's checks.
See https://gitlab.com/opensavvy/automation/kotlin-vite/-/issues/55
See https://gitlab.com/opensavvy/automation/kotlin-vite/-/merge_requests/96
See https://kotlinlang.slack.com/archives/C0B8L3U69/p1736281644920429
See https://youtrack.jetbrains.com/issue/KT-78612
---
vite-base/src/main/kotlin/tasks/ViteExec.kt | 4 ++--
vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/vite-base/src/main/kotlin/tasks/ViteExec.kt b/vite-base/src/main/kotlin/tasks/ViteExec.kt
index 7125716..538e3ad 100644
--- a/vite-base/src/main/kotlin/tasks/ViteExec.kt
+++ b/vite-base/src/main/kotlin/tasks/ViteExec.kt
@@ -51,8 +51,8 @@ abstract class ViteExec @Inject constructor(
* Use this property to override which Node installation is used.
* By default, the Node installation used by the Kotlin plugin is used.
*/
- @get:InputFile
- @get:PathSensitive(PathSensitivity.RELATIVE)
+ @get:Internal // WORKAROUND for https://youtrack.jetbrains.com/issue/KT-78612
+ // Once it's fixed, revert the commit that added this comment
abstract val nodePath: RegularFileProperty
/**
diff --git a/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt b/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
index b6a08e5..7c4b05f 100644
--- a/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
+++ b/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
@@ -40,7 +40,7 @@ abstract class KotlinViteExec @Inject constructor(
get() = setOf(NpmPackageVersion("vite", config.version.get()))
init {
- dependsOn(":kotlinNpmInstall", "kotlinNodeJsSetup", "jsPackageJson")
+ dependsOn("kotlinNodeJsSetup", "jsPackageJson", ":kotlinNpmInstall")
group = KotlinVitePlugin.GROUP
nodePath.set {
--
2.51.2
From cd72a9bdb73b77f555dbe70bf41d0e1555137b98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?=
Date: Thu, 26 Jun 2025 09:42:19 +0200
Subject: [PATCH 16/16] fix(vite-kotlin): Workaround for configuration cache
incompatibility
---
vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt b/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
index 7c4b05f..d97a4d9 100644
--- a/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
+++ b/vite-kotlin/src/main/kotlin/tasks/ViteExecTask.kt
@@ -17,7 +17,6 @@ import org.jetbrains.kotlin.gradle.targets.js.RequiredKotlinJsDependency
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin
import org.jetbrains.kotlin.gradle.targets.js.npm.RequiresNpmDependencies
-import org.jetbrains.kotlin.gradle.targets.js.npm.npmProject
import java.io.File
import javax.inject.Inject
@@ -47,9 +46,13 @@ abstract class KotlinViteExec @Inject constructor(
File(NodeJsPlugin.apply(project.rootProject).executable.get())
}
- vitePath.set {
- File(compilation.npmProject.require("vite"))
- }
+ // In theory, we should be able to access the Vite path via:
+ // File(compilation.npmProject.require("vite"))
+ // However, the configuration cache will initialize all inputs eagerly, and the above line
+ // throws if executed before the :kotlinNpmInstall task. Using the line above thus
+ // results in a build that crashes after a clean build, but works if a :kotlinNpmInstall is executed
+ // by itself first.
+ vitePath.set(project.rootProject.layout.buildDirectory.file("js/node_modules/vite/bin/vite.js"))
}
}