From f45238e944b53ed524e4ce0cb6a0718c09362649 Mon Sep 17 00:00:00 2001 From: Paul Merlin Date: Wed, 10 Jul 2019 10:27:44 +0200 Subject: [PATCH] Fix kotlin-dsl regression #9919 Signed-off-by: Paul Merlin --- .../GradleKotlinDslRegressionsTest.kt | 38 +++++++++++++++++++ .../gradle/kotlin/dsl/ProjectExtensions.kt | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 subprojects/kotlin-dsl-integ-tests/src/integTest/kotlin/org/gradle/kotlin/dsl/integration/GradleKotlinDslRegressionsTest.kt diff --git a/subprojects/kotlin-dsl-integ-tests/src/integTest/kotlin/org/gradle/kotlin/dsl/integration/GradleKotlinDslRegressionsTest.kt b/subprojects/kotlin-dsl-integ-tests/src/integTest/kotlin/org/gradle/kotlin/dsl/integration/GradleKotlinDslRegressionsTest.kt new file mode 100644 index 000000000000..d843e2d85a53 --- /dev/null +++ b/subprojects/kotlin-dsl-integ-tests/src/integTest/kotlin/org/gradle/kotlin/dsl/integration/GradleKotlinDslRegressionsTest.kt @@ -0,0 +1,38 @@ +/* + * Copyright 2019 the original author or authors. + * + * 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 org.gradle.kotlin.dsl.integration + +import org.junit.Test +import spock.lang.Issue + + +class GradleKotlinDslRegressionsTest : AbstractPluginIntegrationTest() { + + @Test + @Issue("https://github.com/gradle/gradle/issues/9919") + fun `gradleKotlinDsl dependency declaration does not throw`() { + + withBuildScript(""" + plugins { java } + dependencies { + compileOnly(gradleKotlinDsl()) + } + """) + + build("help") + } +} diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/ProjectExtensions.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/ProjectExtensions.kt index 930974ef1e7a..5c2c4d776c79 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/ProjectExtensions.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/ProjectExtensions.kt @@ -225,7 +225,7 @@ inline fun Project.container(noinline factory: (String) -> T): Named */ fun Project.gradleKotlinDsl(): Dependency = DefaultSelfResolvingDependency( - fileCollectionOf( + project.fileCollectionOf( gradleKotlinDslOf(project), "gradleKotlinDsl" ) as FileCollectionInternal