littlektframework / littlekt

A multiplatform WebGPU 2D game framework written in Kotlin. Build your own game engine on top.
https://littlekt.com
Apache License 2.0
314 stars 12 forks source link

Looking for a JVM only buildscript #131

Closed ejektaflex closed 2 years ago

ejektaflex commented 2 years ago

A sample Github template repo would be nice, to make getting started with LittleKt a bit easier :^)

MiniGDX does this with their template, and (while I haven't used it) seemed very nice.

I tried to follow the installation instructions, but get the error:

Plugin [id: 'org.jetbrains.kotlin.multiplatform'] was not found in any of the following sources:

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
LeHaine commented 2 years ago

Hey! Try this template out. I think this is what you are looking for.

ejektaflex commented 2 years ago

Oh, thanks! I didn't see that.

Honestly, those gradle files are a bit overwhelming compared to the size of my project - the docs made it seem like it would be a bit more simple. I just want to target the JVM - and don't need such a complicated template layout. Is there any simple, single module (no submodule) build.gradle.kts for Kotlin/JVM only that I could poach?

LeHaine commented 2 years ago

I don't have any on hand but it should be as simple as creating a Kotlin JVM project in Intellij and just adding LittleKt -jvm as a dependency.

ejektaflex commented 2 years ago

Thanks, that worked perfectly! For posterity, I'll leave behind my build script:

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    kotlin("jvm") version "1.6.10"
}

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

val littleKtVersion = "0.2.0" // get the latest release at the top
val kotlinCoroutinesVersion = "1.6.0" // or whatever version you are using

dependencies {
    implementation(kotlin("stdlib"))
    implementation("com.lehaine.littlekt:core:$littleKtVersion")
    implementation("com.lehaine.littlekt:core-jvm:$littleKtVersion")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion")  // littlekt requires coroutines library on the classpath
}

tasks.withType<KotlinCompile> {
    kotlinOptions {
        jvmTarget = "11"
    }
}