@@ -44,52 +44,59 @@ android {
4444 }
4545}
4646
47+ val KonanTarget .archVariant: String
48+ get() = if (this is KonanTarget .IOS_X64 || this is KonanTarget .IOS_SIMULATOR_ARM64 ) {
49+ " ios-arm64_i386_x86_64-simulator"
50+ } else {
51+ " ios-arm64_armv7"
52+ }
53+
4754kotlin {
4855
4956 android {
5057 publishAllLibraryVariants()
5158 }
5259
53- fun nativeTargetConfig (): KotlinNativeTarget .() -> Unit = {
54- val nativeFrameworkPaths = listOf (
55- projectDir.resolve(" src/nativeInterop/cinterop/Carthage/Build/iOS" )
56- ).plus(
57- listOf (
58- " FirebaseAnalytics" ,
59- " FirebaseCore" ,
60- " FirebaseCoreDiagnostics" ,
61- " FirebaseInstallations" ,
62- " GoogleAppMeasurement" ,
63- " GoogleDataTransport" ,
64- " GoogleUtilities" ,
65- " nanopb" ,
66- " PromisesObjC"
67- ).map {
68- val archVariant = if (konanTarget is KonanTarget .IOS_X64 ) " ios-arm64_i386_x86_64-simulator" else " ios-arm64_armv7"
69-
70- projectDir.resolve(" src/nativeInterop/cinterop/Carthage/Build/$it .xcframework/$archVariant " )
71- }
72- )
60+ val supportIosTarget = project.property(" skipIosTarget" ) != " true"
61+ if (supportIosTarget) {
62+
63+ fun nativeTargetConfig (): KotlinNativeTarget .() -> Unit = {
64+ val nativeFrameworkPaths = listOf (
65+ projectDir.resolve(" src/nativeInterop/cinterop/Carthage/Build/iOS" )
66+ ).plus(
67+ listOf (
68+ " FirebaseAnalytics" ,
69+ " FirebaseCore" ,
70+ " FirebaseCoreDiagnostics" ,
71+ " FirebaseInstallations" ,
72+ " GoogleAppMeasurement" ,
73+ " GoogleAppMeasurementIdentitySupport" ,
74+ " GoogleDataTransport" ,
75+ " GoogleUtilities" ,
76+ " nanopb" ,
77+ " PromisesObjC"
78+ ).map {
79+ projectDir.resolve(" src/nativeInterop/cinterop/Carthage/Build/$it .xcframework/${konanTarget.archVariant} " )
80+ }
81+ )
7382
74- binaries {
75- getTest(" DEBUG" ).apply {
76- linkerOpts(nativeFrameworkPaths.map { " -F$it " })
77- linkerOpts(" -ObjC" )
83+ binaries {
84+ getTest(" DEBUG" ).apply {
85+ linkerOpts(nativeFrameworkPaths.map { " -F$it " })
86+ linkerOpts(" -ObjC" )
87+ }
7888 }
79- }
8089
81- compilations.getByName(" main" ) {
82- cinterops.create(" FirebaseCore" ) {
83- compilerOpts(nativeFrameworkPaths.map { " -F$it " })
84- extraOpts(" -verbose" )
90+ compilations.getByName(" main" ) {
91+ cinterops.create(" FirebaseCore" ) {
92+ compilerOpts(nativeFrameworkPaths.map { " -F$it " })
93+ extraOpts = listOf (" -compiler-option" , " -DNS_FORMAT_ARGUMENT(A)=" , " -verbose" )
94+ }
8595 }
8696 }
87- }
8897
89- if (project.extra[" ideaActive" ] as Boolean ) {
90- iosX64(" ios" , nativeTargetConfig())
91- } else {
9298 ios(configure = nativeTargetConfig())
99+ iosSimulatorArm64(configure = nativeTargetConfig())
93100 }
94101
95102 js {
@@ -127,16 +134,30 @@ kotlin {
127134
128135 val androidMain by getting {
129136 dependencies {
130- api(" com.google.firebase:firebase-common-ktx " )
137+ api(" com.google.firebase:firebase-common" )
131138 }
132139 }
133140
134- val iosMain by getting
141+ if (supportIosTarget) {
142+ val iosMain by getting
143+ val iosSimulatorArm64Main by getting
144+ iosSimulatorArm64Main.dependsOn(iosMain)
145+
146+ val iosTest by sourceSets.getting
147+ val iosSimulatorArm64Test by sourceSets.getting
148+ iosSimulatorArm64Test.dependsOn(iosTest)
149+ }
135150
136151 val jsMain by getting
137152 }
138153}
139154
155+ if (project.property(" firebase-app.skipIosTests" ) == " true" ) {
156+ tasks.forEach {
157+ if (it.name.contains(" ios" , true ) && it.name.contains(" test" , true )) { it.enabled = false }
158+ }
159+ }
160+
140161signing {
141162 val signingKey: String? by project
142163 val signingPassword: String? by project
0 commit comments