Setup iOS platform correctly

This commit is contained in:
dankito 2020-11-10 01:56:18 +01:00
parent 40ca00e470
commit d51ad29b3a
4 changed files with 39 additions and 31 deletions

View File

@ -11,6 +11,15 @@ kotlin {
kotlinOptions.jvmTarget = "1.8"
}
}
ios {
binaries {
framework {
baseName = "EpcQrCode"
}
}
}
js {
browser {
testTask {
@ -21,6 +30,12 @@ kotlin {
}
}
}
js("nodeJs") {
nodejs {
}
}
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
@ -30,26 +45,7 @@ kotlin {
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
js("nodeJs") {
nodejs {
}
}
iosArm64 {
binaries {
framework {
baseName = "EpcQrCode"
}
}
}
iosX64 {
binaries {
framework {
baseName = "EpcQrCode"
}
}
}
sourceSets {
val commonMain by getting
val commonTest by getting {
@ -58,32 +54,38 @@ kotlin {
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting
val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit"))
}
}
val iosMain by getting
val iosTest by getting
val jsMain by getting
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
val nativeMain by getting
val nativeTest by getting
val nodeJsMain by getting
val nodeJsTest by getting
val iosArm64Main by getting
val iosArm64Test by getting
val iosX64Main by getting
val iosX64Test by getting
val nativeMain by getting
val nativeTest by getting
}
}
val packForXcode by tasks.creating(Sync::class) {
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val framework = kotlin.targets.getByName<KotlinNativeTarget>("iosArm64").binaries.getFramework(mode)
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
val framework = kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks")

View File

@ -485,6 +485,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"EpcQrCodeiOSApp/Preview Content\"";
DEVELOPMENT_TEAM = 7WVYN7QA7Z;
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../EpcQrCode/build/xcode-frameworks";
INFOPLIST_FILE = EpcQrCodeiOSApp/Info.plist;
@ -492,7 +493,8 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.EpcQrCodeiOSApp;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.codinux.banking.epcqrcode.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@ -505,6 +507,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"EpcQrCodeiOSApp/Preview Content\"";
DEVELOPMENT_TEAM = 7WVYN7QA7Z;
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../EpcQrCode/build/xcode-frameworks";
INFOPLIST_FILE = EpcQrCodeiOSApp/Info.plist;
@ -512,7 +515,8 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.EpcQrCodeiOSApp;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.codinux.banking.epcqrcode.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";

View File

@ -1,8 +1,10 @@
import SwiftUI
import EpcQrCode
struct ContentView: View {
var body: some View {
Text("Hello, World!")
Text(MppTest().showMessage())
}
}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>