-
Notifications
You must be signed in to change notification settings - Fork 83
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
feat(jans-cedarling): create uniffi binding for cedarling with sample ios app using it #10816
Merged
Merged
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
b53e0fd
feat: initial commit for ios binding
duttarnab 5a37e67
feat: commiting remaining files
duttarnab 55aa63d
feat: pushing uniffi-bindgen.rs file
duttarnab 6265650
feat: adding Gluu's copyright and software license
duttarnab 38e73ab
feat: adding android section in README
duttarnab c7a1ae9
feat: restoring python binding
duttarnab c981cd5
feat: update README and add fix to prevent WASM test failure
duttarnab 63121bb
feat: correct typo in README
duttarnab 00ad00d
feat: resolving review comments
duttarnab e3c4099
feat: resolving review comments
duttarnab d0e1f76
feat: adding uniffi binding docs
duttarnab b0d1f64
feat: adding uniffi binding docs
duttarnab de0997d
feat: adding missing files
duttarnab 42b6747
feat: remove unused imports
duttarnab c52bb5c
feat: add demo video in docs
duttarnab 6572058
feat: correct typo
duttarnab b61ed3f
fix: export uniffi::uniffi_bindgen_main
duttarnab b9b1556
fix: export uniffi::uniffi_bindgen_main
duttarnab deae330
fix: fixing wasm build error
duttarnab af9dfe3
fix: fixing wasm build error
duttarnab 9966c04
feat: adding title to logs
duttarnab 989d8ea
feat: resolving clippy error about missing function
duttarnab 65cf3b0
feat: resolving clippy error about missing function
duttarnab 0a6d218
feat: resolving clippy error about missing function
duttarnab 7ea6a3b
Merge branch 'main' into jans-cedarling-issue-9432_2
duttarnab 66d11b8
feat: resolving clippy error about empty line above main function
duttarnab 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
name = "cedarling_native_apps" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate_type = ["cdylib", "staticlib"] | ||
name = "mobile" | ||
|
||
[dependencies] | ||
cedarling = { workspace = true, features = ["blocking"]} | ||
jsonwebtoken = "9.3.0" | ||
openssl = { version = "0.10.35", features = ["vendored"] } | ||
once_cell = "1.20.2" | ||
uniffi = { version = "0.29.0", features = [ "cli" ] } | ||
uniffi_macros = "0.29.0" # Procedural macros support | ||
serde = { workspace = true } | ||
serde_json = { workspace = true } | ||
thiserror.workspace = true | ||
|
||
[dev-dependencies] | ||
# is used in testing | ||
test_utils = { workspace = true } |
rmarinn marked this conversation as resolved.
Show resolved
Hide resolved
|
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,55 @@ | ||
# Cedarling Native Apps | ||
|
||
This module is designed to build cedarling bindings for iOS and android apps. | ||
|
||
## iOS | ||
|
||
### Building | ||
|
||
1. Build the library: | ||
|
||
```bash | ||
cargo build | ||
``` | ||
|
||
In target/debug, you should find the libmobile.dylib file. | ||
|
||
2. Generate the bindings: | ||
|
||
```bash | ||
cargo run --bin uniffi-bindgen generate --library ./target/debug/libmobile.dylib --language swift --out-dir ./bindings/cedarling_native_apps/output | ||
``` | ||
|
||
3. Building the iOS binaries and adding these targets to Rust. | ||
|
||
```bash | ||
rustup target add aarch64-apple-ios-sim aarch64-apple-ios | ||
``` | ||
|
||
4. Build the library for Swift. | ||
|
||
```bash | ||
cargo build --release --target=aarch64-apple-ios-sim | ||
cargo build --release --target=aarch64-apple-ios | ||
``` | ||
|
||
You should have two binaries target/aarch64-apple-ios-sim/release/libmobile.a and target/aarch64-apple-ios/release/libmobile.a. | ||
|
||
5. The XCFramework will allow us to import the library with zero effort in Xcode. First, we need to rename the file ./bindings/cedarling_native_apps/output/mobileFFI.modulemap to ./bindings/cedarling_native_apps/output/module.modulemap. | ||
|
||
Then, we can create the XCFramework: | ||
|
||
```bash | ||
xcodebuild -create-xcframework \ | ||
-library ./target/aarch64-apple-ios-sim/release/libmobile.a -headers ./bindings/cedarling_native_apps/output \ | ||
-library ./target/aarch64-apple-ios/release/libmobile.a -headers ./bindings/cedarling_native_apps/output \ | ||
-output "ios/Mobile.xcframework" | ||
``` | ||
|
||
6. Open ./jans-cedarling/bindings/cedarling_native_apps/iOSApp in Xcode. Import both the XCFramework Mobile.xcframework and the Swift file bindings bindings/Mobile.swift files into your project (drag and drop should work). | ||
|
||
7. Run iOS project on simulator. | ||
|
||
## Android | ||
|
||
- WIP... |
62 changes: 62 additions & 0 deletions
62
jans-cedarling/bindings/cedarling_native_apps/iOSApp/.gitignore
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,62 @@ | ||
# Xcode | ||
# | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
## User settings | ||
xcuserdata/ | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
|
||
## App packaging | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
## Playgrounds | ||
timeline.xctimeline | ||
playground.xcworkspace | ||
|
||
# Swift Package Manager | ||
# | ||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. | ||
# Packages/ | ||
# Package.pins | ||
# Package.resolved | ||
# *.xcodeproj | ||
# | ||
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata | ||
# hence it is not needed unless you have added a package configuration file to your project | ||
# .swiftpm | ||
|
||
.build/ | ||
|
||
# CocoaPods | ||
# | ||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||
# | ||
# Pods/ | ||
# | ||
# Add this line if you want to avoid checking in source code from the Xcode workspace | ||
# *.xcworkspace | ||
|
||
# Carthage | ||
# | ||
# Add this line if you want to avoid checking in source code from Carthage dependencies. | ||
# Carthage/Checkouts | ||
|
||
Carthage/Build/ | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. | ||
# Instead, use fastlane to re-generate the screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/#source-control | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots/**/*.png | ||
fastlane/test_output |
Oops, something went wrong.
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.
To avoid error in compile
wasm
tests you can useinstead of
[dependencies]
like hereand don't forget to add this in
lib.rs
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.
done