Devendra Patel
12/03/2020, 5:27 PMThomas Myrden
12/03/2020, 5:29 PMDevendra Patel
12/03/2020, 5:39 PMval packForXcodeTV by tasks.creating(Sync::class) {
group = "build"
//selecting the right configuration for the iOS framework depending on the Xcode environment variables
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val framework = kotlin.targets.getByName<KotlinNativeTarget>("tvos").binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks-tv")
from({ framework.outputDirectory })
into(targetDir)
doLast {
val gradlew = File(targetDir, "gradlew")
gradlew.writeText("#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n")
gradlew.setExecutable(true)
}
}
When I run that task as part of run script
from Xcode I get following error KotlinTarget with name 'tvos' not found.
Thomas Myrden
12/03/2020, 5:49 PMval targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
Based on the docs here (https://kotlinlang.org/docs/reference/mpp-dsl-reference.html) it looks like you just need to follow a similar pattern as the iOS block, swapping out for tvos so you build either tvosArm64
or tvosX64
Devendra Patel
12/03/2020, 6:46 PMKotlinTarget with name 'tvosX64' not found.
error for simulatorThomas Myrden
12/03/2020, 6:49 PMios {
binaries {
framework {
baseName = "shared"
}
}
}
Devendra Patel
12/03/2020, 7:04 PMThomas Myrden
12/03/2020, 7:05 PM