From 7df7ea92f454832c78b9dabf4ba042bc527eabac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Fri, 13 Feb 2026 18:20:17 +0100 Subject: [PATCH] fix(compat-gradle): Fix incorrect file in gradle.properties() --- .../compat-gradle/src/jvmMain/kotlin/Paths.kt | 2 +- .../src/jvmTest/kotlin/SimpleTest.kt | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 compat/compat-gradle/src/jvmTest/kotlin/SimpleTest.kt diff --git a/compat/compat-gradle/src/jvmMain/kotlin/Paths.kt b/compat/compat-gradle/src/jvmMain/kotlin/Paths.kt index f03d901..a673664 100644 --- a/compat/compat-gradle/src/jvmMain/kotlin/Paths.kt +++ b/compat/compat-gradle/src/jvmMain/kotlin/Paths.kt @@ -122,7 +122,7 @@ suspend fun Gradle.settingsKts(text: String) = with(dsl) { * ``` */ suspend fun Gradle.properties(@Language("properties") text: String) = with(dsl) { - settingsKts().writeText(text) + properties().writeText(text) } // endregion diff --git a/compat/compat-gradle/src/jvmTest/kotlin/SimpleTest.kt b/compat/compat-gradle/src/jvmTest/kotlin/SimpleTest.kt new file mode 100644 index 0000000..3a704b4 --- /dev/null +++ b/compat/compat-gradle/src/jvmTest/kotlin/SimpleTest.kt @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2026, OpenSavvy and contributors. + * + * 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 + * + * http://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. + */ + +package opensavvy.prepared.compat.gradle + +import opensavvy.prepared.runner.testballoon.preparedSuite + +val SimpleTest by preparedSuite { + + test("Basic Gradle task test") { + gradle.settingsKts(""" + rootProject.name = "foo" + """.trimIndent()) + + gradle.properties(""" + myProperty='Hi, world' + """.trimIndent()) + + gradle.rootProject.buildKts(""" + val myProperty = providers.gradleProperty("myProperty") + + val print by tasks.registering { + doLast { + println(myProperty.get()) + } + } + """.trimIndent()) + + val result = gradle.runner() + .withArguments(":print") + .withGradleVersion("9.2.0") + .build() + + check("Hi, world" in result.output) + } +} -- 2.51.2