Skip to content

Commit

Permalink
Don't lock Kotlin version. Other minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyettinger committed Oct 19, 2024
1 parent 49532a5 commit fc4dc31
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/gdx/liftoff/data/platforms/Android.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ buildscript {
}
plugins {
id "com.android.application" version "8.4.2"
${if (latePlugin) " id 'org.jetbrains.kotlin.android' version '2.0.21'\n" else ""}}
${if (latePlugin) " id 'org.jetbrains.kotlin.android' version '${project.languages.getVersion("kotlin")}'\n" else ""}}
android {
namespace "${project.basic.rootPackage}"
Expand Down
62 changes: 32 additions & 30 deletions src/main/kotlin/gdx/liftoff/data/platforms/Core.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gdx.liftoff.data.platforms

import gdx.liftoff.data.files.gradle.GradleFile
import gdx.liftoff.data.languages.Kotlin
import gdx.liftoff.data.project.Project
import gdx.liftoff.views.GdxPlatform

Expand Down Expand Up @@ -40,47 +41,48 @@ class CoreGradleFile(val project: Project) : GradleFile(Core.ID) {
return """
plugins {
id "java-library"
${if ( project.rootGradle.plugins.contains("kotlin")) " id 'org.jetbrains.kotlin.jvm' version '2.0.21'\n" else ""}}
${if ( project.rootGradle.plugins.contains("kotlin")) " id 'org.jetbrains.kotlin.jvm' version '${project.languages.getVersion("kotlin")}'\n" else ""}}
// From https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/
// The article can be helpful when using assets.txt in your project.
tasks.register('generateAssetList') {
inputs.dir("${'$'}{project.rootDir}/assets/")
// projectFolder/assets
File assetsFolder = new File("${'$'}{project.rootDir}/assets/")
// projectFolder/assets/assets.txt
File assetsFile = new File(assetsFolder, "assets.txt")
// delete that file in case we've already created it
assetsFile.delete()
// From https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/
// The article can be helpful when using assets.txt in your project.
tasks.register('generateAssetList') {
inputs.dir("${'$'}{project.rootDir}/assets/")
// projectFolder/assets
File assetsFolder = new File("${'$'}{project.rootDir}/assets/")
// projectFolder/assets/assets.txt
File assetsFile = new File(assetsFolder, "assets.txt")
// delete that file in case we've already created it
assetsFile.delete()
// iterate through all files inside that folder
// convert it to a relative path
// and append it to the file assets.txt
fileTree(assetsFolder).collect { assetsFolder.relativePath(it) }.sort().each {
assetsFile.append(it + "\n")
}
// iterate through all files inside that folder
// convert it to a relative path
// and append it to the file assets.txt
fileTree(assetsFolder).collect { assetsFolder.relativePath(it) }.sort().each {
assetsFile.append(it + "\n")
}
processResources.dependsOn 'generateAssetList'
}
processResources.dependsOn 'generateAssetList'
compileJava {
options.incremental = true
}${if (project.rootGradle.plugins.contains("kotlin")) {
"""
compileKotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_${
if (project.advanced.javaVersion.removePrefix("1.") == "8") {
"1_8"
} else {
project.advanced.javaVersion.removePrefix("1.")
}})
"""
compileJava {
options.incremental = true
}${if (project.rootGradle.plugins.contains("kotlin")) {
"""
compileKotlin.compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_${
if (project.advanced.javaVersion.removePrefix("1.") == "8") {
"1_8"
} else {
project.advanced.javaVersion.removePrefix("1.")
}})
"""
} else {
""
}}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
eclipse.project.name = appName + '-core'
sourceCompatibility = ${project.advanced.javaVersion}
java.sourceCompatibility = ${project.advanced.javaVersion}
java.targetCompatibility = ${project.advanced.javaVersion}
dependencies {
${joinDependencies(dependencies, "api")}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/gdx/liftoff/data/platforms/Lwjgl3.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ buildscript {
plugins {
id "io.github.fourlastor.construo" version "1.4.1"
id "application"
${if (project.rootGradle.plugins.contains("kotlin")) " id 'org.jetbrains.kotlin.jvm' version '2.0.21'\n" else ""}}
${if (project.rootGradle.plugins.contains("kotlin")) " id 'org.jetbrains.kotlin.jvm' version '${project.languages.getVersion("kotlin")}'\n" else ""}}
import io.github.fourlastor.construo.Target
Expand Down

0 comments on commit fc4dc31

Please sign in to comment.