[Gradle, JS] Fix test for resolving
This commit is contained in:
+5
@@ -627,6 +627,11 @@ Finished executing task ':$taskName'|
|
||||
singleOrNull { it.exists() } ?: first()
|
||||
}
|
||||
|
||||
fun Project.gradleProperties(): File =
|
||||
listOf("gradle.properties").mapNotNull {
|
||||
File(projectDir, it).takeIf(File::exists)
|
||||
}.single()
|
||||
|
||||
/**
|
||||
* @param assertionFileName path to xml with expected test results, relative to test resources root
|
||||
*/
|
||||
|
||||
+12
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.gradle.util.isWindows
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.jetbrains.kotlin.gradle.util.testResolveAllConfigurations
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class VariantAwareDependenciesIT : BaseGradleIT() {
|
||||
private val gradleVersion = GradleVersionRequired.None
|
||||
@@ -39,6 +40,17 @@ class VariantAwareDependenciesIT : BaseGradleIT() {
|
||||
gradleBuildScript(innerProject.projectName).appendText("\nrepositories { jcenter() }; dependencies { compile rootProject }")
|
||||
|
||||
testResolveAllConfigurations(innerProject.projectName) {
|
||||
assertContains(">> :${innerProject.projectName}:runtime --> sample-lib-nodejs-1.0.klib")
|
||||
}
|
||||
|
||||
gradleProperties().appendText("\nkotlin.js.mode=legacy")
|
||||
|
||||
assertTrue { gradleProperties().readText().contains("kotlin.js.mode=legacy") }
|
||||
|
||||
testResolveAllConfigurations(
|
||||
subproject = innerProject.projectName,
|
||||
skipSetup = true
|
||||
) {
|
||||
assertContains(">> :${innerProject.projectName}:runtime --> sample-lib-nodejs-1.0.jar")
|
||||
}
|
||||
}
|
||||
|
||||
+10
-7
@@ -14,18 +14,21 @@ private val unresolvedConfigurationRegex = "${Regex.escape(UNRESOLVED_MARKER)}(.
|
||||
|
||||
fun BaseGradleIT.Project.testResolveAllConfigurations(
|
||||
subproject: String? = null,
|
||||
skipSetup: Boolean = false,
|
||||
excludePredicate: String = "false",
|
||||
withUnresolvedConfigurationNames: BaseGradleIT.CompiledProject.(List<String>) -> Unit = { assertTrue("Unresolved configurations: $it") { it.isEmpty() } }
|
||||
) = with(testCase) {
|
||||
|
||||
setupWorkingDir()
|
||||
gradleBuildScript(subproject).run {
|
||||
val taskCode = when (extension) {
|
||||
"gradle" -> generateResolveAllConfigurationsTask(excludePredicate)
|
||||
"kts" -> generateResolveAllConfigurationsTaskKts(excludePredicate)
|
||||
else -> error("Unexpected build script extension $extension")
|
||||
if (!skipSetup) {
|
||||
setupWorkingDir()
|
||||
gradleBuildScript(subproject).run {
|
||||
val taskCode = when (extension) {
|
||||
"gradle" -> generateResolveAllConfigurationsTask(excludePredicate)
|
||||
"kts" -> generateResolveAllConfigurationsTaskKts(excludePredicate)
|
||||
else -> error("Unexpected build script extension $extension")
|
||||
}
|
||||
appendText("\n" + taskCode)
|
||||
}
|
||||
appendText("\n" + taskCode)
|
||||
}
|
||||
|
||||
build(RESOLVE_ALL_CONFIGURATIONS_TASK_NAME) {
|
||||
|
||||
Reference in New Issue
Block a user