MPP plugin: add expectedBy deps to "api" configuration

Currently, KotlinPlatformJvmPlugin and KotlinPlatformJsPlugin are
adding expectedBy deps to "compile" configuration which is deprecated
by Gradle. This PR fixes that by replacing "compile" with "api" which
is what we are doing in KotlinPlatformAndroidPlugin.

This PR also makes integration tests running with warning-mode=fail by
default and fixes most of the integration tests. For the remaining tests
to be fixed, we make them run with warning-mode=summary and will fix
them incrementally in following PRs.
This commit is contained in:
Bingran
2020-10-28 17:27:03 +00:00
committed by Sergey Igushkin
parent 4bf63a9539
commit 52c22d891f
47 changed files with 141 additions and 89 deletions
@@ -153,6 +153,20 @@ abstract class BaseGradleIT {
return wrapper return wrapper
} }
fun mightUpdateSettingsScript(wrapperVersion: String, settingsScript: File) {
// enableFeaturePreview("GRADLE_METADATA") is no longer needed when building with Gradle 5.4 or above
if (GradleVersion.version(wrapperVersion) > GradleVersion.version("5.3")) {
settingsScript.apply {
if(exists()) {
modify {
it.replace("enableFeaturePreview('GRADLE_METADATA')", "//")
it.replace("enableFeaturePreview(\"GRADLE_METADATA\")", "//")
}
}
}
}
}
private fun createNewWrapperDir(version: String): File = private fun createNewWrapperDir(version: String): File =
createTempDir("GradleWrapper-$version-") createTempDir("GradleWrapper-$version-")
.apply { .apply {
@@ -215,7 +229,7 @@ abstract class BaseGradleIT {
val jsCompilerType: KotlinJsCompilerType? = null, val jsCompilerType: KotlinJsCompilerType? = null,
val configurationCache: Boolean = false, val configurationCache: Boolean = false,
val configurationCacheProblems: ConfigurationCacheProblems = ConfigurationCacheProblems.FAIL, val configurationCacheProblems: ConfigurationCacheProblems = ConfigurationCacheProblems.FAIL,
val warningMode: WarningMode = WarningMode.Summary val warningMode: WarningMode = WarningMode.Fail
) )
enum class ConfigurationCacheProblems { enum class ConfigurationCacheProblems {
@@ -321,6 +335,9 @@ abstract class BaseGradleIT {
val env = createEnvironmentVariablesMap(options) val env = createEnvironmentVariablesMap(options)
val wrapperDir = prepareWrapper(wrapperVersion, env) val wrapperDir = prepareWrapper(wrapperVersion, env)
mightUpdateSettingsScript(wrapperVersion, gradleSettingsScript())
val cmd = createBuildCommand(wrapperDir, params, options) val cmd = createBuildCommand(wrapperDir, params, options)
println("<=== Test build: ${this.projectName} $cmd ===>") println("<=== Test build: ${this.projectName} $cmd ===>")
@@ -37,7 +37,6 @@ class BuildCacheRelocationIT : BaseGradleIT() {
override fun defaultBuildOptions(): BuildOptions = override fun defaultBuildOptions(): BuildOptions =
super.defaultBuildOptions().copy( super.defaultBuildOptions().copy(
withBuildCache = true, withBuildCache = true,
androidGradlePluginVersion = AGPVersion.v3_6_0,
androidHome = KotlinTestUtils.findAndroidSdk() androidHome = KotlinTestUtils.findAndroidSdk()
) )
@@ -65,7 +64,10 @@ class BuildCacheRelocationIT : BaseGradleIT() {
lateinit var firstOutputHashes: List<Pair<File, Int>> lateinit var firstOutputHashes: List<Pair<File, Int>>
workingDir = workingDirs[0] workingDir = workingDirs[0]
firstProject.build(*testCase.taskToExecute) { firstProject.build(
*testCase.taskToExecute,
options = defaultBuildOptions().copy(androidGradlePluginVersion = testCase.androidGradlePluginVersion)
) {
assertSuccessful() assertSuccessful()
firstOutputHashes = hashOutputFiles(outputRoots) firstOutputHashes = hashOutputFiles(outputRoots)
cacheableTaskNames.forEach { assertTaskPackedToCache(":$it") } cacheableTaskNames.forEach { assertTaskPackedToCache(":$it") }
@@ -74,9 +76,10 @@ class BuildCacheRelocationIT : BaseGradleIT() {
workingDir = workingDirs[1] workingDir = workingDirs[1]
val alternateBuildEnvOptions = if (withAnotherGradleHome) { val alternateBuildEnvOptions = if (withAnotherGradleHome) {
val alternateGradleHome = File(firstProject.projectDir.parentFile, "gradleUserHome") val alternateGradleHome = File(firstProject.projectDir.parentFile, "gradleUserHome")
defaultBuildOptions().copy(gradleUserHome = alternateGradleHome) defaultBuildOptions().copy(
gradleUserHome = alternateGradleHome, androidGradlePluginVersion = testCase.androidGradlePluginVersion)
} else { } else {
defaultBuildOptions() defaultBuildOptions().copy(androidGradlePluginVersion = testCase.androidGradlePluginVersion)
} }
secondProject.build(*testCase.taskToExecute, options = alternateBuildEnvOptions) { secondProject.build(*testCase.taskToExecute, options = alternateBuildEnvOptions) {
assertSuccessful() assertSuccessful()
@@ -98,7 +101,8 @@ class BuildCacheRelocationIT : BaseGradleIT() {
val initProject: Project.() -> Unit = {}, val initProject: Project.() -> Unit = {},
val taskToExecute: Array<String>, val taskToExecute: Array<String>,
val withAnotherGradleHome: Boolean = false, val withAnotherGradleHome: Boolean = false,
val gradleVersionRequired: GradleVersionRequired = DEFAULT_GRADLE_VERSION val gradleVersionRequired: GradleVersionRequired = DEFAULT_GRADLE_VERSION,
val androidGradlePluginVersion: AGPVersion? = null
) { ) {
override fun toString(): String = (projectDirectoryPrefix?.plus("/") ?: "") + projectName override fun toString(): String = (projectDirectoryPrefix?.plus("/") ?: "") + projectName
@@ -157,7 +161,8 @@ class BuildCacheRelocationIT : BaseGradleIT() {
} }
} }
}, },
outputRootPaths = listOf("Lib", "Android", "Test").map { "$it/build" } outputRootPaths = listOf("Lib", "Android", "Test").map { "$it/build" },
androidGradlePluginVersion = AGPVersion.v3_6_0
), ),
TestCase("android-dagger", TestCase("android-dagger",
taskToExecute = arrayOf("assembleDebug"), taskToExecute = arrayOf("assembleDebug"),
@@ -168,7 +173,8 @@ class BuildCacheRelocationIT : BaseGradleIT() {
} }
}, },
outputRootPaths = listOf("app/build"), outputRootPaths = listOf("app/build"),
initProject = { File(projectDir, "app/build.gradle").appendText("\nkapt.useBuildCache = true") } initProject = { File(projectDir, "app/build.gradle").appendText("\nkapt.useBuildCache = true") },
androidGradlePluginVersion = AGPVersion.v3_6_0
), ),
TestCase("native-build-cache", TestCase("native-build-cache",
taskToExecute = arrayOf("build-cache-lib:publish", "build-cache-app:assemble"), taskToExecute = arrayOf("build-cache-lib:publish", "build-cache-app:assemble"),
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.gradle package org.jetbrains.kotlin.gradle
import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.util.AGPVersion import org.jetbrains.kotlin.gradle.util.AGPVersion
import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestUtils
import org.junit.Test import org.junit.Test
@@ -18,7 +19,8 @@ class ConfigurationCacheForAndroidIT : AbstractConfigurationCacheIT() {
androidHome = KotlinTestUtils.findAndroidSdk(), androidHome = KotlinTestUtils.findAndroidSdk(),
androidGradlePluginVersion = androidGradlePluginVersion, androidGradlePluginVersion = androidGradlePluginVersion,
configurationCache = true, configurationCache = true,
configurationCacheProblems = ConfigurationCacheProblems.FAIL configurationCacheProblems = ConfigurationCacheProblems.FAIL,
warningMode = WarningMode.Summary
) )
@Test @Test
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.gradle
import com.google.gson.Gson import com.google.gson.Gson
import org.gradle.api.logging.LogLevel import org.gradle.api.logging.LogLevel
import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
import org.jetbrains.kotlin.gradle.targets.js.ir.KLIB_TYPE import org.jetbrains.kotlin.gradle.targets.js.ir.KLIB_TYPE
import org.jetbrains.kotlin.gradle.targets.js.npm.* import org.jetbrains.kotlin.gradle.targets.js.npm.*
@@ -22,6 +23,11 @@ import kotlin.test.assertEquals
import kotlin.test.assertTrue import kotlin.test.assertTrue
class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) { class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) {
override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}
@Test @Test
fun generateDts() { fun generateDts() {
val project = Project("kotlin2JsIrDtsGeneration") val project = Project("kotlin2JsIrDtsGeneration")
@@ -116,6 +122,11 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) {
} }
class Kotlin2JsGradlePluginIT : AbstractKotlin2JsGradlePluginIT(false) { class Kotlin2JsGradlePluginIT : AbstractKotlin2JsGradlePluginIT(false) {
override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}
@Test @Test
fun testKotlinJsBuiltins() { fun testKotlinJsBuiltins() {
val project = Project("kotlinBuiltins") val project = Project("kotlinBuiltins")
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.gradle package org.jetbrains.kotlin.gradle
import org.gradle.api.logging.LogLevel import org.gradle.api.logging.LogLevel
import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.plugin.MULTIPLE_KOTLIN_PLUGINS_LOADED_WARNING import org.jetbrains.kotlin.gradle.plugin.MULTIPLE_KOTLIN_PLUGINS_LOADED_WARNING
import org.jetbrains.kotlin.gradle.plugin.MULTIPLE_KOTLIN_PLUGINS_SPECIFIC_PROJECTS_WARNING import org.jetbrains.kotlin.gradle.plugin.MULTIPLE_KOTLIN_PLUGINS_SPECIFIC_PROJECTS_WARNING
import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
@@ -35,6 +36,10 @@ import kotlin.test.assertTrue
class KotlinGradleIT : BaseGradleIT() { class KotlinGradleIT : BaseGradleIT() {
override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}
@Test @Test
fun testCrossCompile() { fun testCrossCompile() {
val project = Project("kotlinJavaProject") val project = Project("kotlinJavaProject")
@@ -774,12 +779,12 @@ class KotlinGradleIT : BaseGradleIT() {
with(Project("simpleProject")) { with(Project("simpleProject")) {
setupWorkingDir() setupWorkingDir()
// Add a dependency with an explicit lower Kotlin version that has a kotlin-stdlib transitive dependency: // Add a dependency with an explicit lower Kotlin version that has a kotlin-stdlib transitive dependency:
gradleBuildScript().appendText("\ndependencies { compile 'org.jetbrains.kotlin:kotlin-reflect:1.2.71' }") gradleBuildScript().appendText("\ndependencies { implementation 'org.jetbrains.kotlin:kotlin-reflect:1.2.71' }")
testResolveAllConfigurations { testResolveAllConfigurations {
assertSuccessful() assertSuccessful()
assertContains(">> :compile --> kotlin-reflect-1.2.71.jar") assertContains(">> :compileClasspath --> kotlin-reflect-1.2.71.jar")
// Check that the default newer Kotlin version still wins for 'kotlin-stdlib': // Check that the default newer Kotlin version still wins for 'kotlin-stdlib':
assertContains(">> :compile --> kotlin-stdlib-${defaultBuildOptions().kotlinVersion}.jar") assertContains(">> :compileClasspath --> kotlin-stdlib-${defaultBuildOptions().kotlinVersion}.jar")
} }
} }
@@ -226,7 +226,7 @@ class MultiplatformGradleIT : BaseGradleIT() {
${'\n'} ${'\n'}
task printCompileConfiguration(type: DefaultTask) { task printCompileConfiguration(type: DefaultTask) {
doFirst { doFirst {
configurations.compile.resolvedConfiguration.resolvedArtifacts.each { configurations.getByName("api").dependencies.each {
println("Dependency: '" + it.name + "'") println("Dependency: '" + it.name + "'")
} }
} }
@@ -6,6 +6,7 @@ package org.jetbrains.kotlin.gradle
import org.jetbrains.kotlin.gradle.native.GeneralNativeIT.Companion.checkNativeCommandLineArguments import org.jetbrains.kotlin.gradle.native.GeneralNativeIT.Companion.checkNativeCommandLineArguments
import org.jetbrains.kotlin.gradle.native.GeneralNativeIT.Companion.containsSequentially import org.jetbrains.kotlin.gradle.native.GeneralNativeIT.Companion.containsSequentially
import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.native.MPPNativeTargets import org.jetbrains.kotlin.gradle.native.MPPNativeTargets
import org.jetbrains.kotlin.gradle.native.configureMemoryInGradleProperties import org.jetbrains.kotlin.gradle.native.configureMemoryInGradleProperties
import org.jetbrains.kotlin.gradle.native.transformNativeTestProject import org.jetbrains.kotlin.gradle.native.transformNativeTestProject
@@ -43,6 +44,10 @@ class NewMultiplatformIT : BaseGradleIT() {
private fun Project.targetClassesDir(targetName: String, sourceSetName: String = "main") = private fun Project.targetClassesDir(targetName: String, sourceSetName: String = "main") =
classesDir(sourceSet = "$targetName/$sourceSetName") classesDir(sourceSet = "$targetName/$sourceSetName")
override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}
@Test @Test
fun testLibAndApp() = doTestLibAndApp( fun testLibAndApp() = doTestLibAndApp(
"sample-lib", "sample-lib",
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.gradle package org.jetbrains.kotlin.gradle
import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
import org.jetbrains.kotlin.gradle.util.* import org.jetbrains.kotlin.gradle.util.*
import org.junit.Test import org.junit.Test
@@ -13,6 +14,10 @@ import kotlin.test.assertTrue
class VariantAwareDependenciesIT : BaseGradleIT() { class VariantAwareDependenciesIT : BaseGradleIT() {
private val gradleVersion = GradleVersionRequired.FOR_MPP_SUPPORT private val gradleVersion = GradleVersionRequired.FOR_MPP_SUPPORT
override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}
@Test @Test
fun testJvmKtAppResolvesMppLib() { fun testJvmKtAppResolvesMppLib() {
val outerProject = Project("sample-lib", gradleVersion, "new-mpp-lib-and-app") val outerProject = Project("sample-lib", gradleVersion, "new-mpp-lib-and-app")
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.gradle.native package org.jetbrains.kotlin.gradle.native
import com.intellij.testFramework.TestDataFile import com.intellij.testFramework.TestDataFile
import org.gradle.api.logging.configuration.WarningMode
import org.jdom.input.SAXBuilder import org.jdom.input.SAXBuilder
import org.jetbrains.kotlin.gradle.BaseGradleIT import org.jetbrains.kotlin.gradle.BaseGradleIT
import org.jetbrains.kotlin.gradle.GradleVersionRequired import org.jetbrains.kotlin.gradle.GradleVersionRequired
@@ -93,6 +94,10 @@ class GeneralNativeIT : BaseGradleIT() {
override val defaultGradleVersion: GradleVersionRequired override val defaultGradleVersion: GradleVersionRequired
get() = GradleVersionRequired.FOR_MPP_SUPPORT get() = GradleVersionRequired.FOR_MPP_SUPPORT
override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}
@Test @Test
fun testParallelExecutionSmoke(): Unit = with(transformNativeTestProjectWithPluginDsl("native-parallel")) { fun testParallelExecutionSmoke(): Unit = with(transformNativeTestProjectWithPluginDsl("native-parallel")) {
// Check that the K/N compiler can be started in-process in parallel. // Check that the K/N compiler can be started in-process in parallel.
@@ -16,9 +16,9 @@ repositories {
} }
dependencies { dependencies {
compile 'com.google.guava:guava:12.0' implementation 'com.google.guava:guava:12.0'
testCompile 'org.testng:testng:6.8' testImplementation 'org.testng:testng:6.8'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
test { test {
@@ -17,5 +17,5 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -16,9 +16,9 @@ repositories {
} }
dependencies { dependencies {
compile 'com.google.guava:guava:12.0' implementation 'com.google.guava:guava:12.0'
testCompile 'org.testng:testng:6.8' testImplementation 'org.testng:testng:6.8'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
test { test {
@@ -17,7 +17,7 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
compileJava { compileJava {
@@ -16,8 +16,8 @@ repositories {
} }
dependencies { dependencies {
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
compileKotlin.compilerJarFile = project.file("compiler.jar") compileKotlin.compilerJarFile = project.file("compiler.jar")
@@ -1,5 +1,5 @@
apply plugin: 'kotlin' apply plugin: 'kotlin'
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -1,6 +1,6 @@
apply plugin: 'kotlin' apply plugin: 'kotlin'
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile project(':lib-project') implementation project(':lib-project')
} }
@@ -16,8 +16,8 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" testImplementation "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
} }
task jarSources(type: Jar) { task jarSources(type: Jar) {
@@ -25,7 +25,7 @@ task jarSources(type: Jar) {
classifier = 'source' classifier = 'source'
} }
artifacts { artifacts {
compile jarSources implementation jarSources
} }
compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/module.js" compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/module.js"
@@ -17,8 +17,8 @@ repositories {
} }
dependencies { dependencies {
testCompile 'org.testng:testng:6.8' testImplementation 'org.testng:testng:6.8'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
test { test {
@@ -2,6 +2,6 @@ apply plugin: 'java'
apply plugin: 'kotlin' apply plugin: 'kotlin'
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile project(':libB') implementation project(':libB')
} }
@@ -17,7 +17,7 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
compileKotlin.javaPackagePrefix = "my.pack.name" compileKotlin.javaPackagePrefix = "my.pack.name"
@@ -24,7 +24,7 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
compileKotlin { compileKotlin {
@@ -2,10 +2,10 @@ apply plugin: "kotlin"
apply plugin: "kotlin-kapt" apply plugin: "kotlin-kapt"
dependencies { dependencies {
compile project(":lib") implementation project(":lib")
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" implementation "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
// actually unused, but kapt skips AP when annotation processing classpath is empty (see checkOptions) // actually unused, but kapt skips AP when annotation processing classpath is empty (see checkOptions)
@@ -1,5 +1,5 @@
apply plugin: "kotlin" apply plugin: "kotlin"
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -18,10 +18,10 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" implementation "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version" kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
} }
compileKotlin.kotlinOptions.allWarningsAsErrors = true compileKotlin.kotlinOptions.allWarningsAsErrors = true
@@ -16,7 +16,7 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
} }
compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/examplelib.js" compileKotlin2Js.kotlinOptions.outputFile = "${buildDir}/examplelib.js"
@@ -17,9 +17,9 @@ repositories {
} }
dependencies { dependencies {
compile project(":libraryProject") implementation project(":libraryProject")
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
compile "org.mozilla:rhino:1.7.7.1" implementation "org.mozilla:rhino:1.7.7.1"
} }
compileKotlin2Js.kotlinOptions.sourceMap = true compileKotlin2Js.kotlinOptions.sourceMap = true
@@ -16,7 +16,7 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
} }
if (project.findProperty("kotlin.js.useIrBackend")?.toBoolean() == true) { if (project.findProperty("kotlin.js.useIrBackend")?.toBoolean() == true) {
@@ -6,5 +6,5 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -21,9 +21,9 @@ sourceSets {
} }
dependencies { dependencies {
compile 'com.google.guava:guava:12.0' implementation 'com.google.guava:guava:12.0'
testCompile 'org.testng:testng:6.8' testImplementation 'org.testng:testng:6.8'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
test { test {
@@ -21,11 +21,11 @@ repositories {
} }
dependencies { dependencies {
compile 'com.google.guava:guava:12.0' implementation 'com.google.guava:guava:12.0'
deployCompile 'com.google.guava:guava:12.0' deployImplementation 'com.google.guava:guava:12.0'
testCompile 'org.testng:testng:6.8' testImplementation 'org.testng:testng:6.8'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
deployCompile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" deployImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
test { test {
@@ -16,9 +16,9 @@ repositories {
} }
dependencies { dependencies {
compile 'com.google.guava:guava:12.0' implementation 'com.google.guava:guava:12.0'
testCompile 'org.testng:testng:6.8' testImplementation 'org.testng:testng:6.8'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
test { test {
@@ -6,5 +6,5 @@ repositories {
apply plugin: 'java' apply plugin: 'java'
dependencies { dependencies {
runtime "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" runtimeOnly "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
@@ -6,5 +6,5 @@ group = "com.example.jvm"
version = "1.0" version = "1.0"
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -16,5 +16,5 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -1,6 +1,6 @@
apply plugin: 'kotlin' apply plugin: 'kotlin'
dependencies { dependencies {
compile project(':lib') implementation project(':lib')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -1,5 +1,5 @@
apply plugin: 'kotlin' apply plugin: 'kotlin'
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -2,6 +2,6 @@ apply plugin: 'kotlin-platform-jvm'
dependencies { dependencies {
expectedBy project(":lib") expectedBy project(":lib")
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.google.guava:guava:20.0' implementation 'com.google.guava:guava:20.0'
} }
@@ -1,9 +1,9 @@
apply plugin: "kotlin" apply plugin: "kotlin"
dependencies { dependencies {
compile 'com.google.guava:guava:12.0' implementation 'com.google.guava:guava:12.0'
testCompile 'org.testng:testng:6.8' testImplementation 'org.testng:testng:6.8'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
test { test {
@@ -1,5 +1,5 @@
apply plugin: "kotlin" apply plugin: "kotlin"
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -1,6 +1,6 @@
apply plugin: "kotlin" apply plugin: "kotlin"
dependencies { dependencies {
compile project(':projA') implementation project(':projA')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -1,5 +1,5 @@
apply plugin: 'kotlin-platform-common' apply plugin: 'kotlin-platform-common'
dependencies { dependencies {
compile 'com.example:sample-lib:1.0' implementation 'com.example:sample-lib:1.0'
} }
@@ -1,5 +1,5 @@
apply plugin: 'kotlin2js' apply plugin: 'kotlin2js'
dependencies { dependencies {
compile 'com.example:sample-lib:1.0' implementation 'com.example:sample-lib:1.0'
} }
@@ -2,7 +2,7 @@ apply plugin: 'kotlin'
apply plugin: 'application' apply plugin: 'application'
dependencies { dependencies {
compile 'com.example:sample-lib:1.0' implementation 'com.example:sample-lib:1.0'
} }
mainClassName = 'com.example.app.JvmAppKt' mainClassName = 'com.example.app.JvmAppKt'
@@ -13,6 +13,6 @@ allOpen {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile "junit:junit:4.12" testImplementation "junit:junit:4.12"
} }
@@ -21,11 +21,11 @@ repositories {
} }
dependencies { dependencies {
compile 'com.google.guava:guava:12.0' implementation 'com.google.guava:guava:12.0'
deployCompile 'com.google.guava:guava:12.0' deployImplementation 'com.google.guava:guava:12.0'
testCompile 'org.testng:testng:6.8' testImplementation 'org.testng:testng:6.8'
compile "org.jetbrains.kotlin:kotlin-stdlib" implementation "org.jetbrains.kotlin:kotlin-stdlib"
deployCompile "org.jetbrains.kotlin:kotlin-stdlib" deployImplementation "org.jetbrains.kotlin:kotlin-stdlib"
} }
test { test {
@@ -16,5 +16,5 @@ repositories {
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
@@ -56,7 +56,7 @@ open class KotlinPlatformImplementationPluginBase(platformName: String) : Kotlin
private val commonProjects = arrayListOf<Project>() private val commonProjects = arrayListOf<Project>()
protected open fun configurationsForCommonModuleDependency(project: Project): List<Configuration> = protected open fun configurationsForCommonModuleDependency(project: Project): List<Configuration> =
listOf(project.configurations.getByName("compile")) listOf(project.configurations.getByName("api"))
override fun apply(project: Project) { override fun apply(project: Project) {
warnAboutKotlin12xMppDeprecation(project) warnAboutKotlin12xMppDeprecation(project)
@@ -239,10 +239,6 @@ open class KotlinPlatformAndroidPlugin : KotlinPlatformImplementationPluginBase(
super.apply(project) super.apply(project)
} }
override fun configurationsForCommonModuleDependency(project: Project): List<Configuration> =
(project.configurations.findByName("api"))?.let(::listOf)
?: super.configurationsForCommonModuleDependency(project) // older Android plugins don't have api/implementation configs
override fun namedSourceSetsContainer(project: Project): NamedDomainObjectContainer<*> = override fun namedSourceSetsContainer(project: Project): NamedDomainObjectContainer<*> =
(project.extensions.getByName("android") as BaseExtension).sourceSets (project.extensions.getByName("android") as BaseExtension).sourceSets