Skip to content

Commit

Permalink
Fix more deprecated configurations and disable fail mode for some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bingranl authored and h0tk3y committed Nov 25, 2020
1 parent 858f731 commit b0ebb02
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.jetbrains.kotlin.gradle

import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.targets.js.dukat.ExternalsOutputFormat
import org.jetbrains.kotlin.gradle.util.modify
import org.junit.Test
Expand Down Expand Up @@ -330,7 +331,7 @@ class DukatIntegrationIT : BaseGradleIT() {
project.setupWorkingDir()
project.gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)

project.build("assemble") {
project.build("assemble", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()
}
}
Expand Down Expand Up @@ -381,7 +382,7 @@ class DukatIntegrationIT : BaseGradleIT() {
}

val externalSrcs = "build/externals/both-jsIr/src"
project.build("assemble") {
project.build("assemble", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()

assertTasksExecuted(":irGenerateExternalsIntegrated")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationMultiP
apply plugin: 'kotlin'
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:${"$"}kotlin_version"
compile 'org.codehaus.groovy:groovy-all:2.4.8'
implementation "org.jetbrains.kotlin:kotlin-stdlib:${"$"}kotlin_version"
implementation 'org.codehaus.groovy:groovy-all:2.4.8'
}
""".trimIndent()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.jetbrains.kotlin.gradle

import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.tasks.USING_JVM_INCREMENTAL_COMPILATION_MESSAGE
import org.jetbrains.kotlin.gradle.util.*
import org.junit.Assert
Expand All @@ -30,7 +31,7 @@ abstract class Kapt3BaseIT : BaseGradleIT() {
}

override fun defaultBuildOptions(): BuildOptions =
super.defaultBuildOptions().copy(kaptOptions = kaptOptions())
super.defaultBuildOptions().copy(kaptOptions = kaptOptions(), warningMode = WarningMode.Summary)

protected open fun kaptOptions(): KaptOptions =
KaptOptions(verbose = true, useWorkers = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ class KotlinGradleIT : BaseGradleIT() {
setupWorkingDir()
// Add a dependency with an explicit lower Kotlin version that has a kotlin-stdlib transitive dependency:
gradleBuildScript().appendText("\ndependencies { implementation 'org.jetbrains.kotlin:kotlin-reflect:1.2.71' }")
testResolveAllConfigurations {
testResolveAllConfigurations(options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()
assertContains(">> :compileClasspath --> kotlin-reflect-1.2.71.jar")
// Check that the default newer Kotlin version still wins for 'kotlin-stdlib':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.jetbrains.kotlin.gradle

import com.intellij.testFramework.TestDataPath
import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.internals.KOTLIN_12X_MPP_DEPRECATION_WARNING
import org.jetbrains.kotlin.gradle.plugin.EXPECTED_BY_CONFIG_NAME
import org.jetbrains.kotlin.gradle.plugin.IMPLEMENT_CONFIG_NAME
Expand Down Expand Up @@ -175,7 +176,7 @@ class MultiplatformGradleIT : BaseGradleIT() {

@Test
fun testMultipleCommonModules(): Unit = with(Project("multiplatformMultipleCommonModules")) {
build("build") {
build("build", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()

val sourceSets = listOf("", "Test")
Expand Down Expand Up @@ -305,7 +306,7 @@ class MultiplatformGradleIT : BaseGradleIT() {
val customSourceSetCompileTasks = listOf(":lib" to "Common", ":libJs" to "2Js", ":libJvm" to "")
.map { (module, platform) -> "$module:compile${sourceSetName.capitalize()}Kotlin$platform" }

build(*customSourceSetCompileTasks.toTypedArray()) {
build(*customSourceSetCompileTasks.toTypedArray(), options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()
assertTasksExecuted(customSourceSetCompileTasks)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ class NewMultiplatformIT : BaseGradleIT() {
private fun Project.targetClassesDir(targetName: String, sourceSetName: String = "main") =
classesDir(sourceSet = "$targetName/$sourceSetName")

override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}

@Test
fun testLibAndApp() = doTestLibAndApp(
"sample-lib",
Expand Down Expand Up @@ -1280,7 +1276,7 @@ class NewMultiplatformIT : BaseGradleIT() {

@Test
fun testJsDceInMpp() = with(Project("new-mpp-js-dce", gradleVersion)) {
build("runRhino") {
build("runRhino", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()
assertTasksExecuted(":mainProject:runDceNodeJsKotlin")

Expand Down Expand Up @@ -1365,7 +1361,7 @@ class NewMultiplatformIT : BaseGradleIT() {
fun testDependenciesDsl() = with(transformProjectWithPluginsDsl("newMppDependenciesDsl")) {
val originalBuildscriptContent = gradleBuildScript("app").readText()

fun testDependencies() = testResolveAllConfigurations("app") {
fun testDependencies() = testResolveAllConfigurations("app", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertContains(">> :app:testNonTransitiveStringNotationApiDependenciesMetadata --> junit-4.12.jar")
assertEquals(
1,
Expand Down Expand Up @@ -1399,7 +1395,7 @@ class NewMultiplatformIT : BaseGradleIT() {

@Test
fun testMultipleTargetsSamePlatform() = with(Project("newMppMultipleTargetsSamePlatform", gradleVersion)) {
testResolveAllConfigurations("app") {
testResolveAllConfigurations("app", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertContains(">> :app:junitCompileClasspath --> lib-junit.jar")
assertContains(">> :app:junitCompileClasspath --> junit-4.12.jar")

Expand Down Expand Up @@ -1489,7 +1485,7 @@ class NewMultiplatformIT : BaseGradleIT() {

val groupDir = "build/repo/com/example/"

build(":mpp-lib:publish") {
build(":mpp-lib:publish", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()
assertFileExists(groupDir + "mpp-lib")
assertFileExists(groupDir + "mpp-lib-myjvm")
Expand All @@ -1506,7 +1502,7 @@ class NewMultiplatformIT : BaseGradleIT() {
add("-Pkotlin.mpp.keepMppDependenciesIntactInPoms=true")
}.toTypedArray()

build(*params) {
build(*params, options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()
if (legacyPublishing) {
assertTasksExecuted(":jvm-app:uploadArchives")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package org.jetbrains.kotlin.gradle

import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.util.modify
import org.junit.Test
import java.io.File
import kotlin.test.assertTrue

class SimpleKotlinGradleIT : BaseGradleIT() {

override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}

@Test
fun testSimpleCompile() {
val project = Project("simpleProject")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

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.checkBytecodeContains
import org.jetbrains.kotlin.gradle.util.modify
Expand All @@ -14,6 +15,11 @@ import java.io.File
import kotlin.test.assertTrue

class SubpluginsIT : BaseGradleIT() {

override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}

@Test
fun testGradleSubplugin() {
val project = Project("kotlinGradleSubplugin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package org.jetbrains.kotlin.gradle.native

import com.intellij.testFramework.TestDataFile
import org.gradle.api.logging.configuration.WarningMode
import org.jdom.input.SAXBuilder
import org.jetbrains.kotlin.gradle.BaseGradleIT
import org.jetbrains.kotlin.gradle.GradleVersionRequired
Expand Down Expand Up @@ -94,10 +93,6 @@ class GeneralNativeIT : BaseGradleIT() {
override val defaultGradleVersion: GradleVersionRequired
get() = GradleVersionRequired.FOR_MPP_SUPPORT

override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}

@Test
fun testParallelExecutionSmoke(): Unit = with(transformNativeTestProjectWithPluginDsl("native-parallel")) {
// Check that the K/N compiler can be started in-process in parallel.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fun BaseGradleIT.Project.testResolveAllConfigurations(
subproject: String? = null,
skipSetup: Boolean = false,
excludePredicate: String = "false",
options: BaseGradleIT.BuildOptions = testCase.defaultBuildOptions(),
withUnresolvedConfigurationNames: BaseGradleIT.CompiledProject.(List<String>) -> Unit = { assertTrue("Unresolved configurations: $it") { it.isEmpty() } }
) = with(testCase) {

Expand All @@ -32,7 +33,7 @@ fun BaseGradleIT.Project.testResolveAllConfigurations(
}
}

build(RESOLVE_ALL_CONFIGURATIONS_TASK_NAME, options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
build(RESOLVE_ALL_CONFIGURATIONS_TASK_NAME, options = options) {
assertSuccessful()
assertTasksExecuted(":${subproject?.let { "$it:" }.orEmpty()}$RESOLVE_ALL_CONFIGURATIONS_TASK_NAME")
val unresolvedConfigurations = unresolvedConfigurationRegex.findAll(output).map { it.groupValues[1] }.toList()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'kotlin'

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile project(':lib')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation project(':lib')
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'kotlin'

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

task('exit') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile "junit:junit:4.12"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testImplementation "junit:junit:4.12"
}

afterEvaluate {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
compile 'com.google.guava:guava:12.0'
testCompile 'org.testng:testng:6.8'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.google.guava:guava:12.0'
testImplementation 'org.testng:testng:6.8'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

test {
Expand Down

0 comments on commit b0ebb02

Please sign in to comment.