-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exposing provided by Gradle Kotlin dependencies.
Ensure that Gradle plugin dependencies do not include kotlin-stdlib, kotlin-reflect and other dependencies that are provided by Gradle runtime. ^KT-41142 Fixed
- Loading branch information
1 parent
f0f2b92
commit 0505d58
Showing
32 changed files
with
496 additions
and
282 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
buildSrc/src/main/kotlin/gradle-plugin-common-configuration.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. | ||
*/ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
publish() | ||
standardPublicJars() | ||
|
||
extensions.extraProperties["kotlin.stdlib.default.dependency"] = "false" | ||
|
||
dependencies { | ||
compileOnly(kotlinStdlib()) | ||
compileOnly(gradleApi()) | ||
} | ||
|
||
// These dependencies will be provided by Gradle and we should prevent version conflict | ||
fun Configuration.excludeGradleCommonDependencies() { | ||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib") | ||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7") | ||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8") | ||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common") | ||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect") | ||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-script-runtime") | ||
} | ||
configurations { | ||
"implementation" { | ||
excludeGradleCommonDependencies() | ||
} | ||
"api" { | ||
excludeGradleCommonDependencies() | ||
} | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions.languageVersion = "1.3" | ||
kotlinOptions.apiVersion = "1.3" | ||
kotlinOptions.freeCompilerArgs += listOf( | ||
"-Xskip-prerelease-check" | ||
) | ||
} | ||
|
||
tasks.named<Jar>("jar") { | ||
callGroovy("manifestAttributes", manifest, project) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,14 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import org.jetbrains.kotlin.pill.PillExtension | ||
|
||
plugins { | ||
kotlin("jvm") | ||
id("gradle-plugin-common-configuration") | ||
id("jps-compatible") | ||
} | ||
|
||
publish() | ||
|
||
standardPublicJars() | ||
|
||
dependencies { | ||
compile(kotlinStdlib()) | ||
|
||
compileOnly(gradleApi()) | ||
compileOnly("com.android.tools.build:gradle:3.4.0") | ||
} | ||
|
||
pill { | ||
variant = PillExtension.Variant.FULL | ||
} | ||
|
||
tasks { | ||
withType<KotlinCompile> { | ||
kotlinOptions.languageVersion = "1.3" | ||
kotlinOptions.apiVersion = "1.3" | ||
kotlinOptions.freeCompilerArgs += listOf("-Xskip-prerelease-check") | ||
} | ||
|
||
named<Jar>("jar") { | ||
callGroovy("manifestAttributes", manifest, project) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...test/resources/testProject/buildSrcUsingKotlinCompilationAndKotlinPlugin/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} |
12 changes: 12 additions & 0 deletions
12
...urces/testProject/buildSrcUsingKotlinCompilationAndKotlinPlugin/buildSrc/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${property("kotlin_version")}") | ||
} |
3 changes: 3 additions & 0 deletions
3
...ject/buildSrcUsingKotlinCompilationAndKotlinPlugin/buildSrc/src/main/kotlin/ProjectExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import org.gradle.api.Project | ||
|
||
fun Project.nameLength() = name.length |
8 changes: 8 additions & 0 deletions
8
...sources/testProject/buildSrcUsingKotlinCompilationAndKotlinPlugin/src/main/kotlin/main.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. | ||
*/ | ||
|
||
fun main() { | ||
println("Hello World!") | ||
} |
23 changes: 1 addition & 22 deletions
23
libraries/tools/kotlin-gradle-plugin-model/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,10 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import org.jetbrains.kotlin.pill.PillExtension | ||
|
||
plugins { | ||
kotlin("jvm") | ||
id("gradle-plugin-common-configuration") | ||
id("jps-compatible") | ||
} | ||
|
||
publish() | ||
|
||
standardPublicJars() | ||
|
||
dependencies { | ||
compile(kotlinStdlib()) | ||
} | ||
|
||
pill { | ||
variant = PillExtension.Variant.FULL | ||
} | ||
|
||
tasks { | ||
withType<KotlinCompile> { | ||
kotlinOptions.languageVersion = "1.3" | ||
kotlinOptions.apiVersion = "1.3" | ||
kotlinOptions.freeCompilerArgs += listOf("-Xskip-prerelease-check") | ||
} | ||
|
||
named<Jar>("jar") { | ||
callGroovy("manifestAttributes", manifest, project) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.