diff --git a/README.md b/README.md index 121f2853..f6f8007d 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ pluginManagement { ```kotlin // build.gradle.kts plugins { - kotlin("multiplatform") version "2.3.20" + kotlin("multiplatform") version "2.4.20" id("dev.nucleusframework.nna") version "0.1.0" } ``` @@ -63,7 +63,7 @@ kotlin { jvm() sourceSets { - val jvmMain by getting { + jvmMain { dependencies { // your JVM dependencies (Compose, Ktor, etc.) } @@ -341,7 +341,7 @@ calc.add(5) // works normally after exception ## Benchmarks — Native (FFM) vs Pure JVM -Measured on Intel Core i5-14600 (20 cores), 45 GB RAM, Ubuntu 25.10, JDK 25 (GraalVM), Kotlin 2.3.20. +Measured on Intel Core i5-14600 (20 cores), 45 GB RAM, Ubuntu 25.10, JDK 25 (GraalVM), Kotlin 2.4.20. **Methodology**: each benchmark runs the operation in a tight loop. 3 warmup iterations are discarded, then 5 measured iterations are averaged. "Native" creates a proxy object via FFM and calls into the Kotlin/Native shared library (.so). "JVM" runs the equivalent Kotlin/JVM code directly. Ratio = native/jvm (>1 = native slower due to FFM overhead). Memory is measured via `Runtime.totalMemory() - freeMemory()` before/after with explicit GC. @@ -488,7 +488,7 @@ my-app/ ```kotlin plugins { - kotlin("multiplatform") version "2.3.20" + kotlin("multiplatform") version "2.4.20" id("dev.nucleusframework.nna") } @@ -508,9 +508,9 @@ kotlinNativeExport { ```kotlin plugins { - kotlin("multiplatform") version "2.3.20" - id("org.jetbrains.compose") version "1.10.2" - id("org.jetbrains.kotlin.plugin.compose") version "2.3.20" + kotlin("multiplatform") version "2.4.20" + id("org.jetbrains.compose") version "1.12.1" + id("org.jetbrains.kotlin.plugin.compose") version "2.4.20" id("io.github.kdroidfilter.nucleus") version "1.7.2" } @@ -519,7 +519,7 @@ kotlin { jvm() sourceSets { - val jvmMain by getting { + jvmMain { dependencies { implementation(compose.desktop.currentOs) implementation(project(":native")) @@ -544,7 +544,7 @@ You can combine the plugin with Kotlin/Native cinterop to wrap native C librarie // build.gradle.kts kotlin { linuxX64().compilations["main"].cinterops { - val libnotify by creating { + create("libnotify") { defFile(project.file("src/nativeInterop/cinterop/libnotify.def")) } } @@ -632,7 +632,7 @@ Data classes are supported as value types (field marshalling), and `commonMain` ## Requirements -- **Kotlin** 2.3.20+ +- **Kotlin** 2.4.20+ - **Gradle** 9.1+ (for JDK 25 support) - **JDK** 22+ (FFM stable since JDK 22 / JEP 454), recommended 25 - **Kotlin/Native** toolchain (bundled with KMP plugin) diff --git a/examples/benchmark/build.gradle.kts b/examples/benchmark/build.gradle.kts index 228ad8a9..0a0b7930 100644 --- a/examples/benchmark/build.gradle.kts +++ b/examples/benchmark/build.gradle.kts @@ -17,7 +17,7 @@ kotlin { jvm() sourceSets { - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test")) } diff --git a/examples/calculator/build.gradle.kts b/examples/calculator/build.gradle.kts index 87d70368..cd806731 100644 --- a/examples/calculator/build.gradle.kts +++ b/examples/calculator/build.gradle.kts @@ -2,8 +2,9 @@ import io.github.kdroidfilter.nucleus.desktop.application.dsl.TargetFormat plugins { kotlin("multiplatform") - id("org.jetbrains.compose") version "1.10.2" - id("org.jetbrains.kotlin.plugin.compose") version "2.3.20" + id("org.jetbrains.compose") version "1.12.1" + id("org.jetbrains.kotlin.plugin.compose") version "2.4.20" + id("org.jetbrains.compose.hot-reload") version "1.3.0-beta01" id("io.github.kdroidfilter.nucleus") version "1.7.2" id("dev.nucleusframework.nna") } @@ -23,14 +24,14 @@ kotlin { jvm() sourceSets { - val jvmMain by getting { + jvmMain { dependencies { implementation(compose.desktop.currentOs) - implementation(compose.runtime) + implementation("org.jetbrains.compose.runtime:runtime:1.12.1") implementation("io.github.kdroidfilter:nucleus.graalvm-runtime:1.7.2") } } - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test")) implementation(kotlin("test-junit5")) diff --git a/examples/calculator/src/jvmTest/kotlin/com/example/calculator/InheritanceTest.kt b/examples/calculator/src/jvmTest/kotlin/com/example/calculator/InheritanceTest.kt index fdb14ce1..98fcee1f 100644 --- a/examples/calculator/src/jvmTest/kotlin/com/example/calculator/InheritanceTest.kt +++ b/examples/calculator/src/jvmTest/kotlin/com/example/calculator/InheritanceTest.kt @@ -2,6 +2,7 @@ package com.example.calculator import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertFalse import kotlin.test.assertTrue import kotlin.test.assertNotEquals import java.lang.Math.PI @@ -583,13 +584,13 @@ class InheritanceTest { @Test fun `Circle is not Rectangle`() { Circle(2.0).use { circle -> - assertTrue(circle !is Rectangle) + assertFalse(Rectangle::class.isInstance(circle)) } } @Test fun `Cube is not Cylinder`() { Cube(2.0).use { cube -> - assertTrue(cube !is Cylinder) + assertFalse(Cylinder::class.isInstance(cube)) } } diff --git a/examples/calculator/src/jvmTest/kotlin/com/example/calculator/InterfaceTest.kt b/examples/calculator/src/jvmTest/kotlin/com/example/calculator/InterfaceTest.kt index a137559b..40b59585 100644 --- a/examples/calculator/src/jvmTest/kotlin/com/example/calculator/InterfaceTest.kt +++ b/examples/calculator/src/jvmTest/kotlin/com/example/calculator/InterfaceTest.kt @@ -152,7 +152,7 @@ class InterfaceTest { @Test fun `Scale - does not implement Printable`() { Scale(10.0).use { scale -> - assertFalse(scale is Printable) + assertFalse(Printable::class.isInstance(scale)) } } @@ -440,7 +440,7 @@ class InterfaceTest { assertTrue(ruler is Measurable) assertTrue(ruler is Printable) assertTrue(scale is Measurable) - assertFalse(scale is Printable) + assertFalse(Printable::class.isInstance(scale)) } } } diff --git a/examples/systeminfo/build.gradle.kts b/examples/systeminfo/build.gradle.kts index 87c39360..447950b7 100644 --- a/examples/systeminfo/build.gradle.kts +++ b/examples/systeminfo/build.gradle.kts @@ -2,8 +2,9 @@ import io.github.kdroidfilter.nucleus.desktop.application.dsl.TargetFormat plugins { kotlin("multiplatform") - id("org.jetbrains.compose") version "1.10.2" - id("org.jetbrains.kotlin.plugin.compose") version "2.3.20" + id("org.jetbrains.compose") version "1.12.1" + id("org.jetbrains.kotlin.plugin.compose") version "2.4.20" + id("org.jetbrains.compose.hot-reload") version "1.3.0-beta01" id("io.github.kdroidfilter.nucleus") version "1.7.2" id("dev.nucleusframework.nna") } @@ -41,13 +42,13 @@ kotlin { // cinterop with libnotify (real Linux native notifications via D-Bus) if (hostOs == "Linux") { nativeTarget.compilations["main"].cinterops { - val libnotify by creating { + create("libnotify") { defFile(project.file("src/nativeInterop/cinterop/libnotify.def")) } - val systray by creating { + create("systray") { defFile(project.file("src/nativeInterop/cinterop/systray.def")) } - val gio by creating { + create("gio") { defFile(project.file("src/nativeInterop/cinterop/gio.def")) } @@ -57,7 +58,7 @@ kotlin { // cinterop with Win32 Shell API (tray icon + toast notifications) if (hostOs.startsWith("Windows")) { nativeTarget.compilations["main"].cinterops { - val wintray by creating { + create("wintray") { defFile(project.file("src/nativeInterop/cinterop/wintray.def")) } } @@ -66,15 +67,15 @@ kotlin { jvm() sourceSets { - val jvmMain by getting { + jvmMain { dependencies { implementation(compose.desktop.currentOs) - implementation(compose.runtime) + implementation("org.jetbrains.compose.runtime:runtime:1.12.1") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.10.2") implementation("io.github.kdroidfilter:nucleus.graalvm-runtime:1.7.2") } } - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test")) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cd149a11..5c196776 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "2.3.20" +kotlin = "2.4.20" pluginPublish = "2.1.0" versionCheck = "0.53.0" kotlinx-coroutines = "1.11.0" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1b33c55b..5097068a 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c82ad3ff..dad02418 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.0-all.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 23d15a93..249efbb0 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/gradlew.bat b/gradlew.bat index db3a6ac2..3185a43f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -19,12 +19,39 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -45,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -59,36 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :execute @rem Setup the command line -set CLASSPATH= -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/plugin-build/gradle/wrapper/gradle-wrapper.jar b/plugin-build/gradle/wrapper/gradle-wrapper.jar index 1b33c55b..5097068a 100644 Binary files a/plugin-build/gradle/wrapper/gradle-wrapper.jar and b/plugin-build/gradle/wrapper/gradle-wrapper.jar differ diff --git a/plugin-build/gradle/wrapper/gradle-wrapper.properties b/plugin-build/gradle/wrapper/gradle-wrapper.properties index c82ad3ff..dad02418 100644 --- a/plugin-build/gradle/wrapper/gradle-wrapper.properties +++ b/plugin-build/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.0-all.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugin-build/gradlew b/plugin-build/gradlew index 23d15a93..249efbb0 100755 --- a/plugin-build/gradlew +++ b/plugin-build/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/plugin-build/gradlew.bat b/plugin-build/gradlew.bat index db3a6ac2..3185a43f 100644 --- a/plugin-build/gradlew.bat +++ b/plugin-build/gradlew.bat @@ -19,12 +19,39 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -45,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -59,36 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :execute @rem Setup the command line -set CLASSPATH= -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/plugin-build/plugin/src/test/kotlin/dev/nucleusframework/nna/plugin/VersionCatalogIndependenceTest.kt b/plugin-build/plugin/src/test/kotlin/dev/nucleusframework/nna/plugin/VersionCatalogIndependenceTest.kt index 9d60fe8e..86936775 100644 --- a/plugin-build/plugin/src/test/kotlin/dev/nucleusframework/nna/plugin/VersionCatalogIndependenceTest.kt +++ b/plugin-build/plugin/src/test/kotlin/dev/nucleusframework/nna/plugin/VersionCatalogIndependenceTest.kt @@ -31,7 +31,7 @@ class VersionCatalogIndependenceTest { writeConsumerProject( catalogToml = """ [versions] - kotlin = "2.3.20" + kotlin = "2.4.20" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } @@ -48,7 +48,7 @@ class VersionCatalogIndependenceTest { writeConsumerProject( catalogToml = """ [versions] - kotlin = "2.3.20" + kotlin = "2.4.20" [libraries] kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.10.2" } @@ -89,7 +89,7 @@ class VersionCatalogIndependenceTest { File(root, "build.gradle.kts").writeText( """ plugins { - kotlin("multiplatform") version "2.3.20" + kotlin("multiplatform") version "2.4.20" id("dev.nucleusframework.nna") } diff --git a/settings.gradle.kts b/settings.gradle.kts index f5cd1ce4..f6c695a1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,7 +4,7 @@ pluginManagement { plugins { // Pin KMP version here so sub-projects don't need to re-declare it // (avoids "already on classpath with unknown version" from the composite build) - kotlin("multiplatform") version "2.3.20" + kotlin("multiplatform") version "2.4.20" } repositories { gradlePluginPortal() @@ -21,6 +21,7 @@ dependencyResolutionManagement { plugins { id("com.gradle.develocity") version "4.4.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" } develocity {