Skip to content

Commit 74f2535

Browse files
committed
Edits for clarity
1 parent f1a1fd0 commit 74f2535

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

doc/migration.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ For a long time, `schemagen` also supported a `--separate-files` flag which woul
4747

4848
In v4.x, the separate files option is not only the default, it's the only option. Supporting both modes of code generation would have added too much complexity and too many tradeoffs for the simplified build logic. Instead, v4.x adds several CMake helper functions in [cmake/cppgraphqlgen-functions.cmake](../cmake/cppgraphqlgen-functions.cmake) which encapsulate the best practices for regenerating and building the schema targets dynamically when the schema file changes. These functions are automatically included by `find_package(cppgraphqlgen)`.
4949

50-
Replace custom CMake logic to invoke `schemagen` and `clientgen` with the helper functions:
51-
- `update_graphql_schema_files`: Runs `schemagen` with required parameters and additional optional parameters. The output is generated in the CMake build directory, compared against the contents of the source directory, and any changed/added files will be copied over to the sources directory.
50+
Replace custom CMake logic to invoke `schemagen` and `clientgen` with these helper functions:
51+
- `update_graphql_schema_files`: Runs `schemagen` with required parameters and additional optional parameters.
52+
- `update_graphql_client_files`: Runs `clientgen` with required parameters and additional optional parameters.
53+
54+
The output is generated in the CMake build directory. The files are compared against the contents of the source directory, and any changed/added files will be copied over to the sources directory. Files which were not regenerated will be deleted from the source directory.
55+
56+
_IMPORTANT_: The `update_graphql_schema_files` and `update_graphql_client_files` functions expect to generate sources in a separate sub-directory from any other source code. They will check for any source files that don't match the naming patterns of the code generators and fail the build rather than deleting them. Just in case, it's a good idea to make sure you have your source code backed up or under source control (e.g. committed in a git repository) before invoking these CMake functions.
57+
58+
Declare library targets which automatically include all of the generated files with these helper functions:
5259
- `add_graphql_schema_target`: Declares a library target for the specified schema which depends on the output of `update_graphql_schema_files` and automatically links all of the shared library dependencies needed for a service.
53-
- `update_graphql_client_files`: Runs `clientgen` with required parameters and additional optional parameters. The output is generated in the CMake build directory, compared against the contents of the source directory, and any changed/added files will be copied over to the sources directory.
5460
- `add_graphql_client_target`: Declares a library target for the specified client which depends on the output of `update_graphql_client_files` and automatically links all of the shared library dependencies needed for a client.
5561

56-
_IMPORTANT_: The `update_graphql_schema_files` and `update_graphql_client_files` functions expect to generate sources in a separate sub-directory from any other source code. To handle removing or renaming generated files, they may delete stale files from the source directory. Just in case, it's a good idea to make sure you have your source code backed up or under source control (e.g. committed in a git repository) before invoking these CMake functions.
57-
58-
With all of the refactoring in v4.x, there ceased to be any separation between the `graphqlintrospection` and `graphqlservice` libraries. Even if you use the `--no-introspection` flag with `schemagen`, the generated code still depends on the general schema types which remained in `graphqlintrospection` to perform query validation. As part of the v4.x release, the 2 libraries were combined back into a single `graphqlservice` target.
62+
With all of the refactoring in v4.x, there ceased to be any separation between the `graphqlintrospection` and `graphqlservice` libraries. Even if you use the `--no-introspection` flag with `schemagen`, the generated code still depends on the general schema types which remained in `graphqlintrospection` to perform query validation. As part of the v4.x release, the 2 libraries were combined back into a single `graphqlservice` target. If you use `add_graphql_schema_target` you do not need to worry about this, otherwise you should replace any references to just `graphqlintrospection` with `graphqlservice`.

0 commit comments

Comments
 (0)