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

[WIP][Codegen] Generate Kotlin Multiplatform bindings #3177

Draft
wants to merge 55 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e13ab17
init kotlin
lamafab May 11, 2023
8f5f30b
add templte for JNI java struct/class
lamafab May 11, 2023
8881042
add condition for is_public
lamafab May 11, 2023
32ebe1c
create template for JNI java struct
lamafab May 11, 2023
89b0fa5
add template for andorid header file
lamafab May 11, 2023
2cacb20
add template for kotlin androidmain struct
lamafab May 11, 2023
5081047
deprecate jni files
lamafab May 15, 2023
773c504
expand kotlin multilanguage templating, convert indices to spaces
lamafab May 15, 2023
717d6be
add AndroidMain structures including KotlinType
lamafab May 15, 2023
c4d364a
format and derive KotlinType
lamafab May 15, 2023
42fb901
render AndroidMain inits
lamafab May 15, 2023
c5f3151
implement process_android_main_function, add createFromNative in temp…
lamafab May 15, 2023
420512e
expand kotlin::render, process structs
lamafab May 16, 2023
03b058a
implement render_to_strings for android main kotlin
lamafab May 16, 2023
f997208
move swift tests to submodule
lamafab May 16, 2023
5a18921
change directory structure of tests
lamafab May 16, 2023
5f725eb
add androidmain_single_struct test
lamafab May 16, 2023
e413a5b
add single_class test, track output check files
lamafab May 16, 2023
41fb52f
add test androidmain_optional
lamafab May 16, 2023
ce00966
add support for enums, add unit test
lamafab May 16, 2023
ef95109
test enum with descriptions
lamafab May 16, 2023
41fd57e
set correct type for fromValue method
lamafab May 16, 2023
557d6b2
test enums with methods
lamafab May 16, 2023
cea8e4a
remove static_methods field, use single methods field instead, update…
lamafab May 16, 2023
ed32fd1
track commom_main_struct.hbs
lamafab May 16, 2023
816bccb
start with kotlin cli command for rendering
lamafab May 17, 2023
be68d59
add properties to enums
lamafab May 17, 2023
c0633df
create primitives_android_main and primitives_common_main submodules
lamafab May 18, 2023
e150426
add multiplatform structures to rendered Kotlin output
lamafab May 18, 2023
1b34100
update output dirs in main
lamafab May 18, 2023
35be7ba
render common main structs, update template
lamafab May 18, 2023
a7e84d4
render common main enums, add template
lamafab May 18, 2023
eced6b0
Merge branch 'kotlin-submodule' into codegen-v2-kotlin
lamafab May 18, 2023
8ac7baa
add special handler for TWHDVersion
lamafab May 18, 2023
10bea0d
update manifest with comments
lamafab May 18, 2023
a37a61e
update HDVersion variants in manifest
lamafab May 18, 2023
9a1c8db
replicate existing Swift bindings, update manifest
lamafab May 18, 2023
c52161c
add description property to enums if appropriate
lamafab May 18, 2023
8466339
uppercase first character of enum variant name
lamafab May 18, 2023
0075979
also add empty string if enum description
lamafab May 18, 2023
10d3dcb
typo
lamafab May 19, 2023
cb44f92
update iosmain template, add primitive structs
lamafab May 22, 2023
df9ccef
add TWBitcoinScriptLockScriptForAddressReplay to manifest
lamafab Jun 27, 2023
7e16953
update TWBlockchain variant
lamafab Jun 27, 2023
852a0c0
update TWCoinType
lamafab Jun 27, 2023
0a4c1c1
update HDVersion
lamafab Jun 27, 2023
b8b4801
update TWHash
lamafab Jun 27, 2023
7519298
add TWSubstrateAddress
lamafab Jun 27, 2023
4de9513
add TWSubstrateSigner
lamafab Jun 27, 2023
6f1d1a9
add TWTransactionCompilerCompileWithSignaturesAndPubKeyType
lamafab Jun 27, 2023
82e75c8
fix is_nullable in SubstrateAddress yaml
lamafab Jun 29, 2023
a991f3b
temporarily add gen commands to tools/generate-files
lamafab Jun 29, 2023
ad4885e
delete previously generated files on each generate-files run
lamafab Jun 29, 2023
b238a22
add 'u' suffix to enum values
lamafab Jun 29, 2023
333d2ed
handle parsing and generation of iosMain bindings
lamafab Jun 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 28 additions & 38 deletions codegen-v2/manifest/TWAES.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ structs:
fields:
- - unused
- variant: u_int8_t
is_constant: false
is_nullable: false
is_pointer: false
comments:
- AES encryption/decryption methods.
functions:
- name: TWAESEncryptCBC
is_public: true
Expand All @@ -17,118 +17,108 @@ functions:
- name: key
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: data
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: iv
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: mode
type:
variant: enum
value: TWAESPaddingMode
is_constant: false
is_nullable: false
is_pointer: false
return_type:
variant: data
is_constant: true
is_nullable: true
is_pointer: true
comments:
- Encrypts a block of Data using AES in Cipher Block Chaining (CBC) mode.
- \param key encryption key Data, must be 16, 24, or 32 bytes long.
- \param data Data to encrypt.
- \param iv initialization vector.
- \param mode padding mode.
- \return encrypted Data.
- name: TWAESDecryptCBC
is_public: true
is_static: true
params:
- name: key
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: data
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: iv
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: mode
type:
variant: enum
value: TWAESPaddingMode
is_constant: false
is_nullable: false
is_pointer: false
return_type:
variant: data
is_constant: true
is_nullable: true
is_pointer: true
comments:
- Decrypts a block of data using AES in Cipher Block Chaining (CBC) mode.
- \param key decryption key Data, must be 16, 24, or 32 bytes long.
- \param data Data to decrypt.
- \param iv initialization vector Data.
- \param mode padding mode.
- \return decrypted Data.
- name: TWAESEncryptCTR
is_public: true
is_static: true
params:
- name: key
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: data
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: iv
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
return_type:
variant: data
is_constant: true
is_nullable: true
is_pointer: true
comments:
- Encrypts a block of data using AES in Counter (CTR) mode.
- \param key encryption key Data, must be 16, 24, or 32 bytes long.
- \param data Data to encrypt.
- \param iv initialization vector Data.
- \return encrypted Data.
- name: TWAESDecryptCTR
is_public: true
is_static: true
params:
- name: key
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: data
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
- name: iv
type:
variant: data
is_constant: true
is_nullable: false
is_pointer: true
return_type:
variant: data
is_constant: true
is_nullable: true
is_pointer: true
comments:
- Decrypts a block of data using AES in Counter (CTR) mode.
- \param key decryption key Data, must be 16, 24, or 32 bytes long.
- \param data Data to decrypt.
- \param iv initialization vector Data.
- \return decrypted Data.
2 changes: 2 additions & 0 deletions codegen-v2/manifest/TWAESPaddingMode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ enums:
value: 0
- name: pkcs7
value: 1
comments:
- Padding mode used in AES encryption.
57 changes: 33 additions & 24 deletions codegen-v2/manifest/TWAccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ structs:
- name: TWAccount
is_public: true
is_class: true
comments:
- Represents an Account in C++ with address, coin type and public key info, an item within a keystore.
inits:
- name: TWAccountCreate
is_public: true
Expand All @@ -11,85 +13,92 @@ inits:
- name: address
type:
variant: string
is_constant: true
is_nullable: false
is_pointer: true
- name: coin
type:
variant: enum
value: TWCoinType
is_constant: false
is_nullable: false
is_pointer: false
- name: derivation
type:
variant: enum
value: TWDerivation
is_constant: false
is_nullable: false
is_pointer: false
- name: derivationPath
type:
variant: string
is_constant: true
is_nullable: false
is_pointer: true
- name: publicKey
type:
variant: string
is_constant: true
is_nullable: false
is_pointer: true
- name: extendedPublicKey
type:
variant: string
is_constant: true
is_nullable: false
is_pointer: true
comments:
- Creates a new Account with an address, a coin type, derivation enum, derivationPath, publicKey,
- and extendedPublicKey. Must be deleted with TWAccountDelete after use.
- \param address The address of the Account.
- \param coin The coin type of the Account.
- \param derivation The derivation of the Account.
- \param derivationPath The derivation path of the Account.
- \param publicKey hex encoded public key.
- \param extendedPublicKey Base58 encoded extended public key.
- \return A new Account.
deinits:
- name: TWAccountDelete
comments:
- Deletes an account.
- \param account Account to delete.
properties:
- name: TWAccountAddress
is_public: true
return_type:
variant: string
is_constant: true
is_nullable: false
is_pointer: true
comments:
- Returns the address of an account.
- \param account Account to get the address of.
- name: TWAccountCoin
is_public: true
return_type:
variant: enum
value: TWCoinType
is_constant: false
is_nullable: false
is_pointer: false
comments:
- Return CoinType enum of an account.
- \param account Account to get the coin type of.
- name: TWAccountDerivation
is_public: true
return_type:
variant: enum
value: TWDerivation
is_constant: false
is_nullable: false
is_pointer: false
comments:
- Returns the derivation enum of an account.
- \param account Account to get the derivation enum of.
- name: TWAccountDerivationPath
is_public: true
return_type:
variant: string
is_constant: true
is_nullable: false
is_pointer: true
comments:
- Returns derivationPath of an account.
- \param account Account to get the derivation path of.
- name: TWAccountPublicKey
is_public: true
return_type:
variant: string
is_constant: true
is_nullable: false
is_pointer: true
comments:
- Returns hex encoded publicKey of an account.
- \param account Account to get the public key of.
- name: TWAccountExtendedPublicKey
is_public: true
return_type:
variant: string
is_constant: true
is_nullable: false
is_pointer: true
comments:
- Returns Base58 encoded extendedPublicKey of an account.
- \param account Account to get the extended public key of.
Loading