From 403967aec4df313c949671402fa0a924ab13fbd3 Mon Sep 17 00:00:00 2001 From: Jolan Rensen Date: Wed, 8 Jan 2025 14:52:53 +0100 Subject: [PATCH] init multiplatform example project --- .../.gradle/8.5/checksums/checksums.lock | Bin 0 -> 17 bytes .../.gradle/8.5/checksums/sha1-checksums.bin | Bin 0 -> 19307 bytes .../dependencies-accessors.lock | Bin 0 -> 17 bytes .../8.5/dependencies-accessors/gc.properties | 0 .../executionHistory/executionHistory.lock | Bin 0 -> 17 bytes .../.gradle/8.5/fileChanges/last-build.bin | Bin 0 -> 1 bytes .../.gradle/8.5/fileHashes/fileHashes.lock | Bin 0 -> 17 bytes .../.gradle/8.5/gc.properties | 0 .../buildOutputCleanup.lock | Bin 0 -> 17 bytes .../buildOutputCleanup/cache.properties | 2 + .../buildOutputCleanup/outputFiles.bin | Bin 0 -> 21845 bytes .../.gradle/vcs-1/gc.properties | 0 .../build.gradle.kts | 4 + .../common/build.gradle.kts | 36 +++ .../nl/jolanrensen/example/Constants.kt | 3 + .../kotlin/nl/jolanrensen/example/Greeting.kt | 7 + .../kotlin/nl/jolanrensen/example/Platform.kt | 7 + .../nl/jolanrensen/example/Platform.jvm.kt | 7 + .../nl/jolanrensen/example/Platform.wasmJs.kt | 7 + .../gradle/wrapper/gradle-wrapper.properties | 6 + .../gradlew | 234 ++++++++++++++++++ .../gradlew.bat | 89 +++++++ .../jvm/build.gradle.kts | 17 ++ .../nl/jolanrensen/example/Application.kt | 5 + .../settings.gradle.kts | 19 ++ settings.gradle.kts | 3 +- 26 files changed, 445 insertions(+), 1 deletion(-) create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/8.5/checksums/checksums.lock create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/8.5/checksums/sha1-checksums.bin create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/8.5/dependencies-accessors/dependencies-accessors.lock create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/8.5/dependencies-accessors/gc.properties create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/8.5/executionHistory/executionHistory.lock create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/8.5/fileChanges/last-build.bin create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/8.5/fileHashes/fileHashes.lock create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/8.5/gc.properties create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/buildOutputCleanup/buildOutputCleanup.lock create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/buildOutputCleanup/cache.properties create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/buildOutputCleanup/outputFiles.bin create mode 100644 kodex-example-gradle-project-multiplatform/.gradle/vcs-1/gc.properties create mode 100644 kodex-example-gradle-project-multiplatform/build.gradle.kts create mode 100644 kodex-example-gradle-project-multiplatform/common/build.gradle.kts create mode 100644 kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Constants.kt create mode 100644 kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Greeting.kt create mode 100644 kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Platform.kt create mode 100644 kodex-example-gradle-project-multiplatform/common/src/jvmMain/kotlin/nl/jolanrensen/example/Platform.jvm.kt create mode 100644 kodex-example-gradle-project-multiplatform/common/src/wasmJsMain/kotlin/nl/jolanrensen/example/Platform.wasmJs.kt create mode 100644 kodex-example-gradle-project-multiplatform/gradle/wrapper/gradle-wrapper.properties create mode 100644 kodex-example-gradle-project-multiplatform/gradlew create mode 100644 kodex-example-gradle-project-multiplatform/gradlew.bat create mode 100644 kodex-example-gradle-project-multiplatform/jvm/build.gradle.kts create mode 100644 kodex-example-gradle-project-multiplatform/jvm/src/main/kotlin/nl/jolanrensen/example/Application.kt create mode 100644 kodex-example-gradle-project-multiplatform/settings.gradle.kts diff --git a/kodex-example-gradle-project-multiplatform/.gradle/8.5/checksums/checksums.lock b/kodex-example-gradle-project-multiplatform/.gradle/8.5/checksums/checksums.lock new file mode 100644 index 0000000000000000000000000000000000000000..d85bb754140e3f273b5bf30eabcc3ebc94cc640e GIT binary patch literal 17 UcmZS1_DNZ~SM!Qm`}5em zmdn4I%v5*xM7FZ`59M+*n{de8 za`&9|);z_;Pd2yWa=*5c_QIS*C-(liT%P7tY4dUXK{A`)<8p3K5Gv`+Icy;S0SG_< z0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb z2tWV=ixY4pYc}L+Nv(!k>Mg6pdz~Ho8rQ_7=S=caTfPU9|6Z47&(ZGIFzE*5X?7%{n2k z6q$D4ju{3O%BsDD>DIaQEOXB&dKAICsyu6PEkVus>4%cR?YBFGpP$F}J9!W3_tLXg zy64cdcmo%eXAOqSa&2ew`c^zTZqe-O&>@}mm}XiY_H;{au2Z>nOVd#!BqPD#3tw#C zYT)4N)@-z!Zt;WX=oX<)y{)jou%-NPlkcuby_N~Rt`k-!Ne-_qGMH9~DbvyxDYu$q zBw@+2Oi{i??7-2TuEM%~BjnZO=fw{_MYrrts5dDV%#yr+eBIU~>rBnkU*RXKTsq5& zt4x?ym@eJY>N&04iW4^^O7e>Gt5XExgb|B)`8%_2y471Er(47l>I=JIR-@jh`&tzu z!SK_mz_sOv0%WQ&?M&;(0j8zir`!tE2&gI8=8+sx>gTddVk{CwmpA>{(g~nizX6Wx BnZ^JB literal 0 HcmV?d00001 diff --git a/kodex-example-gradle-project-multiplatform/.gradle/8.5/dependencies-accessors/dependencies-accessors.lock b/kodex-example-gradle-project-multiplatform/.gradle/8.5/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000000000000000000000000000000000000..0805507dfba3bba2968f281f65235671629c5f73 GIT binary patch literal 17 UcmZR+ZML-X*&j_)1_7$D#W06+Ex!vFvP literal 0 HcmV?d00001 diff --git a/kodex-example-gradle-project-multiplatform/.gradle/buildOutputCleanup/cache.properties b/kodex-example-gradle-project-multiplatform/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 00000000..43f6404d --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Tue Jan 07 15:03:41 CET 2025 +gradle.version=8.5 diff --git a/kodex-example-gradle-project-multiplatform/.gradle/buildOutputCleanup/outputFiles.bin b/kodex-example-gradle-project-multiplatform/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..28d95d7b458a4c873834ac9fd895eff21aec9985 GIT binary patch literal 21845 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 JIqJWt`4|3khpPYp literal 0 HcmV?d00001 diff --git a/kodex-example-gradle-project-multiplatform/.gradle/vcs-1/gc.properties b/kodex-example-gradle-project-multiplatform/.gradle/vcs-1/gc.properties new file mode 100644 index 00000000..e69de29b diff --git a/kodex-example-gradle-project-multiplatform/build.gradle.kts b/kodex-example-gradle-project-multiplatform/build.gradle.kts new file mode 100644 index 00000000..0b550d39 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/build.gradle.kts @@ -0,0 +1,4 @@ +plugins { + kotlin("multiplatform") version "2.1.0" apply false + kotlin("jvm") version "2.1.0" apply false +} diff --git a/kodex-example-gradle-project-multiplatform/common/build.gradle.kts b/kodex-example-gradle-project-multiplatform/common/build.gradle.kts new file mode 100644 index 00000000..edc330f6 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/common/build.gradle.kts @@ -0,0 +1,36 @@ +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig + +plugins { + id("org.jetbrains.kotlin.multiplatform") + + // adding the Gradle plugin + id("nl.jolanrensen.kodex") version "0.4.1-SNAPSHOT" +} + +kotlin { + jvm() + + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + browser { + val rootDirPath = project.rootDir.path + val projectDirPath = project.projectDir.path + commonWebpackConfig { + devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply { + static = (static ?: mutableListOf()).apply { + // Serve sources to debug inside browser + add(rootDirPath) + add(projectDirPath) + } + } + } + } + } + + sourceSets { + commonMain.dependencies { + // put your Multiplatform dependencies here + } + } +} diff --git a/kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Constants.kt b/kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Constants.kt new file mode 100644 index 00000000..860188f1 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Constants.kt @@ -0,0 +1,3 @@ +package nl.jolanrensen.example + +const val SERVER_PORT = 8080 diff --git a/kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Greeting.kt b/kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Greeting.kt new file mode 100644 index 00000000..cf1fb321 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Greeting.kt @@ -0,0 +1,7 @@ +package nl.jolanrensen.example + +class Greeting { + private val platform = getPlatform() + + fun greet(): String = "Hello, ${platform.name}!" +} diff --git a/kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Platform.kt b/kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Platform.kt new file mode 100644 index 00000000..c63e5730 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/common/src/commonMain/kotlin/nl/jolanrensen/example/Platform.kt @@ -0,0 +1,7 @@ +package nl.jolanrensen.example + +interface Platform { + val name: String +} + +expect fun getPlatform(): Platform diff --git a/kodex-example-gradle-project-multiplatform/common/src/jvmMain/kotlin/nl/jolanrensen/example/Platform.jvm.kt b/kodex-example-gradle-project-multiplatform/common/src/jvmMain/kotlin/nl/jolanrensen/example/Platform.jvm.kt new file mode 100644 index 00000000..70483991 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/common/src/jvmMain/kotlin/nl/jolanrensen/example/Platform.jvm.kt @@ -0,0 +1,7 @@ +package nl.jolanrensen.example + +class JVMPlatform : Platform { + override val name: String = "Java ${System.getProperty("java.version")}" +} + +actual fun getPlatform(): Platform = JVMPlatform() diff --git a/kodex-example-gradle-project-multiplatform/common/src/wasmJsMain/kotlin/nl/jolanrensen/example/Platform.wasmJs.kt b/kodex-example-gradle-project-multiplatform/common/src/wasmJsMain/kotlin/nl/jolanrensen/example/Platform.wasmJs.kt new file mode 100644 index 00000000..9d875ca7 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/common/src/wasmJsMain/kotlin/nl/jolanrensen/example/Platform.wasmJs.kt @@ -0,0 +1,7 @@ +package nl.jolanrensen.example + +class WasmPlatform: Platform { + override val name: String = "Web with Kotlin/Wasm" +} + +actual fun getPlatform(): Platform = WasmPlatform() \ No newline at end of file diff --git a/kodex-example-gradle-project-multiplatform/gradle/wrapper/gradle-wrapper.properties b/kodex-example-gradle-project-multiplatform/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..61cb6080 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue Jan 07 15:03:41 CET 2025 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/kodex-example-gradle-project-multiplatform/gradlew b/kodex-example-gradle-project-multiplatform/gradlew new file mode 100644 index 00000000..1b6c7873 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 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. +# You may obtain a copy of the License at +# +# https://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. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# 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" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/kodex-example-gradle-project-multiplatform/gradlew.bat b/kodex-example-gradle-project-multiplatform/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/kodex-example-gradle-project-multiplatform/jvm/build.gradle.kts b/kodex-example-gradle-project-multiplatform/jvm/build.gradle.kts new file mode 100644 index 00000000..132de7c7 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/jvm/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + kotlin("jvm") + application +} + +group = "nl.jolanrensen.example" +version = "1.0.0" +application { + mainClass.set("nl.jolanrensen.example.ApplicationKt") +} + +kotlin { +} + +dependencies { + implementation(projects.common) +} diff --git a/kodex-example-gradle-project-multiplatform/jvm/src/main/kotlin/nl/jolanrensen/example/Application.kt b/kodex-example-gradle-project-multiplatform/jvm/src/main/kotlin/nl/jolanrensen/example/Application.kt new file mode 100644 index 00000000..a031a7f3 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/jvm/src/main/kotlin/nl/jolanrensen/example/Application.kt @@ -0,0 +1,5 @@ +package nl.jolanrensen.example + +fun main() { + println("Hello, World!") +} diff --git a/kodex-example-gradle-project-multiplatform/settings.gradle.kts b/kodex-example-gradle-project-multiplatform/settings.gradle.kts new file mode 100644 index 00000000..fc49dd98 --- /dev/null +++ b/kodex-example-gradle-project-multiplatform/settings.gradle.kts @@ -0,0 +1,19 @@ +rootProject.name = "kodex-example-gradle-project-multiplatform" +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +pluginManagement { + repositories { + maven("https://oss.sonatype.org/content/repositories/snapshots/") + gradlePluginPortal() + mavenLocal() + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + } +} + +include(":common") +include(":jvm") diff --git a/settings.gradle.kts b/settings.gradle.kts index e31f22f0..498f52d3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,9 +1,10 @@ rootProject.name = "KoDEx" +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") include("kodex-common") include("kodex-gradle-plugin") include("kodex-intellij-plugin") -include("kodex-example-gradle-project") +include("kodex-example-gradle-project-jvm") pluginManagement { repositories {