Commit 0ce962c
Add Android support to shared GraphQL providers and codegen rule
Summary:
Extend the shared `GraphQLInfo` provider and `graphql_codegen` UDR rule to support both iOS and Android using platform-specific record types. Integrate into Android `graphql_library_defs.bzl` in hybrid mode alongside the legacy genrule chain.
Changes:
- Move `fbcode/buck2/prelude/apple/graphql.bzl` to `fbcode/buck2/prelude/graphql/graphql.bzl` (shared location in its own folder).
- Define `GraphQLiOSInfo` and `GraphQLAndroidInfo` as separate `record()` types, each containing the full set of fields for their platform. `GraphQLInfo` is a provider with two optional fields: `ios: GraphQLiOSInfo | None` and `android: GraphQLAndroidInfo | None`. Each instance is either iOS or Android, never a mix.
- Add `graphql_providers(ctx, deps)` as a single merged function for both platforms. iOS calls with `cxx_attr_deps`, Android calls with `ctx.attrs.deps`.
- Modify `tools/build_defs/graphql/rules/graphql_codegen.bzl`: Add `platform` attr ("ios" or "android") to select which record type to create. JSON output extracts fields from the platform-specific record via `_get_platform_info()` helper.
- Add `platform = "ios"` to existing iOS `graphql_codegen()` call sites.
- Modify `fbcode/buck2/prelude/android/android_library.bzl`: Append `graphql_providers(ctx, ctx.attrs.deps)` to propagate GraphQL providers through the Android dep graph.
- Integrate `graphql_codegen()` into `graphql_library_defs.bzl` with `platform = "android"`, passing Android-specific fields from `graphql_bad_practices` and `composition_mode` from the build config's `JAVA_INTERFACES` capability.
- Update all import paths to `prelude//graphql:graphql.bzl`.
Legacy targets (`_local_graphql_files`, `__collected_graphql_deps`, `_recursive_graphql_files`) remain unchanged -- this is additive/hybrid.
Reviewed By: rmaz
Differential Revision: D97816914
fbshipit-source-id: d26883231857ed1a2dd01aeb02c4b30690c05e751 parent 9b899e4 commit 0ce962c
3 files changed
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
20 | 31 | | |
21 | 32 | | |
22 | 33 | | |
23 | 34 | | |
24 | | - | |
25 | 35 | | |
26 | 36 | | |
| 37 | + | |
27 | 38 | | |
28 | 39 | | |
29 | 40 | | |
| |||
0 commit comments