Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Make modifications so that the build can be done on the actual iPhone device. #759

Merged

Conversation

Corvus400
Copy link
Contributor

@Corvus400 Corvus400 commented Aug 23, 2024

Issue

  • None.

Overview (Required)

  • When installing a debug build on an actual iPhone device, the current situation is laborious, so we have made some modifications.

@github-actions github-actions bot temporarily deployed to deploygate-distribution August 23, 2024 23:43 Inactive
@Corvus400 Corvus400 changed the title 🔧 Make modifications so that the build can be done on the actual iPhone device. [WIP] 🔧 Make modifications so that the build can be done on the actual iPhone device. Aug 23, 2024
@github-actions github-actions bot temporarily deployed to deploygate-distribution August 24, 2024 00:04 Inactive
@Corvus400 Corvus400 changed the title [WIP] 🔧 Make modifications so that the build can be done on the actual iPhone device. 🔧 Make modifications so that the build can be done on the actual iPhone device. Aug 24, 2024
@Corvus400 Corvus400 marked this pull request as ready for review August 24, 2024 00:32
@Corvus400
Copy link
Contributor Author

I would like to merge this support as soon as possible, as it is inconvenient in its current state when doing Compose Multiplatform tasks. 🙏

@@ -193,7 +193,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "cd ${SRCROOT}/../..\n./gradlew assembleSharedXCFramework --no-configuration-cache\n./gradlew iosSimulatorArm64AggregateResources --no-configuration-cache\n\nRESOURCE_DIR=\"./app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/iosSimulatorArm64\"\n\nmkdir ${RESOURCE_DIR}/compose-resources\ncp -R ${RESOURCE_DIR}/composeResources ${RESOURCE_DIR}/compose-resources\n";
shellScript = "cd ${SRCROOT}/../..\n\n./gradlew assembleSharedXCFramework --no-configuration-cache\n./gradlew iosSimulatorArm64AggregateResources --no-configuration-cache\n./gradlew iosArm64AggregateResources --no-configuration-cache\n\nSIMULATOR_RESOURCE_DIR=\"./app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/iosSimulatorArm64\"\nDEVICE_RESOURCE_DIR=\"./app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/iosArm64\"\n\nmkdir -p ${SIMULATOR_RESOURCE_DIR}/composeResources\nmkdir -p ${DEVICE_RESOURCE_DIR}/composeResources\n\nmkdir -p ${SIMULATOR_RESOURCE_DIR}/compose-resources\nmkdir -p ${DEVICE_RESOURCE_DIR}/compose-resources\n\ncp -R ${SIMULATOR_RESOURCE_DIR}/composeResources ${SIMULATOR_RESOURCE_DIR}/compose-resources\ncp -R ${DEVICE_RESOURCE_DIR}/composeResources ${DEVICE_RESOURCE_DIR}/compose-resources\n";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd ${SRCROOT}/../..

./gradlew assembleSharedXCFramework --no-configuration-cache
./gradlew iosSimulatorArm64AggregateResources --no-configuration-cache
./gradlew iosArm64AggregateResources --no-configuration-cache

SIMULATOR_RESOURCE_DIR="./app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/iosSimulatorArm64"
DEVICE_RESOURCE_DIR="./app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/iosArm64"

mkdir -p ${SIMULATOR_RESOURCE_DIR}/composeResources
mkdir -p ${DEVICE_RESOURCE_DIR}/composeResources

mkdir -p ${SIMULATOR_RESOURCE_DIR}/compose-resources
mkdir -p ${DEVICE_RESOURCE_DIR}/compose-resources

cp -R ${SIMULATOR_RESOURCE_DIR}/composeResources ${SIMULATOR_RESOURCE_DIR}/compose-resources
cp -R ${DEVICE_RESOURCE_DIR}/composeResources ${DEVICE_RESOURCE_DIR}/compose-resources

Copy link
Contributor Author

@Corvus400 Corvus400 Aug 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • If the “composeResources” directory is not created in advance, the cp command will fail.
  • Therefore, the mkdir command has been added.

@@ -28,7 +28,7 @@ kotlin {
binaryOption("bundleShortVersionString", version.toString())

val includeToXCF = if (project.properties["app.ios.shared.debug"] == "true") {
this.target.name == "iosSimulatorArm64" && this.debuggable
(this.target.name == "iosSimulatorArm64" && this.debuggable) || (this.target.name == "iosArm64" && this.debuggable)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./gradlew assembleSharedXCFramework --no-configuration-cache -Papp.ios.shared.debug=true

  • The above command brings the simulator and the actual machine into the target.
> Configure project :
Project accessors enabled, but root project name not explicitly set for 'build-logic'. Checking out the project in different folders will impact the generated code and implicitly the buildscript classpath, breaking caching.

> Configure project :app-ios-shared
framework 'debugFramework target iosArm64 (native)' will be in XCFramework
framework 'debugFramework target iosSimulatorArm64 (native)' will be in XCFramework

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that this has a trade-off: when we debug the app, the build takes twice as long. 😭

Copy link
Member

@takahirom takahirom Aug 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using -Papp.ios.shared.debug=false when we want to debug on a device? Will -Papp.ios.shared.debug=false take too much time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takahirom
I see...it is not good to lower the development performance of others just by adding XCFramework on an actual iPhone device. 😔
There are items that are difficult to check without an actual device, so I don't know what to do... 🤔 💭

Copy link
Member

@takahirom takahirom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually have an issue here for deploying iOS app. Thank you for your contribution!

@takahirom takahirom merged commit 5c8483b into DroidKaigi:main Aug 24, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants