-
Notifications
You must be signed in to change notification settings - Fork 4
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
Generate binds to Android and iOS #51
Conversation
# Conflicts: # .github/workflows/publish-ios.yaml
Important Review skippedReview was skipped due to path filters Files ignored due to path filters (1)
You can disable this status message by setting the WalkthroughThe recent changes introduce automated workflows for publishing Android and iOS packages upon new releases. Additionally, new configuration files for Rust and Gradle are established, along with various scripts that streamline the setup and cleaning of build environments for both platforms, enhancing the organization of the development workflow. Changes
Poem
TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add Documentation and Community
|
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.
Actionable comments posted: 5
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (2)
Cargo.lock
is excluded by!**/*.lock
packages/kos-mobile/android/gradle/wrapper/gradle-wrapper.jar
is excluded by!**/*.jar
Files selected for processing (31)
- .github/workflows/publish-android.yaml (1 hunks)
- .github/workflows/publish-ios.yaml (1 hunks)
- Cargo.toml (2 hunks)
- Makefile (1 hunks)
- packages/kos-mobile/Cargo.toml (1 hunks)
- packages/kos-mobile/android/.gitignore (1 hunks)
- packages/kos-mobile/android/build.gradle.kts (1 hunks)
- packages/kos-mobile/android/gradle.properties (1 hunks)
- packages/kos-mobile/android/gradle/libs.versions.toml (1 hunks)
- packages/kos-mobile/android/gradle/wrapper/gradle-wrapper.properties (1 hunks)
- packages/kos-mobile/android/gradlew (1 hunks)
- packages/kos-mobile/android/gradlew.bat (1 hunks)
- packages/kos-mobile/android/lib/build.gradle.kts (1 hunks)
- packages/kos-mobile/android/lib/src/main/AndroidManifest.xml (1 hunks)
- packages/kos-mobile/android/lib/src/test/kotlin/uniffi/kos_mobile/KOSTest.kt (1 hunks)
- packages/kos-mobile/android/settings.gradle.kts (1 hunks)
- packages/kos-mobile/build_android.sh (1 hunks)
- packages/kos-mobile/build_clean.sh (1 hunks)
- packages/kos-mobile/build_ios.sh (1 hunks)
- packages/kos-mobile/build_source.sh (1 hunks)
- packages/kos-mobile/ios/.gitignore (1 hunks)
- packages/kos-mobile/ios/framework/.gitignore (1 hunks)
- packages/kos-mobile/ios/framework/KOSMobile/KOSMobile.xcodeproj/project.pbxproj (1 hunks)
- packages/kos-mobile/ios/framework/KOSMobile/KOSMobile.xcodeproj/xcshareddata/xcschemes/KOSMobile.xcscheme (1 hunks)
- packages/kos-mobile/ios/framework/KOSMobile/KOSMobile/KOSMobile.h (1 hunks)
- packages/kos-mobile/ios/framework/KOSMobile/KOSMobileTests/KOSMobileTests.swift (1 hunks)
- packages/kos-mobile/src/bin/uniffi-bindgen.rs (1 hunks)
- packages/kos-mobile/src/lib.rs (1 hunks)
- packages/kos-sdk/Cargo.toml (1 hunks)
- packages/kos-sdk/src/chain.rs (3 hunks)
- packages/kos-types/Cargo.toml (1 hunks)
Files skipped from review due to trivial changes (11)
- packages/kos-mobile/android/.gitignore
- packages/kos-mobile/android/build.gradle.kts
- packages/kos-mobile/android/gradle.properties
- packages/kos-mobile/android/gradle/wrapper/gradle-wrapper.properties
- packages/kos-mobile/android/gradlew.bat
- packages/kos-mobile/android/lib/src/main/AndroidManifest.xml
- packages/kos-mobile/ios/.gitignore
- packages/kos-mobile/ios/framework/.gitignore
- packages/kos-mobile/ios/framework/KOSMobile/KOSMobile.xcodeproj/project.pbxproj
- packages/kos-mobile/ios/framework/KOSMobile/KOSMobile/KOSMobile.h
- packages/kos-mobile/src/bin/uniffi-bindgen.rs
Additional context used
Gitleaks
packages/kos-mobile/android/lib/src/test/kotlin/uniffi/kos_mobile/KOSTest.kt
21-21: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
packages/kos-mobile/ios/framework/KOSMobile/KOSMobileTests/KOSMobileTests.swift
22-22: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
packages/kos-mobile/src/lib.rs
210-210: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
SwiftLint
packages/kos-mobile/ios/framework/KOSMobile/KOSMobileTests/KOSMobileTests.swift
[Error] 30-30: Force tries should be avoided
(force_try)
[Error] 33-33: Force tries should be avoided
(force_try)
[Error] 36-36: Force tries should be avoided
(force_try)
[Error] 39-39: Force tries should be avoided
(force_try)
[Error] 42-42: Force tries should be avoided
(force_try)
[Error] 45-45: Force tries should be avoided
(force_try)
[Error] 48-48: Force tries should be avoided
(force_try)
[Error] 51-51: Force tries should be avoided
(force_try)
[Error] 54-54: Force tries should be avoided
(force_try)
[Error] 61-61: Force tries should be avoided
(force_try)
actionlint
.github/workflows/publish-ios.yaml
57-57: shellcheck reported issue in this script: SC2155:warning:3:8: Declare and assign separately to avoid masking return values
(shellcheck)
Shellcheck
packages/kos-mobile/build_source.sh
[warning] 7-7: OS_TOOLCHAIN appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 10-10: ANDROID_JNI_LIBS_PATH appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 11-11: ANDROID_GENERATED_BINDS_PATH appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 13-13: ANDROID_ARCHS appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 14-14: ANDROID_TOOLCHAINS appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 15-15: ANDROID_JNI appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 19-19: IOS_ARCHS appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 20-20: PACKAGE_NAME appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 23-23: ANDROID appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 24-24: IOS appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 92-92: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
(SC2164)
Additional comments not posted (83)
packages/kos-mobile/android/gradle/libs.versions.toml (3)
1-5
: LGTM!The versions specified are appropriate and up-to-date.
The code changes are approved.
7-9
: LGTM!The libraries specified are appropriate and correctly referenced.
The code changes are approved.
11-13
: LGTM!The plugins specified are appropriate and correctly referenced.
The code changes are approved.
packages/kos-mobile/build_clean.sh (3)
8-11
: LGTM!The function is correctly implemented and removes the specified directories.
The code changes are approved.
13-19
: LGTM!The function is correctly implemented and removes the specified directories.
The code changes are approved.
21-26
: LGTM!The commands are correctly implemented and provide clear logging.
The code changes are approved.
packages/kos-mobile/android/settings.gradle.kts (3)
3-14
: LGTM!The repositories specified are appropriate and correctly referenced.
The code changes are approved.
16-21
: LGTM!The repositories and mode specified are appropriate and correctly referenced.
The code changes are approved.
24-25
: LGTM!The project settings specified are appropriate and correctly referenced.
The code changes are approved.
.github/workflows/publish-android.yaml (3)
1-4
: LGTM!The workflow name and trigger are appropriate.
The code changes are approved.
5-10
: LGTM!The job configuration is appropriate.
The code changes are approved.
22-26
: LGTM!The steps for publishing the package are appropriate.
The code changes are approved.
packages/kos-mobile/Cargo.toml (1)
1-32
: LGTM!The addition of the new package
kos-mobile
is appropriate. The dependencies and build dependencies are correctly specified. The binary target foruniffi-bindgen
is correctly configured.The code changes are approved.
packages/kos-sdk/Cargo.toml (1)
43-44
: LGTM!The addition of the
lazy_static
crate is appropriate and does not introduce any immediate issues.The code changes are approved.
Makefile (6)
39-41
: LGTM!The
clean-mobile-build
target is correctly implemented.The code changes are approved.
42-44
: LGTM!The
build-android
target is correctly implemented.The code changes are approved.
45-47
: LGTM!The
publish-android
target is correctly implemented.The code changes are approved.
48-50
: LGTM!The
build-ios
target is correctly implemented.The code changes are approved.
51-59
: LGTM!The
test-ios
target is correctly implemented.The code changes are approved.
60-61
: LGTM!The
test-android
target is correctly implemented.The code changes are approved.
Cargo.toml (3)
9-9
: LGTM!The addition of the new member
packages/kos-mobile
is appropriate and does not introduce any immediate issues.The code changes are approved.
45-46
: LGTM!The addition of the
uniffi
dependency is appropriate and does not introduce any immediate issues.The code changes are approved.
54-55
: LGTM!The addition of the
lazy_static
andthiserror
dependencies is appropriate and does not introduce any immediate issues.The code changes are approved.
packages/kos-mobile/android/lib/build.gradle.kts (6)
1-8
: LGTM!The imports and plugins are appropriate for the build configuration.
The code changes are approved.
10-11
: LGTM!The group and version configuration is appropriate for the build setup.
The code changes are approved.
13-34
: LGTM!The android configuration is appropriate and follows best practices.
The code changes are approved.
36-39
: LGTM!The dependencies are appropriate for the project.
The code changes are approved.
41-63
: LGTM!The publishing configuration is appropriate and follows best practices.
The code changes are approved.
65-84
: LGTM!The custom tasks and utility functions are appropriately defined.
The code changes are approved.
packages/kos-mobile/android/lib/src/test/kotlin/uniffi/kos_mobile/KOSTest.kt (6)
10-28
: LGTM!The test cases for
validateMnemonic
are appropriate and cover both valid and invalid scenarios.The code changes are approved.
Tools
Gitleaks
21-21: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
30-34
: LGTM!The test cases for
generateMnemonic
are appropriate and cover different word counts.The code changes are approved.
36-37
: LGTM!The test case for
encryptWithGmc
is appropriate and checks for non-empty encrypted data.The code changes are approved.
39-40
: LGTM!The test case for
encryptWithCbc
is appropriate and checks for non-empty encrypted data.The code changes are approved.
42-43
: LGTM!The test case for
encryptWithCfb
is appropriate and checks for non-empty encrypted data.The code changes are approved.
45-66
: LGTM!The test cases for
decrypt
,generateWalletFromMnemonic
, andgenerateWalletFromPrivateKey
are appropriate and cover different scenarios.The code changes are approved.
packages/kos-mobile/ios/framework/KOSMobile/KOSMobile.xcodeproj/xcshareddata/xcschemes/KOSMobile.xcscheme (6)
1-4
: LGTM!The metadata is appropriate for the Xcode scheme.
The code changes are approved.
5-24
: LGTM!The build action configuration is appropriate for the Xcode scheme.
The code changes are approved.
25-44
: LGTM!The test action configuration is appropriate for the Xcode scheme.
The code changes are approved.
45-55
: LGTM!The launch action configuration is appropriate for the Xcode scheme.
The code changes are approved.
56-71
: LGTM!The profile action configuration is appropriate for the Xcode scheme.
The code changes are approved.
72-78
: LGTM!The analyze and archive action configurations are appropriate for the Xcode scheme.
The code changes are approved.
packages/kos-mobile/build_ios.sh (5)
8-13
: LGTM!The function correctly configures cargo for the specified iOS architectures.
The code changes are approved.
15-22
: LGTM!The function correctly assembles the iOS library for the specified architecture and renames the output file.
The code changes are approved.
24-29
: LGTM!The function correctly generates the iOS bindings using
uniffi-bindgen
and places them in the specified directory.The code changes are approved.
31-83
: LGTM!The function correctly generates the XCFramework for the specified iOS architectures and handles both device and simulator builds.
The code changes are approved.
85-97
: LGTM!The main script logic correctly orchestrates the build process for iOS libraries and bindings.
The code changes are approved.
.github/workflows/publish-ios.yaml (4)
2-4
: LGTM!The step correctly specifies the trigger for the workflow on release creation.
The code changes are approved.
5-6
: LGTM!The step correctly specifies the required permissions for the workflow.
The code changes are approved.
8-37
: LGTM!The job correctly specifies the steps for building, testing, generating checksums, and uploading the XCFramework.
The code changes are approved.
39-91
: LGTM!The job correctly specifies the steps for updating the Swift package URL and checksum, committing changes, and creating a release.
The code changes are approved.
Tools
actionlint
57-57: shellcheck reported issue in this script: SC2155:warning:3:8: Declare and assign separately to avoid masking return values
(shellcheck)
packages/kos-mobile/build_android.sh (5)
8-22
: LGTM!The function is correctly implemented.
The code changes are approved.
24-40
: LGTM!The function is correctly implemented.
The code changes are approved.
42-50
: LGTM!The function is correctly implemented.
The code changes are approved.
52-60
: LGTM!The function is correctly implemented.
The code changes are approved.
62-80
: LGTM!The script is correctly implemented.
The code changes are approved.
packages/kos-mobile/build_source.sh (7)
29-35
: LGTM!The function is correctly implemented.
The code changes are approved.
37-43
: LGTM!The function is correctly implemented.
The code changes are approved.
45-47
: LGTM!The function is correctly implemented.
The code changes are approved.
49-51
: LGTM!The function is correctly implemented.
The code changes are approved.
53-67
: LGTM!The function is correctly implemented.
The code changes are approved.
69-86
: LGTM!The function is correctly implemented.
The code changes are approved.
88-116
: LGTM!The function is correctly implemented.
The code changes are approved.
Tools
Shellcheck
[warning] 92-92: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
(SC2164)
packages/kos-mobile/android/gradlew (5)
3-17
: LGTM!The license information is correctly included.
The code changes are approved.
25-45
: LGTM!The environment setup is correctly implemented.
The code changes are approved.
46-122
: LGTM!The JVM options and file descriptor limits are correctly implemented.
The code changes are approved.
63-173
: LGTM!The OS-specific support and path conversion logic are correctly implemented.
The code changes are approved.
175-185
: LGTM!The application arguments and execution logic are correctly implemented.
The code changes are approved.
packages/kos-sdk/src/chain.rs (2)
69-71
: LGTM!The function is correctly implemented and makes appropriate use of the
CHAIN_MAP
static variable.The code changes are approved.
73-75
: LGTM!The function is correctly implemented and provides a way to access all chain mappings.
The code changes are approved.
packages/kos-mobile/src/lib.rs (14)
47-49
: LGTM!The function is correctly implemented and handles errors appropriately.
The code changes are approved.
52-54
: LGTM!The function is correctly implemented and returns a boolean indicating the validity of the mnemonic.
The code changes are approved.
57-72
: LGTM!The function is correctly implemented and handles errors appropriately. It makes use of the
get_chain_by
function to retrieve the chain and constructs aKOSAccount
struct.The code changes are approved.
75-87
: LGTM!The function is correctly implemented and handles errors appropriately. It makes use of the
get_chain_by
function to retrieve the chain and constructs aKOSAccount
struct.The code changes are approved.
90-93
: LGTM!The function is correctly implemented and handles errors appropriately. It makes use of the
CipherAlgo::GMC
to perform the encryption.The code changes are approved.
96-99
: LGTM!The function is correctly implemented and handles errors appropriately. It makes use of the
CipherAlgo::CBC
to perform the encryption.The code changes are approved.
102-105
: LGTM!The function is correctly implemented and handles errors appropriately. It makes use of the
CipherAlgo::CFB
to perform the encryption.The code changes are approved.
108-112
: LGTM!The function is correctly implemented and handles errors appropriately. It makes use of the
cipher::decrypt
function to perform the decryption.The code changes are approved.
114-119
: LGTM!The function is correctly implemented and handles errors appropriately. It makes use of the
Chain::get_by_code
function to retrieve the chain.The code changes are approved.
37-44
: LGTM!The struct is correctly implemented and follows the
uniffi::Record
trait.The code changes are approved.
15-23
: LGTM!The enum is correctly implemented and follows the
thiserror::Error
anduniffi::Error
traits.The code changes are approved.
25-35
: LGTM!The impl block is correctly implemented and handles the conversions appropriately.
The code changes are approved.
13-13
: LGTM!The macro is correctly used to set up the Uniffi scaffolding.
The code changes are approved.
121-267
: LGTM!The test functions are correctly implemented and cover various scenarios, including success and failure cases.
The code changes are approved.
Tools
Gitleaks
210-210: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
packages/kos-mobile/ios/framework/KOSMobile/KOSMobileTests/KOSMobileTests.swift
Show resolved
Hide resolved
packages/kos-mobile/ios/framework/KOSMobile/KOSMobileTests/KOSMobileTests.swift
Show resolved
Hide resolved
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- packages/kos-mobile/src/bin/uniffi-bindgen.rs (1 hunks)
- packages/kos-mobile/src/lib.rs (1 hunks)
- packages/kos-sdk/src/chain.rs (3 hunks)
Files skipped from review due to trivial changes (2)
- packages/kos-mobile/src/bin/uniffi-bindgen.rs
- packages/kos-mobile/src/lib.rs
Files skipped from review as they are similar to previous changes (1)
- packages/kos-sdk/src/chain.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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- packages/kos-mobile/src/lib.rs (1 hunks)
- packages/kos-sdk/src/chains/bitcoin/transaction.rs (1 hunks)
Files skipped from review due to trivial changes (1)
- packages/kos-sdk/src/chains/bitcoin/transaction.rs
Files skipped from review as they are similar to previous changes (1)
- packages/kos-mobile/src/lib.rs
Description
This pull request configures the Uniffi library from mozilla/uniffi-rs to generate bindings for both Android and iOS from the Rust code in this repository. The configuration was done using Procedural Macros, eliminating the need for a UDL file.
A new module named kos-mobile was created, which generates the necessary code for both Android and iOS. In this module, functions with signatures compatible with Uniffi were implemented. Additionally, tests were conducted for these functions within Rust, as well as for the iOS and Android libraries.
Summary by CodeRabbit
New Features
kos-mobile
package, integrating new dependencies and build configurations for improved functionality.Bug Fixes
Documentation
.gitignore
files for Android and iOS projects to maintain a clean repository by excluding unnecessary files.Chores