-
Notifications
You must be signed in to change notification settings - Fork 200
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
Refactor KMP iOS build #796
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8cecfea
Refactor KMP iOS build
takahirom 788b2d0
Fix mkdir script
takahirom 9511c8c
Fix ARM_SIMULATOR target
takahirom 909cb0a
Remove unneeded reference
takahirom 1c717d7
Not override when X64_RESOURCE_DIR is empty
takahirom e22a560
Add activeArch log
takahirom 2dff6bc
Use arm64SimulatorDebug instead of arm64Simulator
takahirom 07b3093
Remove unneeded filter
takahirom b9f6702
Fix to use project property
takahirom a26f59b
Add cases
takahirom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
objects = { | ||
|
||
/* Begin PBXBuildFile section */ | ||
830BFA7C2C74EBF40017A600 /* compose-resources in Resources */ = {isa = PBXBuildFile; fileRef = 830BFA7B2C74EBF40017A600 /* compose-resources */; }; | ||
83CD07FE2C7B1F5400CDEFDB /* compose-resources in Resources */ = {isa = PBXBuildFile; fileRef = 83CD07FD2C7B1F5400CDEFDB /* compose-resources */; }; | ||
8C31F46B2BF6909A003F1BBA /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8C31F46A2BF6909A003F1BBA /* GoogleService-Info.plist */; }; | ||
8C7074772C7791BD00FD4F39 /* ci_post_clone.sh in Resources */ = {isa = PBXBuildFile; fileRef = 8C7074762C7791BD00FD4F39 /* ci_post_clone.sh */; }; | ||
8C7074792C7791DF00FD4F39 /* ci_pre_xcodebuild.sh in Resources */ = {isa = PBXBuildFile; fileRef = 8C7074782C7791DF00FD4F39 /* ci_pre_xcodebuild.sh */; }; | ||
|
@@ -18,7 +18,7 @@ | |
/* End PBXBuildFile section */ | ||
|
||
/* Begin PBXFileReference section */ | ||
830BFA7B2C74EBF40017A600 /* compose-resources */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "compose-resources"; path = "../../app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/iosSimulatorArm64/compose-resources"; sourceTree = "<group>"; }; | ||
83CD07FD2C7B1F5400CDEFDB /* compose-resources */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "compose-resources"; path = "../../app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/compose-resources"; sourceTree = "<group>"; }; | ||
8C31F46A2BF6909A003F1BBA /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; }; | ||
8C7074762C7791BD00FD4F39 /* ci_post_clone.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = ci_post_clone.sh; sourceTree = "<group>"; }; | ||
8C7074782C7791DF00FD4F39 /* ci_pre_xcodebuild.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = ci_pre_xcodebuild.sh; sourceTree = "<group>"; }; | ||
|
@@ -57,8 +57,8 @@ | |
8C772B0C2BCBCBCA00F2BADC = { | ||
isa = PBXGroup; | ||
children = ( | ||
83CD07FD2C7B1F5400CDEFDB /* compose-resources */, | ||
8C7074752C77919300FD4F39 /* ci_scripts */, | ||
830BFA7B2C74EBF40017A600 /* compose-resources */, | ||
C412816C2C149FB500B458D1 /* DroidKaigi2024App-Info.plist */, | ||
8C7DACC22BCBD111002C298A /* App */, | ||
8C7DACC12BCBD0F1002C298A /* app-ios */, | ||
|
@@ -171,7 +171,7 @@ | |
8C7DACB72BCBCCB0002C298A /* Preview Assets.xcassets in Resources */, | ||
8C31F46B2BF6909A003F1BBA /* GoogleService-Info.plist in Resources */, | ||
8C7074772C7791BD00FD4F39 /* ci_post_clone.sh in Resources */, | ||
830BFA7C2C74EBF40017A600 /* compose-resources in Resources */, | ||
83CD07FE2C7B1F5400CDEFDB /* compose-resources in Resources */, | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
}; | ||
|
@@ -194,7 +194,7 @@ | |
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
shellPath = /bin/zsh; | ||
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"; | ||
shellScript = "cd ${SRCROOT}/../..\n\n./build_xcframework_with_xcode_environment_variable.sh\n./gradlew iosSimulatorArm64AggregateResources --no-configuration-cache\n./gradlew iosX64AggregateResources --no-configuration-cache\n\nARM_RESOURCE_DIR=\"./app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/iosSimulatorArm64\"\nX64_RESOURCE_DIR=\"./app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/iosX64\"\nRESOURCE_DIR=\"./app-ios-shared/build/kotlin-multiplatform-resources/aggregated-resources/compose-resources\"\n\nmkdir -p ${ARM_RESOURCE_DIR}/composeResources\nmkdir -p ${X64_RESOURCE_DIR}/composeResources\n\nmkdir -p ${RESOURCE_DIR}\n\ncp -R ${ARM_RESOURCE_DIR}/composeResources ${RESOURCE_DIR}\n\n# Check if X64 resources exist and are not empty\nif [ -d \"${X64_RESOURCE_DIR}/composeResources\" ] && [ \"$(ls -A \"${X64_RESOURCE_DIR}/composeResources\")\" ]; then\n # Copy X64 resources\n cp -R \"${X64_RESOURCE_DIR}/composeResources\" \"${RESOURCE_DIR}\"\nelse\n echo \"Warning: X64_RESOURCE_DIR is empty or does not exist. Skipping X64 resource copy.\"\nfi\n"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current script is like this
|
||
}; | ||
/* End PBXShellScriptBuildPhase section */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,13 @@ build-kmp-module: | |
cd .. && \ | ||
./gradlew app-ios-shared:assembleSharedXCFramework --no-configuration-cache | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now build-kmp-module build all architectures. |
||
|
||
.PHONY: build-kmp-module-debug | ||
build-kmp-module-debug: | ||
cd .. && \ | ||
./gradlew app-ios-shared:assembleSharedXCFramework -Papp.ios.shared.arch=arm64SimulatorDebug --no-configuration-cache | ||
|
||
.PHONY: build-app-debug | ||
build-app-debug: build-kmp-module | ||
build-app-debug: build-kmp-module-debug | ||
set -o pipefail && \ | ||
xcodebuild -project $(PROJECT_FILE) \ | ||
-scheme $(SCHEME_NAME_APP) \ | ||
|
@@ -39,7 +44,7 @@ test-app-debug: | |
.PHONY: bootstrap | ||
bootstrap: | ||
make setup && \ | ||
make build-kmp-module && \ | ||
make build-kmp-module-debug && \ | ||
make open | ||
|
||
# Gradle Utility | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# Check if SDK_NAME and ARCHS environment variables are set | ||
if [ -z "$SDK_NAME" ] || [ -z "$ARCHS" ]; then | ||
echo "Error: SDK_NAME or ARCHS environment variable is not set" | ||
exit 1 | ||
fi | ||
|
||
# Initialize the target architecture | ||
target_arch="" | ||
|
||
# Determine the target architecture based on SDK_NAME and ARCHS | ||
if [[ "$SDK_NAME" == *"simulator"* ]]; then | ||
if [[ "$ARCHS" == *"arm64"* ]]; then | ||
target_arch="arm64SimulatorDebug" | ||
elif [[ "$ARCHS" == *"x86_64"* ]]; then | ||
target_arch="x86_64" | ||
fi | ||
elif [[ "$SDK_NAME" == *"iphoneos"* ]] && [[ "$ARCHS" == *"arm64"* ]]; then | ||
target_arch="arm64" | ||
fi | ||
|
||
# Check if a valid target architecture was determined | ||
if [ -z "$target_arch" ]; then | ||
echo "Error: Unable to determine target architecture from SDK_NAME=$SDK_NAME and ARCHS=$ARCHS" | ||
exit 1 | ||
fi | ||
|
||
# Execute Gradle command with the determined architecture | ||
echo "Building for architecture: $target_arch" | ||
./gradlew assembleSharedXCFramework --no-configuration-cache -Papp.ios.shared.arch=$target_arch | ||
|
||
echo "Build completed for $target_arch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current resource is like this