Migrated AppleFrameworkNonMacIT to new test dsl (junit 5 and gradle test kit)

#KT-51553 In Progress
This commit is contained in:
Dmitrii Krasnov
2023-06-12 12:13:39 +02:00
committed by Space Team
parent 72525a22a6
commit 39e97e5766
2 changed files with 30 additions and 33 deletions
@@ -1,39 +1,43 @@
/* /*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
package org.jetbrains.kotlin.gradle.native package org.jetbrains.kotlin.gradle.native
import org.jetbrains.kotlin.gradle.BaseGradleIT import org.gradle.util.GradleVersion
import org.jetbrains.kotlin.gradle.GradleVersionRequired import org.jetbrains.kotlin.gradle.testbase.*
import org.jetbrains.kotlin.gradle.transformProjectWithPluginsDsl import org.junit.jupiter.api.DisplayName
import org.jetbrains.kotlin.konan.target.HostManager import org.junit.jupiter.api.condition.OS
import org.junit.Assume
import org.junit.BeforeClass
import org.junit.Test
import kotlin.test.assertTrue
class AppleFrameworkNonMacIT : BaseGradleIT() { @OsCondition(supportedOn = [OS.LINUX, OS.WINDOWS])
@DisplayName("K/N tests for Apple Framework on non Mac Os")
@NativeGradlePluginTests
class AppleFrameworkNonMacIT : KGPBaseTest() {
override val defaultGradleVersion: GradleVersionRequired @DisplayName("podImport task execution without fail")
get() = GradleVersionRequired.FOR_MPP_SUPPORT @GradleTest
fun checkSuccessPodImport(gradleVersion: GradleVersion) {
@Test nativeProject("native-cocoapods-tests", gradleVersion) {
fun `check success podImport`() { val buildOptions = defaultBuildOptions.copy(
transformProjectWithPluginsDsl( nativeOptions = defaultBuildOptions.nativeOptions.copy(
"native-cocoapods-tests" cocoapodsGenerateWrapper = true
).build("podImport", "-Pkotlin.native.cocoapods.generate.wrapper=true") { )
assertSuccessful() )
assertTrue { output.contains("Kotlin Cocoapods Plugin is fully supported on mac machines only. Gradle tasks that can not run on non-mac hosts will be skipped.") }
build("podImport", buildOptions = buildOptions) {
assertOutputContains("Kotlin Cocoapods Plugin is fully supported on mac machines only. Gradle tasks that can not run on non-mac hosts will be skipped.")
}
} }
} }
@Test @DisplayName("XCFramework and FatFramework tasks are SKIPPED")
fun `check XCFramework and FatFramework tasks are SKIPPED`() { @GradleTest
transformProjectWithPluginsDsl("appleXCFramework") fun checkXCFrameworkAndFatFrameworkTasksAreSkipped(gradleVersion: GradleVersion) {
.build("assembleSharedDebugXCFramework") {
assertSuccessful() project("appleXCFramework", gradleVersion) {
build("assembleSharedDebugXCFramework") {
assertTasksSkipped(":shared:linkDebugFrameworkIosArm64") assertTasksSkipped(":shared:linkDebugFrameworkIosArm64")
assertTasksSkipped(":shared:linkDebugFrameworkIosX64") assertTasksSkipped(":shared:linkDebugFrameworkIosX64")
assertTasksSkipped(":shared:linkDebugFrameworkWatchosArm32") assertTasksSkipped(":shared:linkDebugFrameworkWatchosArm32")
@@ -43,13 +47,6 @@ class AppleFrameworkNonMacIT : BaseGradleIT() {
assertTasksSkipped(":shared:assembleDebugWatchosFatFrameworkForSharedXCFramework") assertTasksSkipped(":shared:assembleDebugWatchosFatFrameworkForSharedXCFramework")
assertTasksSkipped(":shared:assembleSharedDebugXCFramework") assertTasksSkipped(":shared:assembleSharedDebugXCFramework")
} }
}
companion object {
@BeforeClass
@JvmStatic
fun assumeItsNonMac() {
Assume.assumeFalse(HostManager.hostIsMac)
} }
} }
} }
@@ -1,6 +1,6 @@
plugins { plugins {
id("org.jetbrains.kotlin.multiplatform").version("<pluginMarkerVersion>") id("org.jetbrains.kotlin.multiplatform")
id("org.jetbrains.kotlin.native.cocoapods").version("<pluginMarkerVersion>") id("org.jetbrains.kotlin.native.cocoapods")
} }
repositories { repositories {