Add integration tests for "assembleAppleFrameworkForXcode" and "embedAndSignAppleFrameworkForXcode" tasks.
This commit is contained in:
committed by
TeamCityServer
parent
c8ef0715b9
commit
b894b7df6e
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.junit.Assume
|
||||
import org.junit.BeforeClass
|
||||
import kotlin.test.Test
|
||||
|
||||
class AppleFrameworkIT : KotlinAndroid36GradleIT() {
|
||||
companion object {
|
||||
private val gradleVersion = GradleVersionRequired.FOR_MPP_SUPPORT
|
||||
|
||||
@BeforeClass
|
||||
@JvmStatic
|
||||
fun assumeItsMac() {
|
||||
Assume.assumeTrue(HostManager.hostIsMac)
|
||||
}
|
||||
}
|
||||
|
||||
override val defaultGradleVersion: GradleVersionRequired
|
||||
get() = gradleVersion
|
||||
|
||||
@Test
|
||||
fun `assemble debug AppleFrameworkForXcode for IosArm64`() {
|
||||
with(Project("sharedAppleFramework")) {
|
||||
val options: BuildOptions = defaultBuildOptions().copy(
|
||||
customEnvironmentVariables = mapOf(
|
||||
"CONFIGURATION" to "debug",
|
||||
"SDK_NAME" to "iphoneos123"
|
||||
)
|
||||
)
|
||||
build("assembleAppleFrameworkForXcode", options = options) {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(":shared:assembleSharedDebugAppleFrameworkForXcodeIosArm64")
|
||||
assertFileExists("/shared/build/xcode-frameworks/debug/iphoneos123/shared.framework")
|
||||
assertFileExists("/shared/build/xcode-frameworks/debug/iphoneos123/shared.framework.dSYM")
|
||||
}
|
||||
|
||||
build("assembleAppleFrameworkForXcode", options = options) {
|
||||
assertSuccessful()
|
||||
assertTasksUpToDate(":shared:assembleSharedDebugAppleFrameworkForXcodeIosArm64")
|
||||
assertFileExists("/shared/build/xcode-frameworks/debug/iphoneos123/shared.framework")
|
||||
assertFileExists("/shared/build/xcode-frameworks/debug/iphoneos123/shared.framework.dSYM")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `check there aren't Xcode tasks without Xcode environment`() {
|
||||
with(Project("sharedAppleFramework")) {
|
||||
build("tasks") {
|
||||
assertSuccessful()
|
||||
assertTasksNotRegistered(
|
||||
":shared:assembleAppleFrameworkForXcode",
|
||||
":shared:embedAndSignAppleFrameworkForXcode"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `check all registered tasks with Xcode environment for Debug IosArm64 configuration`() {
|
||||
with(Project("sharedAppleFramework")) {
|
||||
val options: BuildOptions = defaultBuildOptions().copy(
|
||||
customEnvironmentVariables = mapOf(
|
||||
"CONFIGURATION" to "Debug",
|
||||
"SDK_NAME" to "iphoneos",
|
||||
"EXPANDED_CODE_SIGN_IDENTITY" to "-",
|
||||
"TARGET_BUILD_DIR" to "testBuildDir",
|
||||
"FRAMEWORKS_FOLDER_PATH" to "testFrameworksDir"
|
||||
)
|
||||
)
|
||||
build("tasks", options = options) {
|
||||
assertSuccessful()
|
||||
assertTasksRegistered(
|
||||
":shared:assembleAppleFrameworkForXcode",
|
||||
":shared:assembleSharedDebugAppleFrameworkForXcodeIosArm64",
|
||||
":shared:embedAndSignAppleFrameworkForXcode"
|
||||
)
|
||||
assertTasksNotRegistered(":shared:assembleSharedDebugAppleFrameworkForXcodeIosX64")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `check there isn't embedAndSignAppleFrameworkForXcode task without required Xcode environments`() {
|
||||
with(Project("sharedAppleFramework")) {
|
||||
val options: BuildOptions = defaultBuildOptions().copy(
|
||||
customEnvironmentVariables = mapOf(
|
||||
"CONFIGURATION" to "Debug",
|
||||
"SDK_NAME" to "iphoneos"
|
||||
)
|
||||
)
|
||||
build("tasks", options = options) {
|
||||
assertSuccessful()
|
||||
assertTasksRegistered(
|
||||
":shared:assembleAppleFrameworkForXcode",
|
||||
":shared:assembleSharedDebugAppleFrameworkForXcodeIosArm64",
|
||||
)
|
||||
assertTasksNotRegistered(
|
||||
":shared:embedAndSignAppleFrameworkForXcode",
|
||||
":shared:assembleSharedDebugAppleFrameworkForXcodeIosX64"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-1
@@ -247,7 +247,8 @@ abstract class BaseGradleIT {
|
||||
val configurationCache: Boolean = false,
|
||||
val configurationCacheProblems: ConfigurationCacheProblems = ConfigurationCacheProblems.FAIL,
|
||||
val warningMode: WarningMode = WarningMode.Fail,
|
||||
val useFir: Boolean = false
|
||||
val useFir: Boolean = false,
|
||||
val customEnvironmentVariables: Map<String, String> = mapOf()
|
||||
)
|
||||
|
||||
enum class ConfigurationCacheProblems {
|
||||
@@ -662,6 +663,12 @@ abstract class BaseGradleIT {
|
||||
}
|
||||
}
|
||||
|
||||
fun CompiledProject.assertTasksNotRegistered(vararg tasks: String) {
|
||||
for (task in tasks) {
|
||||
assertNotContains("'Register task $task'")
|
||||
}
|
||||
}
|
||||
|
||||
fun CompiledProject.assertTasksRegisteredByPrefix(taskPrefixes: Iterable<String>) {
|
||||
for (prefix in taskPrefixes) {
|
||||
assertContainsRegex("'Register task $prefix\\w*'".toRegex())
|
||||
@@ -963,6 +970,7 @@ Finished executing task ':$taskName'|
|
||||
options.gradleUserHome?.let {
|
||||
put("GRADLE_USER_HOME", it.canonicalPath)
|
||||
}
|
||||
putAll(options.customEnvironmentVariables)
|
||||
}
|
||||
|
||||
private fun String.normalize() = this.lineSequence().joinToString(SYSTEM_LINE_SEPARATOR)
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
jcenter()
|
||||
google()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath(kotlin("gradle-plugin:${property("kotlin_version")}"))
|
||||
classpath("com.android.tools.build:gradle:${property("android_tools_version")}")
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||
kotlin.native.enableDependencyPropagation=false
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
include(":shared")
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
id("com.android.library")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
android()
|
||||
|
||||
ios() {
|
||||
binaries {
|
||||
framework {
|
||||
baseName = "shared"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion(30)
|
||||
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
||||
defaultConfig {
|
||||
minSdkVersion(21)
|
||||
targetSdkVersion(30)
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.github.jetbrains.myapplication" />
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.github.jetbrains.myapplication
|
||||
|
||||
actual class Platform actual constructor() {
|
||||
actual val platform: String = "Android ${android.os.Build.VERSION.SDK_INT}"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.github.jetbrains.myapplication
|
||||
|
||||
class Greeting {
|
||||
fun greeting(): String {
|
||||
return "Hello, ${Platform().platform}!"
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.github.jetbrains.myapplication
|
||||
|
||||
expect class Platform() {
|
||||
val platform: String
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.github.jetbrains.myapplication
|
||||
|
||||
import platform.UIKit.UIDevice
|
||||
|
||||
actual class Platform actual constructor() {
|
||||
actual val platform: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
|
||||
}
|
||||
Reference in New Issue
Block a user