From 4f7739ac3363b5112cd82e477f2a4b36d9f70faa Mon Sep 17 00:00:00 2001 From: Bhuwan Khattar Date: Tue, 14 Nov 2023 13:18:54 -0800 Subject: [PATCH] generate_schema_resolvers -> ResolversSchemaModule Reviewed By: Snowshine-afk Differential Revision: D51257562 fbshipit-source-id: 57b76e73824dede51a6993546f4a32f00300b3a9 --- compiler/crates/common/src/feature_flags.rs | 2 +- compiler/crates/relay-codegen/src/build_ast.rs | 6 +++++- .../relay-compiler/tests/compile_relay_artifacts/mod.rs | 2 +- .../tests/compile_relay_artifacts_with_custom_id/mod.rs | 2 +- compiler/crates/relay-transforms/src/apply_transforms.rs | 5 ++++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/compiler/crates/common/src/feature_flags.rs b/compiler/crates/common/src/feature_flags.rs index bf0113f550841..7164e93af1429 100644 --- a/compiler/crates/common/src/feature_flags.rs +++ b/compiler/crates/common/src/feature_flags.rs @@ -71,7 +71,7 @@ pub struct FeatureFlags { /// Fully build the schema resolvers artifact #[serde(default)] - pub enable_schema_resolvers: bool, + pub generate_resolvers_schema_module: bool, /// Enforce strict flavors for relay resolvers and disallow mixing flavors #[serde(default)] diff --git a/compiler/crates/relay-codegen/src/build_ast.rs b/compiler/crates/relay-codegen/src/build_ast.rs index dd308e09d1dc0..a9fd252da5b3c 100644 --- a/compiler/crates/relay-codegen/src/build_ast.rs +++ b/compiler/crates/relay-codegen/src/build_ast.rs @@ -649,7 +649,11 @@ impl<'schema, 'builder, 'config> CodegenBuilder<'schema, 'builder, 'config> { resolver_metadata: &RelayResolverMetadata, inline_fragment: Option, ) -> Primitive { - if self.project_config.feature_flags.enable_schema_resolvers { + if self + .project_config + .feature_flags + .generate_resolvers_schema_module + { self.build_normalization_relay_resolver_execution_time_for_worker(resolver_metadata) } else if self .project_config diff --git a/compiler/crates/relay-compiler/tests/compile_relay_artifacts/mod.rs b/compiler/crates/relay-compiler/tests/compile_relay_artifacts/mod.rs index 8ce8e50f0f540..89d67bb9ed24e 100644 --- a/compiler/crates/relay-compiler/tests/compile_relay_artifacts/mod.rs +++ b/compiler/crates/relay-compiler/tests/compile_relay_artifacts/mod.rs @@ -118,7 +118,7 @@ pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result enable_resolver_normalization_ast: fixture .content .contains("# enable_resolver_normalization_ast"), - enable_schema_resolvers: false, + generate_resolvers_schema_module: false, relay_resolvers_enable_strict_resolver_flavors: FeatureFlag::Disabled, relay_resolvers_allow_legacy_verbose_syntax: FeatureFlag::Disabled, enable_relay_resolver_mutations: false, diff --git a/compiler/crates/relay-compiler/tests/compile_relay_artifacts_with_custom_id/mod.rs b/compiler/crates/relay-compiler/tests/compile_relay_artifacts_with_custom_id/mod.rs index 9c9029f99fbc3..2cf79b299d833 100644 --- a/compiler/crates/relay-compiler/tests/compile_relay_artifacts_with_custom_id/mod.rs +++ b/compiler/crates/relay-compiler/tests/compile_relay_artifacts_with_custom_id/mod.rs @@ -96,7 +96,7 @@ pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result relay_resolver_enable_output_type: FeatureFlag::Disabled, relay_resolver_enable_interface_output_type: FeatureFlag::Disabled, enable_resolver_normalization_ast: false, - enable_schema_resolvers: false, + generate_resolvers_schema_module: false, relay_resolvers_enable_strict_resolver_flavors: FeatureFlag::Disabled, relay_resolvers_allow_legacy_verbose_syntax: FeatureFlag::Disabled, enable_relay_resolver_mutations: false, diff --git a/compiler/crates/relay-transforms/src/apply_transforms.rs b/compiler/crates/relay-transforms/src/apply_transforms.rs index 4558c8de863a8..da3deaa86673e 100644 --- a/compiler/crates/relay-transforms/src/apply_transforms.rs +++ b/compiler/crates/relay-transforms/src/apply_transforms.rs @@ -358,7 +358,10 @@ fn apply_operation_transforms( project_config.feature_flags.enable_relay_resolver_transform, ) })?; - if project_config.feature_flags.enable_schema_resolvers { + if project_config + .feature_flags + .generate_resolvers_schema_module + { program = log_event.time( "generate_relay_resolvers_root_fragment_split_operation", || generate_relay_resolvers_root_fragment_split_operation(&program),