[mpp, tests] Assert that all dependencies are resolved, fix misconfigurations
- Assert that all dependencies are resolved. Gradle won't fail the build by default, which might lead to test running in a weird misconfigured state and producing unreliable results (can be green even though there are bugs) - Fix several typos and misconfigurations that were revealed after adding assertion described above
This commit is contained in:
committed by
Space Team
parent
1832a6d936
commit
14b340c61e
+7
-12
@@ -62,33 +62,28 @@ class PreHmppDependenciesDeprecationIT : KGPBaseTest() {
|
||||
|
||||
@GradleTest
|
||||
fun testNoWarningsOnProjectDependencies(gradleVersion: GradleVersion) {
|
||||
checkDiagnostics(gradleVersion, "noWarningsOnProjectDependencies", taskToCall = ":consumer:dependencies")
|
||||
checkDiagnostics(gradleVersion, "noWarningsOnProjectDependencies", projectPathToCheck = ":consumer")
|
||||
}
|
||||
|
||||
@GradleTest
|
||||
fun testNoWarningsInPlatformSpecificSourceSets(gradleVersion: GradleVersion) {
|
||||
checkDiagnostics(gradleVersion, "noWarningsInPlatformSpecificSourceSets")
|
||||
}
|
||||
|
||||
@GradleTest
|
||||
fun testNoWarningsInPreHmppProjects(gradleVersion: GradleVersion, @TempDir tempDir: Path) {
|
||||
fun testNoWarningsInPlatformSpecificSourceSets(gradleVersion: GradleVersion, @TempDir tempDir: Path) {
|
||||
publishLibrary("preHmppLibrary", gradleVersion, tempDir)
|
||||
checkDiagnostics(gradleVersion, "simpleReport", tempDir) {
|
||||
gradleProperties.writeText("kotlin.internal.mpp.hierarchicalStructureByDefault=false")
|
||||
}
|
||||
checkDiagnostics(gradleVersion, "noWarningsInPlatformSpecificSourceSets", tempDir)
|
||||
}
|
||||
|
||||
private fun checkDiagnostics(
|
||||
gradleVersion: GradleVersion,
|
||||
projectName: String,
|
||||
tempDir: Path? = null,
|
||||
taskToCall: String = "dependencies",
|
||||
projectPathToCheck: String = "", // empty means rootProject
|
||||
expectReportForDependency: String? = null,
|
||||
preBuildAction: TestProject.() -> Unit = {}
|
||||
) {
|
||||
project("preHmppDependenciesDeprecation/$projectName", gradleVersion, localRepoDir = tempDir?.resolve("repo")) {
|
||||
preBuildAction()
|
||||
build(taskToCall) {
|
||||
build("$projectPathToCheck:dependencies") {
|
||||
// all dependencies should be resolved, Gradle won't fail the 'dependencies' task on its own
|
||||
assertOutputDoesNotContain("FAILED")
|
||||
if (expectReportForDependency != null) {
|
||||
output.assertHasDiagnostic(
|
||||
KotlinToolingDiagnostics.PreHmppDependenciesUsedInBuild
|
||||
|
||||
+4
-8
@@ -1,17 +1,13 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven("<localRepo>")
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven("<localRepo>")
|
||||
}
|
||||
|
||||
group = "org.jetbrains.kotlin.tests"
|
||||
version = "0.1"
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js()
|
||||
|
||||
+11
-3
@@ -8,13 +8,21 @@ repositories {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
jvm() {
|
||||
testRuns.named("test") {
|
||||
executionTask.configure {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
}
|
||||
linuxX64()
|
||||
|
||||
sourceSets.getByName("commonMain").dependencies {
|
||||
implementation(kotlin("stdlib"))
|
||||
implementation(kotlin("kotlin-test"))
|
||||
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
|
||||
}
|
||||
|
||||
sourceSets.getByName("commonTest").dependencies {
|
||||
implementation(kotlin("test"))
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -5,6 +5,7 @@ plugins {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven("<localRepo>")
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
|
||||
Reference in New Issue
Block a user