-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
backend: add packaging scripts for iOS #352
Merged
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
## Backend tools | ||
|
||
This folder contains a few helper scripts meant to automatize some tasks such as packaging. | ||
|
||
### package_backend_framework | ||
|
||
This script makes a fat binary out of the `backend.framework` iOS framework, containing | ||
architectures for iOS and those for the iOS simulator. It requires the builds for the | ||
`ios` and `ios_simulator` targets to have completed successfully. | ||
|
||
It can therefore be run from a macOS system with the following commands: | ||
|
||
|
||
``` | ||
make BUILD_BACKEND=YES | ||
make BUILD_BACKEND=YES ios | ||
make BUILD_BACKEND=YES ios_simulator | ||
bash package_backend_framework.bash | ||
``` | ||
|
||
The resulting fat binary will be generated in `./build/fat_bin/`. | ||
|
||
### push_backend_framework_to_s3 | ||
|
||
This script pushes the `dronecode-backend.zip` archive generated by _package_backend_framework.bash_ | ||
to amazon s3, under the name `dronecode-backend-latest.zip`. | ||
|
||
It requires the `awscli` binary, that can be installed from homebrew: | ||
|
||
``` | ||
brew install awscli | ||
``` | ||
|
||
Documentation about the s3 commands can be found [here](https://docs.aws.amazon.com/cli/latest/reference/s3/). | ||
|
||
Obviously, the script requires the backend fat binary to be built, meaning the following commands: | ||
|
||
``` | ||
make BUILD_BACKEND=YES | ||
make BUILD_BACKEND=YES ios | ||
make BUILD_BACKEND=YES ios_simulator | ||
bash package_backend_framework.bash | ||
bash push_backend_framework_to_s3.bash | ||
``` |
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,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
IOS_BACKEND_DIR=${SCRIPT_DIR}/../../build/ios/backend/src | ||
IOS_SIM_BACKEND_DIR=${SCRIPT_DIR}/../../build/ios_simulator/backend/src | ||
FAT_BIN_DIR=${SCRIPT_DIR}/../../build/fat_bin | ||
|
||
mkdir -p ${FAT_BIN_DIR} | ||
|
||
if [ -d ${FAT_BIN_DIR}/backend.framework ]; then | ||
echo "${FAT_BIN_DIR}/backend.framework already exists! Aborting..." | ||
exit 1 | ||
fi | ||
|
||
if [ -f ${FAT_BIN_DIR}/dronecode-backend.zip ]; then | ||
echo "${FAT_BIN_DIR}/dronecode-backend.zip already exists! Aborting..." | ||
exit 1 | ||
fi | ||
|
||
cp -r ${IOS_BACKEND_DIR}/backend.framework ${FAT_BIN_DIR} | ||
lipo ${IOS_BACKEND_DIR}/backend.framework/backend ${IOS_SIM_BACKEND_DIR}/backend.framework/backend -create -output ${FAT_BIN_DIR}/backend.framework/backend | ||
|
||
cd ${FAT_BIN_DIR} | ||
zip -9 -r dronecode-backend.zip backend.framework |
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,9 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
FAT_BIN_DIR=${SCRIPT_DIR}/../../build/fat_bin | ||
|
||
aws s3 cp ${FAT_BIN_DIR}/dronecode-backend.zip s3://dronecode-sdk/dronecode-backend-latest.zip | ||
aws s3api put-object-acl --bucket dronecode-sdk --key dronecode-backend-latest.zip --acl public-read |
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.
Would be good to add a comment what this requires, e.g. the aws cli tool, and how to set the key, etc.
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.
Good point, I added a README explaining the purpose of the scripts and how to run them. I did not add documentation on how to actually use
awscli
, as the amazon documentation is very good for that (once you know which commands you want to use) :-).