aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbe Pazos <abe@hamoid.com>2023-02-07 22:57:45 +0100
committerEdwin Jakobs <edwin@rndr.studio>2023-02-20 12:37:55 +0100
commit01d45029e6df4390f45b20ca5ec54b438e90b7ae (patch)
tree645d01e0ab991442a326861e6fc989d18773b108
parentff1942d2a821c540d7b7d804e201c6462890f7e2 (diff)
downloadart-playground-openrndr-01d45029e6df4390f45b20ca5ec54b438e90b7ae.tar.gz
art-playground-openrndr-01d45029e6df4390f45b20ca5ec54b438e90b7ae.zip
Add application gradle option to allow running custom Kt files
-rw-r--r--README.md10
-rw-r--r--build.gradle.kts9
2 files changed, 18 insertions, 1 deletions
diff --git a/README.md b/README.md
index 9727023..dab5504 100644
--- a/README.md
+++ b/README.md
@@ -10,13 +10,23 @@ If you are looking at this from IntelliJ IDEA you can start by expanding the _pr
You will find some [basic instructions](https://guide.openrndr.org/setUpYourFirstProgram.html) in the [OPENRNDR guide](https://guide.openrndr.org)
## Gradle tasks
+
- `run` runs the TemplateProgram
- `jar` creates an executable platform specific jar file with all dependencies
- `jpackageZip` creates a zip with a stand-alone executable for the current platform (works with Java 14 only)
## Cross builds
+
To create runnable jars for a platform different from the platform you use to build one uses `./gradlew jar --PtargetPlatform=<platform>`. The supported platforms are `windows`, `macos`, `linux-x64` and `linux-arm64`.
+## Run other Kotlin programs from the command line
+
+By default the `run` task runs the program called `TemplateProgram.kt`.
+If you have other programs under your src/ folder and want
+to run them from the command line use
+`./gradlew -Papplication=MyProgram` to run `MyProgram.kt`.
+A full package name can be specified like this: `-Papplication=foo.bar.MyProgram`.
+
## Github Actions
This repository contains a number of Github Actions in `./github/workflows`.
diff --git a/build.gradle.kts b/build.gradle.kts
index a5bc8fd..62982b3 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -139,6 +139,13 @@ tasks.withType<KotlinCompile> {
// ------------------------------------------------------------------------------------------------------------------ //
project.setProperty("mainClassName", applicationMainClass)
+
+application {
+ if (hasProperty("application")) {
+ mainClass.set("${property("application")}Kt")
+ }
+}
+
tasks {
named<ShadowJar>("shadowJar") {
manifest {
@@ -297,4 +304,4 @@ if (properties["openrndr.tasks"] == "true") {
group = " \uD83E\uDD8C OPENRNDR"
dependsOn("jpackageZip")
}
-} \ No newline at end of file
+}