Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
9725865
Merge remote-tracking branch 'origin/trunk' into switch-to-uniffi-pro…
oguzkocer Mar 6, 2024
b70be8b
Replace UDL with procmacros
oguzkocer Mar 6, 2024
ea729da
Use --library method to generate Swift uniffi bindings
oguzkocer Mar 7, 2024
5688e04
Update Android & Swift implementation for procmacro changes
oguzkocer Mar 7, 2024
a35b85b
Address derive macro ordering inconsistencies
oguzkocer Mar 7, 2024
555bd2c
Remove incorrect comment from PostListParams
oguzkocer Mar 7, 2024
79dc184
Introduces wp_derive crate
oguzkocer Mar 7, 2024
170c858
Extract the type from Option in wp_derive
oguzkocer Mar 8, 2024
c30ed73
Barebone implementation of context attributes in wp_derive
oguzkocer Mar 8, 2024
053ec2d
Add support for multiple context types in wp_derive
oguzkocer Mar 8, 2024
c6a50e9
Extract filtered_fields_for_context in wp_derive
oguzkocer Mar 8, 2024
c559a15
Support multiple context types in wp_derive
oguzkocer Mar 8, 2024
df0905e
Extract contexts and ident name formatting in wp_derive
oguzkocer Mar 8, 2024
60d401d
Remove unnecessary 'static lifetime from CONTEXTS
oguzkocer Mar 11, 2024
f5d02c4
Add the common derives to generated structs in wp_derive
oguzkocer Mar 11, 2024
7f582a8
Preserve the existing attributes while generating structs in wp_derive
oguzkocer Mar 11, 2024
2b85709
Use 'Sparse' prefix in wp_derive
oguzkocer Mar 11, 2024
f116548
Validate that ident name after removing the prefix is valid in wp_derive
oguzkocer Mar 11, 2024
a448b0e
Use fully qualified names in generated structs in wp_derive
oguzkocer Mar 11, 2024
fa547de
Merge remote-tracking branch 'origin/trunk' into wp_derive
oguzkocer Mar 11, 2024
faab91e
Remove no longer used wp_derive tests
oguzkocer Mar 11, 2024
08e7d3e
Add WPContextualField attribute for context aware fields
oguzkocer Mar 13, 2024
87d606e
Don't generate structs with empty fields
oguzkocer Mar 13, 2024
83e0383
Merge remote-tracking branch 'origin/trunk' into wp_derive
oguzkocer Mar 13, 2024
52c6c62
Map the contextual structs instead of extending in place
oguzkocer Mar 13, 2024
e22203c
Handle errors while building contextual token streams
oguzkocer Mar 13, 2024
1cd3389
Report proper compiler error when a contextual field doesn't have pro…
oguzkocer Mar 13, 2024
49c8931
Improve error messaging for incorrect contextual field type
oguzkocer Mar 13, 2024
27bd7b3
Return Result<syn::Type, syn::Error> from contextual_field_type
oguzkocer Mar 13, 2024
f609344
Merge remote-tracking branch 'origin/trunk' into wp_derive
oguzkocer Mar 14, 2024
e7e95e0
Add a basic WPContextual test
oguzkocer Mar 14, 2024
29696af
Add basic WPContextualField test
oguzkocer Mar 14, 2024
a106fce
Fix basic_wp_contextual test not calling all context types
oguzkocer Mar 14, 2024
81620f8
Adds a test for missing 'Sparse' prefix while using WPContextual
oguzkocer Mar 14, 2024
81db281
Add a test for missing Sparse prefix when marked with #[WPContextualF…
oguzkocer Mar 14, 2024
e4b1ba0
Add an error and test for when WPContextual doesn't generate anything
oguzkocer Mar 14, 2024
242e4e5
Improve naming in basic_wp_contextual_field test
oguzkocer Mar 15, 2024
bbe379f
Refactor wp_derive for better parsing & error handling setup
oguzkocer Mar 15, 2024
b104108
Add WPParsedAttr::ExternalAttr
oguzkocer Mar 15, 2024
153513f
Remove unnecessary reference to context attr while calling ident_name…
oguzkocer Mar 18, 2024
dbbf953
Rename WPParsedAttr variants
oguzkocer Mar 18, 2024
5dedebc
Handle #[WPContextualField] without a #[WPContext]
oguzkocer Mar 18, 2024
4391967
Improve UnexpectedWPContextLiteral error handling and add a test for it
oguzkocer Mar 18, 2024
7d5b20f
Improve UnexpectedWPContextMeta error handling and add a test for it
oguzkocer Mar 18, 2024
51b51c3
Adds a test for unexpected syn::Meta::NameValue type for WPContext
oguzkocer Mar 18, 2024
d93cdf0
Use Ident instead of Literal contexts in wp_derive
oguzkocer Mar 18, 2024
42f661b
Add a test for unexpected punctuation in WPContext attr
oguzkocer Mar 18, 2024
baf1ce5
Rename error_unexpected_wp_context_literal test as error_unexpected_w…
oguzkocer Mar 20, 2024
48065ca
Add an error message to UnexpectedAttrPathSegmentCount
oguzkocer Mar 20, 2024
e50baba
Introduce WPContextualParseError
oguzkocer Mar 20, 2024
ebde619
Add WPContextualNotAStruct error
oguzkocer Mar 21, 2024
271f1bf
Handle multiple path segments in #[WPContextualField] and add a test …
oguzkocer Mar 21, 2024
4cc5d74
Add multiple segment and inner type support to #[WPContextualField]
oguzkocer Mar 21, 2024
862f999
Add inner type tests for #[WPContextualField]
oguzkocer Mar 21, 2024
484dd74
Add unit tests for find_contextual_field_inner_segment
oguzkocer Mar 22, 2024
b495ad6
Add struct_fields helper to wp_derive
oguzkocer Mar 22, 2024
a2479fb
Extract WPContextual implementation to wp_contextual.rs
oguzkocer Mar 22, 2024
dae223e
Simplify wp_contextual by extracting some of the logic to helpers
oguzkocer Mar 22, 2024
1972f06
Add a comment to wp_contextual_field_with_multiple_path_segments_help…
oguzkocer Mar 22, 2024
08c3b9e
Add a test for the error case of find_contextual_field_inner_segment …
oguzkocer Mar 22, 2024
02eb3e3
Document wp_contextual::contextual_field_type helper
oguzkocer Mar 22, 2024
34abcab
Document parse_contexts_from_tokens and add more tests for it
oguzkocer Mar 22, 2024
abac2ac
Document wp_contextual::generate_context_fields
oguzkocer Mar 22, 2024
cbda66a
Document wp_contextual::parse_fields
oguzkocer Mar 22, 2024
c5e4e6d
Document wp_contextual::extract_inner_type_of_option and add a test f…
oguzkocer Mar 22, 2024
8ae2ff7
post_list_request correctly utilizes the passed in parameters
oguzkocer Mar 27, 2024
26bed58
Implement Default for PostListParams
oguzkocer Mar 27, 2024
bb40e52
First take on documentation of WPContextual
oguzkocer Mar 27, 2024
b5e2e12
Merge remote-tracking branch 'origin/trunk' into wp_derive
oguzkocer Mar 27, 2024
390958a
Merge remote-tracking branch 'origin/trunk' into wp_derive
oguzkocer Mar 27, 2024
9e23174
Merge remote-tracking branch 'origin/trunk' into wp_derive
oguzkocer Mar 28, 2024
545cc2b
Add technical documentation for WPContextual
oguzkocer Mar 28, 2024
9909e87
Update 'trybuild' to '1.0.90'
oguzkocer Mar 28, 2024
8bf93d8
Remove the string argument from setup_scaffolding!() calls
oguzkocer Mar 28, 2024
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
137 changes: 121 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
members = [
"wp_api",
"wp_cli",
"wp_derive",
"wp_networking",
"wp_uniffi_bindgen",
]
resolver = "2"

[workspace.dependencies]
# External traits in UDL is only available since https://github.com/mozilla/uniffi-rs/pull/1867
# Point to a specific commit until a new version is released
uniffi = "0.27.0"
thiserror = "1.0"
# We need to match the version used in `reqwest`: https://github.com/seanmonstar/reqwest/blob/master/Cargo.toml#L84
# So that we can implement our own traits and it'll work with both reqwest types as well as http types
#
Expand Down
2 changes: 1 addition & 1 deletion wp_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ url = "2.5"
parse_link_header = "0.3"
serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0"
thiserror = "1.0"
thiserror = { workspace = true }
uniffi = { workspace = true }

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion wp_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@ pub fn get_link_header(response: &WPNetworkResponse, name: &str) -> Option<WPRes
None
}

uniffi::setup_scaffolding!("wp_api");
uniffi::setup_scaffolding!();
11 changes: 10 additions & 1 deletion wp_api/src/posts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@ use serde::{Deserialize, Serialize};

pub trait PostNetworkingInterface: Send + Sync {}

#[derive(Default, uniffi::Record)]
#[derive(uniffi::Record)]
pub struct PostListParams {
#[uniffi(default = 1)]
pub page: u32,
#[uniffi(default = 10)]
pub per_page: u32,
}

impl Default for PostListParams {
fn default() -> Self {
Self {
page: 1,
per_page: 10,
}
}
}

#[derive(uniffi::Record)]
pub struct PostCreateParams {
pub title: Option<String>,
Expand Down
23 changes: 23 additions & 0 deletions wp_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "wp_derive"
version = "0.1.0"
edition = "2021"
autotests = false

[lib]
proc-macro = true

[[test]]
name = "tests"
path = "tests/all_tests.rs"

[dev-dependencies]
trybuild = { version = "1.0", features = ["diff"] }

[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
syn = { version = "2.0", features = ["extra-traits"] }
thiserror = { workspace = true }
uniffi = { workspace = true }
Loading