From 00ef54695473a9cf4a93ba861520909e0402e2fa Mon Sep 17 00:00:00 2001 From: soywiz Date: Sun, 26 Nov 2023 13:12:16 +0100 Subject: [PATCH] Update template --- build.gradle.kts | 4 +--- gradle/libs.versions.toml | 3 +++ gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle.kts | 26 ++++++++++++++++-------- 4 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index 628c610..fd0a887 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,7 @@ import korlibs.korge.gradle.* plugins { - //alias(libs.plugins.korge) - //id("com.soywiz.korge") version "999.0.0.999" - id("com.soywiz.korge") version "4.0.9" + alias(libs.plugins.korge) } korge { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..d96ce68 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,3 @@ +[plugins] +korge = { id = "com.soywiz.korge", version = "5.1.0" } +#korge = { id = "com.soywiz.korge", version = "999.0.0.999" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5083229..c30b486 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 4f1fa17..19ae73f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,13 +1,23 @@ -pluginManagement { repositories { mavenLocal(); mavenCentral(); google(); gradlePluginPortal() } } - -plugins { - //id("com.soywiz.kproject.settings") version "0.0.1-SNAPSHOT" - id("com.soywiz.kproject.settings") version "0.3.1" +pluginManagement { + repositories { mavenLocal(); mavenCentral(); google(); gradlePluginPortal() } } +buildscript { + val libsTomlFile = File(this.sourceFile?.parentFile, "gradle/libs.versions.toml").readText() + var plugins = false + var version = "" + for (line in libsTomlFile.lines().map { it.trim() }) { + if (line.startsWith("#")) continue + if (line.startsWith("[plugins]")) plugins = true + if (plugins && line.startsWith("korge") && Regex("^korge\\s*=.*").containsMatchIn(line)) version = Regex("version\\s*=\\s*\"(.*?)\"").find(line)?.groupValues?.get(1) ?: error("Can't find korge version") + } + if (version.isEmpty()) error("Can't find korge version in $libsTomlFile") -rootProject.name = "${rootDir.parentFile.name}-example" + repositories { mavenLocal(); mavenCentral(); google(); gradlePluginPortal() } -//println("rootProject.name=${rootProject.name}") + dependencies { + classpath("com.soywiz.korge.settings:com.soywiz.korge.settings.gradle.plugin:$version") + } +} -kproject("./deps") +apply(plugin = "com.soywiz.korge.settings")