Skip to content

Commit 30321ad

Browse files
Ben Golubmeta-codesync[bot]
authored andcommitted
Rename build_schema_with_extensions to build_schema_with_extensions_parallel
Reviewed By: ginfung Differential Revision: D97312038 fbshipit-source-id: 5c5e3ae2c46cec473544fade02852097e1144f28
1 parent 39d0541 commit 30321ad

File tree

10 files changed

+30
-30
lines changed

10 files changed

+30
-30
lines changed

compiler/crates/graphql-ir-diff/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ pub fn load_schema(schema_paths: Vec<String>) -> Result<Arc<SDLSchema>> {
837837
})
838838
.collect();
839839

840-
// Convert to (content, SourceLocationKey) tuples for build_schema_with_extensions
840+
// Convert to (content, SourceLocationKey) tuples for build_schema_with_extensions_parallel
841841
let schema_sdls: Vec<(String, SourceLocationKey)> = schema_files
842842
.into_iter()
843843
.map(|(content, file_path)| {
@@ -846,7 +846,7 @@ pub fn load_schema(schema_paths: Vec<String>) -> Result<Arc<SDLSchema>> {
846846
})
847847
.collect();
848848

849-
let schema = schema::build_schema_with_extensions::<_, &str>(
849+
let schema = schema::build_schema_with_extensions_parallel::<_, &str>(
850850
&schema_sdls
851851
.iter()
852852
.map(|(content, key)| (content.as_str(), *key))

compiler/crates/relay-compiler-playground/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use relay_codegen::print_fragment;
2020
use relay_codegen::print_operation;
2121
use relay_codegen::print_provided_variables;
2222
use relay_config::ProjectConfig;
23-
use relay_schema::build_schema_with_extensions;
23+
use relay_schema::build_schema_with_extensions_parallel;
2424
use relay_transforms::Programs;
2525
use relay_transforms::apply_transforms;
2626
use relay_typegen::FragmentLocations;
@@ -93,7 +93,7 @@ pub fn parse_to_ir_impl(schema_text: &str, document_text: &str) -> PlaygroundRes
9393
.map_err(|diagnostics| map_diagnostics(diagnostics, &InputType::Document(document_text)))?;
9494

9595
let schema = Arc::new(
96-
build_schema_with_extensions(
96+
build_schema_with_extensions_parallel(
9797
&[(schema_text, SourceLocationKey::generated())],
9898
&Vec::<(&str, SourceLocationKey)>::new(),
9999
)
@@ -129,7 +129,7 @@ pub fn parse_to_reader_ast_impl(
129129
document_text: &str,
130130
) -> PlaygroundResult {
131131
let schema = Arc::new(
132-
build_schema_with_extensions(
132+
build_schema_with_extensions_parallel(
133133
&[(schema_text, SourceLocationKey::Generated)],
134134
&Vec::<(&str, SourceLocationKey)>::new(),
135135
)
@@ -176,7 +176,7 @@ pub fn parse_to_normalization_ast_impl(
176176
document_text: &str,
177177
) -> PlaygroundResult {
178178
let schema = Arc::new(
179-
build_schema_with_extensions(
179+
build_schema_with_extensions_parallel(
180180
&[(schema_text, SourceLocationKey::Generated)],
181181
&Vec::<(&str, SourceLocationKey)>::new(),
182182
)
@@ -222,7 +222,7 @@ pub fn parse_to_types_impl(
222222
document_text: &str,
223223
) -> PlaygroundResult {
224224
let schema = Arc::new(
225-
build_schema_with_extensions(
225+
build_schema_with_extensions_parallel(
226226
&[(schema_text, SourceLocationKey::Generated)],
227227
&Vec::<(&str, SourceLocationKey)>::new(),
228228
)
@@ -279,7 +279,7 @@ fn transform_impl(
279279
document_text: &str,
280280
) -> PlaygroundResult {
281281
let schema = Arc::new(
282-
build_schema_with_extensions(
282+
build_schema_with_extensions_parallel(
283283
&[(schema_text, SourceLocationKey::Generated)],
284284
&Vec::<(&str, SourceLocationKey)>::new(),
285285
)

compiler/crates/relay-compiler/src/build_project/build_schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use relay_docblock::extend_schema_with_resolver_type_system_definition;
1818
use relay_docblock::validate_resolver_schema;
1919
use schema::SDLSchema;
2020
use schema::SchemaDocuments;
21-
use schema::parse_schema_with_extensions;
21+
use schema::parse_schema_with_extensions_parallel;
2222
use schema_validate_lib::SchemaValidationOptions;
2323
use schema_validate_lib::validate;
2424

@@ -136,7 +136,7 @@ fn build_schema_impl(
136136
server: server_asts,
137137
extensions: mut extension_asts,
138138
} = log_event.time("parse_schema_time", || {
139-
parse_schema_with_extensions(&schema_sources, &extensions)
139+
parse_schema_with_extensions_parallel(&schema_sources, &extensions)
140140
})?;
141141

142142
// Collect Relay Resolver schema IR

compiler/crates/relay-compiler/src/compiler_state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ impl CompilerState {
612612
.map(|(schema, location_key)| (schema.as_str(), location_key))
613613
.collect::<Vec<_>>();
614614

615-
relay_schema::build_schema_with_extensions(
615+
relay_schema::build_schema_with_extensions_parallel(
616616
&current_sources_with_location,
617617
&Vec::<(&str, SourceLocationKey)>::new(),
618618
)

compiler/crates/relay-schema/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ lazy_static! {
3737
pub static ref EXPORT_NAME_CUSTOM_SCALAR_ARGUMENT_NAME: StringKey = intern!("export_name");
3838
}
3939

40-
pub fn build_schema_with_extensions<
40+
pub fn build_schema_with_extensions_parallel<
4141
T: AsRef<str> + std::marker::Sync,
4242
U: AsRef<str> + std::marker::Sync,
4343
>(
@@ -53,7 +53,7 @@ pub fn build_schema_with_extensions<
5353
)
5454
.collect();
5555

56-
let mut schema = schema::build_schema_with_extensions(server_sdls, &extensions)?;
56+
let mut schema = schema::build_schema_with_extensions_parallel(server_sdls, &extensions)?;
5757
remove_defer_stream_label(&mut schema);
5858
Ok(schema)
5959
}

compiler/crates/relay-test-schema/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ use std::sync::Arc;
1313

1414
use common::SourceLocationKey;
1515
use lazy_static::lazy_static;
16-
use relay_schema::build_schema_with_extensions;
16+
use relay_schema::build_schema_with_extensions_parallel;
1717
use schema::SDLSchema;
1818

1919
const TEST_SCHEMA_DATA: &str = include_str!("testschema.graphql");
2020
const TEST_SCHEMA_WITH_CUSTOM_ID_DATA: &str = include_str!("testschema_with_custom_id.graphql");
2121

2222
lazy_static! {
2323
pub static ref TEST_SCHEMA: Arc<SDLSchema> = Arc::new(
24-
build_schema_with_extensions::<_, &str>(
24+
build_schema_with_extensions_parallel::<_, &str>(
2525
&[(TEST_SCHEMA_DATA, SourceLocationKey::generated())],
2626
&[]
2727
)
2828
.expect("Expected test schema to be valid")
2929
);
3030
pub static ref TEST_SCHEMA_WITH_CUSTOM_ID: Arc<SDLSchema> = Arc::new(
31-
build_schema_with_extensions::<_, &str>(
31+
build_schema_with_extensions_parallel::<_, &str>(
3232
&[(
3333
TEST_SCHEMA_WITH_CUSTOM_ID_DATA,
3434
SourceLocationKey::generated()
@@ -52,7 +52,7 @@ pub fn get_test_schema_with_located_extensions(
5252
source_location: SourceLocationKey,
5353
) -> Arc<SDLSchema> {
5454
Arc::new(
55-
build_schema_with_extensions(
55+
build_schema_with_extensions_parallel(
5656
&[(TEST_SCHEMA_DATA, SourceLocationKey::generated())],
5757
&[(extensions_sdl, source_location)],
5858
)
@@ -66,7 +66,7 @@ pub fn get_test_schema_with_custom_id() -> Arc<SDLSchema> {
6666

6767
pub fn get_test_schema_with_custom_id_with_extensions(extensions_sdl: &str) -> Arc<SDLSchema> {
6868
Arc::new(
69-
build_schema_with_extensions(
69+
build_schema_with_extensions_parallel(
7070
&[(
7171
TEST_SCHEMA_WITH_CUSTOM_ID_DATA,
7272
SourceLocationKey::generated(),

compiler/crates/schema-validate/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use common::TextSource;
1515
use graphql_cli::DiagnosticPrinter;
1616
use intern::intern::Lookup;
1717
use schema::SDLSchema;
18-
use schema::build_schema_with_extensions;
18+
use schema::build_schema_with_extensions_parallel;
1919
use schema_validate_lib::SchemaValidationOptions;
2020
use schema_validate_lib::validate;
2121

@@ -62,7 +62,7 @@ fn build_schema_from_path(schema_file: &str) -> DiagnosticsResult<SDLSchema> {
6262
let extensions: &[(&str, SourceLocationKey)] = &[];
6363

6464
if path.is_file() {
65-
build_schema_with_extensions(&[path_to_schema_source(path)], extensions)
65+
build_schema_with_extensions_parallel(&[path_to_schema_source(path)], extensions)
6666
} else {
6767
let paths = path
6868
.read_dir()
@@ -80,7 +80,7 @@ fn build_schema_from_path(schema_file: &str) -> DiagnosticsResult<SDLSchema> {
8080
.map(|path| path_to_schema_source(path))
8181
.collect();
8282

83-
build_schema_with_extensions(&sdls, extensions)
83+
build_schema_with_extensions_parallel(&sdls, extensions)
8484
}
8585
}
8686

compiler/crates/schema-validate/tests/validate_schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ use common::SourceLocationKey;
99
use common::TextSource;
1010
use fixture_tests::Fixture;
1111
use graphql_cli::DiagnosticPrinter;
12-
use schema::build_schema_with_extensions;
12+
use schema::build_schema_with_extensions_parallel;
1313
use schema_validate_lib::SchemaValidationOptions;
1414
use schema_validate_lib::validate;
1515

1616
pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result<String, String> {
17-
let result = build_schema_with_extensions::<&str, &str>(
17+
let result = build_schema_with_extensions_parallel::<&str, &str>(
1818
&[(
1919
fixture.content,
2020
SourceLocationKey::standalone(fixture.file_name),

compiler/crates/schema/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,27 @@ const BUILTINS: &str = include_str!("./builtins.graphql");
6767
pub use flatbuffer::serialize_as_flatbuffer;
6868

6969
pub fn build_schema(sdl: &str) -> DiagnosticsResult<SDLSchema> {
70-
build_schema_with_extensions::<_, &str>(&[(sdl, SourceLocationKey::generated())], &[])
70+
build_schema_with_extensions_parallel::<_, &str>(&[(sdl, SourceLocationKey::generated())], &[])
7171
}
7272

7373
pub struct SchemaDocuments {
7474
pub server: Vec<SchemaDocument>,
7575
pub extensions: Vec<SchemaDocument>,
7676
}
7777

78-
pub fn build_schema_with_extensions<
78+
pub fn build_schema_with_extensions_parallel<
7979
T: AsRef<str> + std::marker::Sync,
8080
U: AsRef<str> + std::marker::Sync,
8181
>(
8282
server_sdls: &[(T, SourceLocationKey)],
8383
extension_sdls: &[(U, SourceLocationKey)],
8484
) -> DiagnosticsResult<SDLSchema> {
8585
let SchemaDocuments { server, extensions } =
86-
parse_schema_with_extensions(server_sdls, extension_sdls)?;
86+
parse_schema_with_extensions_parallel(server_sdls, extension_sdls)?;
8787
SDLSchema::build(&server, &extensions)
8888
}
8989

90-
pub fn parse_schema_with_extensions<
90+
pub fn parse_schema_with_extensions_parallel<
9191
T: AsRef<str> + std::marker::Sync,
9292
U: AsRef<str> + std::marker::Sync,
9393
>(

compiler/crates/schema/tests/build_schema.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ use schema::SDLSchema;
1616
use schema::Schema;
1717
use schema::Type;
1818
use schema::build_schema_from_flat_buffer;
19-
use schema::build_schema_with_extensions;
19+
use schema::build_schema_with_extensions_parallel;
2020
use schema::serialize_as_flatbuffer;
2121

2222
const SCHEMA_SEPARATOR: &str = "%extensions%";
2323

2424
pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result<String, String> {
2525
let parts: Vec<_> = fixture.content.split(SCHEMA_SEPARATOR).collect();
2626
let result = match parts.as_slice() {
27-
[base] => build_schema_with_extensions::<_, &str>(
27+
[base] => build_schema_with_extensions_parallel::<_, &str>(
2828
&[(base, SourceLocationKey::standalone(fixture.file_name))],
2929
&[],
3030
),
@@ -34,7 +34,7 @@ pub async fn transform_fixture(fixture: &Fixture<'_>) -> Result<String, String>
3434
let nchars_base = base.chars().count() + SCHEMA_SEPARATOR.chars().count();
3535
assert!(nchars_base > 0);
3636
let prepended_extension = format!("{}\n{}", "#".repeat(nchars_base - 1), extensions);
37-
build_schema_with_extensions(
37+
build_schema_with_extensions_parallel(
3838
&[(base, SourceLocationKey::standalone(fixture.file_name))],
3939
&[(
4040
prepended_extension,

0 commit comments

Comments
 (0)