I work on improving the build time for generating ...
# ios
a
I work on improving the build time for generating the
XCFramework,
which later is copied to another directory and used by React UI layer. Initially, we were using
assembleXCFramework
which took 3m 30s. Then I changed it to
assembleSharedReleaseXCFramework
and the build time decreased to 2m 15s, which is already great.
XCFramework
generated, files copied all run fine. But the
assembleSharedReleaseXCFramework
still runs both tasks
linkReleaseFrameworkIosX64
and
linkReleaseFrameworkIosArm64
, which take about 65s each. • We are all on MacBooks M1 in our team. Would you happen to know if we need both tasks to run? • If I skip
linkReleaseFrameworkIosX64
by adding
-x linkReleaseFrameworkIosX64
, it runs the first task, but the job fails because
XCFramework
is not generated. • Do you think this is the right approach, or do you have suggestions?
n
it’s all fine with everyone in the team on M1 but then there’s CI with x86 CPU 😬
a
Not sure exactly how is our CI setup but runner in on Mac Mini M1, but GitLab is hosted on AWS
n
regarding the approach, I suppose if you configure all targets manually without using the
ios()
shortcut and simply don’t configure the x64 one, you should get what you’re looking for. Not sure if it’s the best approach though.
a
Thanks. I added if check for iosArm64 in ios, and seems to do the trick. Build time decreased to 1m 10s which is a 68% boost!
Copy code
ios {
    binaries.framework {
        baseName = "shared"

        // Add only iosArm64 to the XCFramework
        if (this@ios.equals(iosArm64())) {
            xcf.add(this)
        }
    }
}
It worked as well by only changing
ios {...}
to
iosArm64 {...}
but I thought it may be safer to keep iOS if we want to run a normal iOS app on intel processors later.
k
Couldn’t you just use the target directly? ios just adds iosArm64 and iosX64. So maybe:
Copy code
iosArm64("ios") {
    binaries.framework {
        baseName = "shared"
    }
}