[Gradle, JS] Fix tests after changing default on legacy instead of ir
This commit is contained in:
+2
-2
@@ -550,8 +550,8 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) :
|
|||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||||
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
|
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||||
|
|
||||||
if (!irBackend) {
|
if (irBackend) {
|
||||||
gradleProperties().appendText(jsCompilerType(JsCompilerType.legacy))
|
gradleProperties().appendText(jsCompilerType(JsCompilerType.ir))
|
||||||
}
|
}
|
||||||
|
|
||||||
build("build") {
|
build("build") {
|
||||||
|
|||||||
+38
-25
@@ -6,7 +6,6 @@ package org.jetbrains.kotlin.gradle
|
|||||||
|
|
||||||
import org.jdom.input.SAXBuilder
|
import org.jdom.input.SAXBuilder
|
||||||
import org.jetbrains.kotlin.gradle.internals.*
|
import org.jetbrains.kotlin.gradle.internals.*
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.JsCompilerType
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations
|
import org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmWithJavaTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmWithJavaTargetPreset
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||||
@@ -15,6 +14,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.UnusedSourceSetsChecker
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.sources.METADATA_CONFIGURATION_NAME_SUFFIX
|
import org.jetbrains.kotlin.gradle.plugin.sources.METADATA_CONFIGURATION_NAME_SUFFIX
|
||||||
import org.jetbrains.kotlin.gradle.plugin.sources.SourceSetConsistencyChecks
|
import org.jetbrains.kotlin.gradle.plugin.sources.SourceSetConsistencyChecks
|
||||||
import org.jetbrains.kotlin.gradle.plugin.sources.UnsatisfiedSourceSetVisibilityException
|
import org.jetbrains.kotlin.gradle.plugin.sources.UnsatisfiedSourceSetVisibilityException
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.JsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.util.*
|
import org.jetbrains.kotlin.gradle.util.*
|
||||||
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
||||||
@@ -337,14 +337,16 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
@Test
|
@Test
|
||||||
fun testSourceSetCyclicDependencyDetection() = with(Project("sample-lib", gradleVersion, "new-mpp-lib-and-app")) {
|
fun testSourceSetCyclicDependencyDetection() = with(Project("sample-lib", gradleVersion, "new-mpp-lib-and-app")) {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
gradleBuildScript().appendText("\n" + """
|
gradleBuildScript().appendText(
|
||||||
|
"\n" + """
|
||||||
kotlin.sourceSets {
|
kotlin.sourceSets {
|
||||||
a
|
a
|
||||||
b { dependsOn a }
|
b { dependsOn a }
|
||||||
c { dependsOn b }
|
c { dependsOn b }
|
||||||
a.dependsOn(c)
|
a.dependsOn(c)
|
||||||
}
|
}
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
assertFailed()
|
assertFailed()
|
||||||
@@ -862,7 +864,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
gradleBuildScript().modify {
|
gradleBuildScript().modify {
|
||||||
it.replace("implementation 'com.example:sample-lib:1.0'", "implementation 'com.example:sample-lib-metadata:1.0'") +
|
it.replace("implementation 'com.example:sample-lib:1.0'", "implementation 'com.example:sample-lib-metadata:1.0'") +
|
||||||
"\nrepositories { maven { url '${repoDir.toURI()}' } }\n\n" + dependencies
|
"\nrepositories { maven { url '${repoDir.toURI()}' } }\n\n" + dependencies
|
||||||
}
|
}
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
@@ -1098,14 +1100,15 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun CompiledProject.checkNativeCommandLineFor(vararg taskPaths: String, check: (String) -> Unit) = taskPaths.forEach { taskPath ->
|
private fun CompiledProject.checkNativeCommandLineFor(vararg taskPaths: String, check: (String) -> Unit) =
|
||||||
val commandLine = output.lineSequence().dropWhile {
|
taskPaths.forEach { taskPath ->
|
||||||
!it.contains("Executing actions for task '$taskPath'")
|
val commandLine = output.lineSequence().dropWhile {
|
||||||
}.first {
|
!it.contains("Executing actions for task '$taskPath'")
|
||||||
it.contains("Run tool: \"konanc\"")
|
}.first {
|
||||||
|
it.contains("Run tool: \"konanc\"")
|
||||||
|
}
|
||||||
|
check(commandLine)
|
||||||
}
|
}
|
||||||
check(commandLine)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testNativeBinaryKotlinDSL() = with(
|
fun testNativeBinaryKotlinDSL() = with(
|
||||||
@@ -1246,8 +1249,8 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
assertFileExists("build/bin/ios/debugFramework/native_binary.framework")
|
assertFileExists("build/bin/ios/debugFramework/native_binary.framework")
|
||||||
assertTrue(
|
assertTrue(
|
||||||
fileInWorkingDir("build/bin/ios/debugFramework/native_binary.framework/Headers/native_binary.h")
|
fileInWorkingDir("build/bin/ios/debugFramework/native_binary.framework/Headers/native_binary.h")
|
||||||
.readText()
|
.readText()
|
||||||
.contains("+ (int32_t)exported")
|
.contains("+ (int32_t)exported")
|
||||||
)
|
)
|
||||||
// Check that by default debug frameworks have bitcode marker embedded.
|
// Check that by default debug frameworks have bitcode marker embedded.
|
||||||
checkNativeCommandLineFor(":linkDebugFrameworkIos") {
|
checkNativeCommandLineFor(":linkDebugFrameworkIos") {
|
||||||
@@ -1595,11 +1598,13 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
|
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
listOf(gradleBuildScript(), gradleBuildScript("publishedLibrary")).forEach {
|
listOf(gradleBuildScript(), gradleBuildScript("publishedLibrary")).forEach {
|
||||||
it.appendText("""
|
it.appendText(
|
||||||
|
"""
|
||||||
repositories {
|
repositories {
|
||||||
maven { url '$repo' }
|
maven { url '$repo' }
|
||||||
}
|
}
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val targetsToBuild = if (HostManager.hostIsMingw) {
|
val targetsToBuild = if (HostManager.hostIsMingw) {
|
||||||
@@ -2071,10 +2076,16 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
|
|
||||||
fun testDependencies() = testResolveAllConfigurations("app") {
|
fun testDependencies() = testResolveAllConfigurations("app") {
|
||||||
assertContains(">> :app:testNonTransitiveStringNotationApiDependenciesMetadata --> junit-4.12.jar")
|
assertContains(">> :app:testNonTransitiveStringNotationApiDependenciesMetadata --> junit-4.12.jar")
|
||||||
assertEquals(1, (Regex.escape(">> :app:testNonTransitiveStringNotationApiDependenciesMetadata") + " .*").toRegex().findAll(output).count())
|
assertEquals(
|
||||||
|
1,
|
||||||
|
(Regex.escape(">> :app:testNonTransitiveStringNotationApiDependenciesMetadata") + " .*").toRegex().findAll(output).count()
|
||||||
|
)
|
||||||
|
|
||||||
assertContains(">> :app:testNonTransitiveDependencyNotationApiDependenciesMetadata --> kotlin-reflect-${defaultBuildOptions().kotlinVersion}.jar")
|
assertContains(">> :app:testNonTransitiveDependencyNotationApiDependenciesMetadata --> kotlin-reflect-${defaultBuildOptions().kotlinVersion}.jar")
|
||||||
assertEquals(1, (Regex.escape(">> :app:testNonTransitiveStringNotationApiDependenciesMetadata") + " .*").toRegex().findAll(output).count())
|
assertEquals(
|
||||||
|
1,
|
||||||
|
(Regex.escape(">> :app:testNonTransitiveStringNotationApiDependenciesMetadata") + " .*").toRegex().findAll(output).count()
|
||||||
|
)
|
||||||
|
|
||||||
assertContains(">> :app:testExplicitKotlinVersionApiDependenciesMetadata --> kotlin-reflect-1.3.0.jar")
|
assertContains(">> :app:testExplicitKotlinVersionApiDependenciesMetadata --> kotlin-reflect-1.3.0.jar")
|
||||||
assertContains(">> :app:testExplicitKotlinVersionImplementationDependenciesMetadata --> kotlin-reflect-1.2.71.jar")
|
assertContains(">> :app:testExplicitKotlinVersionImplementationDependenciesMetadata --> kotlin-reflect-1.2.71.jar")
|
||||||
@@ -2297,25 +2308,27 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAssociateCompilations() {
|
fun testAssociateCompilations() {
|
||||||
testAssociateCompilationsImpl(false)
|
testAssociateCompilationsImpl(JsCompilerType.legacy)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAssociateCompilationsWithJsIr() {
|
fun testAssociateCompilationsWithJsIr() {
|
||||||
testAssociateCompilationsImpl(true)
|
testAssociateCompilationsImpl(JsCompilerType.ir)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun testAssociateCompilationsImpl(jsIr: Boolean) {
|
private fun testAssociateCompilationsImpl(jsCompilerType: JsCompilerType) {
|
||||||
with(Project("new-mpp-associate-compilations", GradleVersionRequired.AtLeast("5.0"))) {
|
with(Project("new-mpp-associate-compilations", GradleVersionRequired.AtLeast("5.0"))) {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||||
if (!jsIr) {
|
|
||||||
gradleProperties().appendText(jsCompilerType(JsCompilerType.legacy))
|
|
||||||
}
|
|
||||||
|
|
||||||
val tasks = listOf("jvm", "js", nativeHostTargetName).map { ":compileIntegrationTestKotlin${it.capitalize()}" }
|
val tasks = listOf("jvm", "js", nativeHostTargetName).map { ":compileIntegrationTestKotlin${it.capitalize()}" }
|
||||||
|
|
||||||
build(*tasks.toTypedArray()) {
|
build(
|
||||||
|
*tasks.toTypedArray(),
|
||||||
|
options = defaultBuildOptions().copy(
|
||||||
|
jsCompilerType = jsCompilerType
|
||||||
|
)
|
||||||
|
) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertTasksExecuted(*tasks.toTypedArray())
|
assertTasksExecuted(*tasks.toTypedArray())
|
||||||
|
|
||||||
@@ -2329,7 +2342,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
|
|
||||||
// JS:
|
// JS:
|
||||||
assertFileExists(
|
assertFileExists(
|
||||||
if (jsIr) {
|
if (jsCompilerType == JsCompilerType.ir) {
|
||||||
"build/classes/kotlin/js/integrationTest/default/manifest"
|
"build/classes/kotlin/js/integrationTest/default/manifest"
|
||||||
} else {
|
} else {
|
||||||
"build/classes/kotlin/js/integrationTest/new-mpp-associate-compilations_integrationTest.js"
|
"build/classes/kotlin/js/integrationTest/new-mpp-associate-compilations_integrationTest.js"
|
||||||
|
|||||||
+14
-8
@@ -36,8 +36,10 @@ class VariantAwareDependenciesIT : BaseGradleIT() {
|
|||||||
embedProject(innerProject)
|
embedProject(innerProject)
|
||||||
gradleBuildScript(innerProject.projectName).appendText("\nrepositories { jcenter() }; dependencies { compile rootProject }")
|
gradleBuildScript(innerProject.projectName).appendText("\nrepositories { jcenter() }; dependencies { compile rootProject }")
|
||||||
|
|
||||||
testResolveAllConfigurations(innerProject.projectName) {
|
testResolveAllConfigurations(
|
||||||
assertContains(">> :${innerProject.projectName}:runtime --> sample-lib-nodejs-1.0.klib")
|
subproject = innerProject.projectName
|
||||||
|
) {
|
||||||
|
assertContains(">> :${innerProject.projectName}:runtime --> sample-lib-nodejs-1.0.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleProperties().appendText(jsCompilerType(JsCompilerType.legacy))
|
gradleProperties().appendText(jsCompilerType(JsCompilerType.legacy))
|
||||||
@@ -46,7 +48,7 @@ class VariantAwareDependenciesIT : BaseGradleIT() {
|
|||||||
subproject = innerProject.projectName,
|
subproject = innerProject.projectName,
|
||||||
skipSetup = true
|
skipSetup = true
|
||||||
) {
|
) {
|
||||||
assertContains(">> :${innerProject.projectName}:runtime --> sample-lib-nodejs-1.0.jar")
|
assertContains(">> :${innerProject.projectName}:runtime --> sample-lib-nodejs-1.0.klib")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,14 +148,16 @@ class VariantAwareDependenciesIT : BaseGradleIT() {
|
|||||||
embedProject(innerJvmProject)
|
embedProject(innerJvmProject)
|
||||||
embedProject(innerJsProject)
|
embedProject(innerJsProject)
|
||||||
|
|
||||||
gradleBuildScript().appendText("\n" + """
|
gradleBuildScript().appendText(
|
||||||
|
"\n" + """
|
||||||
dependencies {
|
dependencies {
|
||||||
jvm6Implementation project(':${innerJvmProject.projectName}')
|
jvm6Implementation project(':${innerJvmProject.projectName}')
|
||||||
jvm6TestRuntime project(':${innerJvmProject.projectName}')
|
jvm6TestRuntime project(':${innerJvmProject.projectName}')
|
||||||
nodeJsImplementation project(':${innerJsProject.projectName}')
|
nodeJsImplementation project(':${innerJsProject.projectName}')
|
||||||
nodeJsTestRuntime project(':${innerJsProject.projectName}')
|
nodeJsTestRuntime project(':${innerJsProject.projectName}')
|
||||||
}
|
}
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
|
||||||
testResolveAllConfigurations(innerJvmProject.projectName)
|
testResolveAllConfigurations(innerJvmProject.projectName)
|
||||||
}
|
}
|
||||||
@@ -242,13 +246,15 @@ class VariantAwareDependenciesIT : BaseGradleIT() {
|
|||||||
testResolveAllConfigurations("libJs")
|
testResolveAllConfigurations("libJs")
|
||||||
|
|
||||||
embedProject(Project("sample-lib", directoryPrefix = "new-mpp-lib-and-app"))
|
embedProject(Project("sample-lib", directoryPrefix = "new-mpp-lib-and-app"))
|
||||||
gradleBuildScript("sample-lib").appendText("\n" + """
|
gradleBuildScript("sample-lib").appendText(
|
||||||
|
"\n" + """
|
||||||
dependencies {
|
dependencies {
|
||||||
commonMainApi 'com.example.oldmpp:lib:1.0'
|
commonMainApi 'com.example.oldmpp:lib:1.0'
|
||||||
jvm6MainApi 'com.example.oldmpp:libJvm:1.0'
|
jvm6MainApi 'com.example.oldmpp:libJvm:1.0'
|
||||||
nodeJsMainApi 'com.example.oldmpp:libJs:1.0'
|
nodeJsMainApi 'com.example.oldmpp:libJs:1.0'
|
||||||
}
|
}
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
testResolveAllConfigurations("sample-lib")
|
testResolveAllConfigurations("sample-lib")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +268,7 @@ class VariantAwareDependenciesIT : BaseGradleIT() {
|
|||||||
fun testConfigurationsWithNoExplicitUsageResolveRuntime() =
|
fun testConfigurationsWithNoExplicitUsageResolveRuntime() =
|
||||||
// Starting with Gradle 5.0, plain Maven dependencies are represented as two variants, and resolving them to the API one leads
|
// Starting with Gradle 5.0, plain Maven dependencies are represented as two variants, and resolving them to the API one leads
|
||||||
// to transitive dependencies left out of the resolution results. We need to ensure that our attributes schema does not lead to the API
|
// to transitive dependencies left out of the resolution results. We need to ensure that our attributes schema does not lead to the API
|
||||||
// variants chosen over the runtime ones when resolving a configuration with no required Usage:
|
// variants chosen over the runtime ones when resolving a configuration with no required Usage:
|
||||||
with(Project("simpleProject", GradleVersionRequired.AtLeast("5.0-milestone-1"))) {
|
with(Project("simpleProject", GradleVersionRequired.AtLeast("5.0-milestone-1"))) {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
gradleBuildScript().appendText("\ndependencies { compile 'org.jetbrains.kotlin:kotlin-compiler-embeddable' }")
|
gradleBuildScript().appendText("\ndependencies { compile 'org.jetbrains.kotlin:kotlin-compiler-embeddable' }")
|
||||||
|
|||||||
Reference in New Issue
Block a user