diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-06-23 13:41:44 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-06-23 16:45:39 +0200 |
commit | fefa95b86c31f3b7e46fc28327b23050cbadedb9 (patch) | |
tree | 2417534f9f1a9068b44c69cca38518a0e2515010 | |
parent | d20aa002c0dcb2b40bbf7b48c5c995a5ed8138c1 (diff) | |
download | libquotient-fefa95b86c31f3b7e46fc28327b23050cbadedb9.tar.gz libquotient-fefa95b86c31f3b7e46fc28327b23050cbadedb9.zip |
Update to the new matrix-doc layout and tooling
Among things affecting Quotient, the update involved moving API files
from api/ to data/api/, adding extensions to event schema files, and
switching from ReStructured Text to Markdown as a lightweight markup
language. This commit updates the build system and GTAD configuration
to accommodate for these.
The build system is also more robust now in choosing whether the
update-api target should be provided. Previously the target was provided
whenever GTAD_PATH and MATRIX_DOC_PATH were specified, even if they
did not point to anything valid. CMake now checks that MATRIX_DOC_PATH
is an actual directory and that GTAD_PATH points to an actual file.
# Conflicts:
# CMakeLists.txt
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rw-r--r-- | gtad/gtad.yaml | 4 |
2 files changed, 20 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d930bbf2..555ffa96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,16 +174,26 @@ set(FULL_CSAPI_DIR lib/${CSAPI_DIR}) set(ASAPI_DEF_DIR application-service/definitions) set(ISAPI_DEF_DIR identity/definitions) -if (GTAD_PATH) +if (GTAD_PATH AND MATRIX_DOC_PATH) get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" REALPATH) + if (EXISTS ${ABS_GTAD_PATH}) + get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/data/api" REALPATH) + if (NOT IS_DIRECTORY ${ABS_API_DEF_PATH}) + # Check the old place of API files + get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/api" REALPATH) + endif () + if (IS_DIRECTORY ${ABS_API_DEF_PATH}) + set(API_GENERATION_ENABLED 1) + else () + message( WARNING "${MATRIX_DOC_PATH} doesn't seem to point to a valid matrix-doc repo; disabling API stubs generation") + endif () + else (EXISTS ${ABS_GTAD_PATH}) + message( WARNING "${GTAD_PATH} doesn't exist; disabling API stubs generation") + endif () endif () -if (MATRIX_DOC_PATH) - get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/api" REALPATH) -endif () -if (ABS_GTAD_PATH AND ABS_API_DEF_PATH) +if (API_GENERATION_ENABLED) message( STATUS "Using GTAD at ${ABS_GTAD_PATH}" ) - message( STATUS "Using API files at ${ABS_API_DEF_PATH}" ) - set(API_GENERATION_ENABLED 1) + message( STATUS "Found API files at ${ABS_API_DEF_PATH}" ) if (NOT CLANG_FORMAT) set(CLANG_FORMAT clang-format) endif() @@ -225,7 +235,7 @@ if (ABS_GTAD_PATH AND ABS_API_DEF_PATH) VERBATIM ) add_custom_target(update-api DEPENDS generate-unformatted-api) - if (ABS_CLANG_FORMAT) + if (EXISTS ${ABS_CLANG_FORMAT}) set(CLANG_FORMAT_ARGS -i -sort-includes ${CLANG_FORMAT_ARGS}) # FIXME: the list of files should be produced after GTAD has run. # For now it's produced at CMake invocation. If file() hasn't found diff --git a/gtad/gtad.yaml b/gtad/gtad.yaml index adf5024a..d68cc8a0 100644 --- a/gtad/gtad.yaml +++ b/gtad/gtad.yaml @@ -85,7 +85,7 @@ analyzer: { type: RoomEventPtr, imports: "events/eventloader.h" } - /event.yaml$/: { type: EventPtr, imports: "events/eventloader.h" } - - /m\.room\.member$/: void # Skip resolving; see EventsArray<> below + - /m\.room\.member/: void # Skip resolving; see EventsArray<> below - '/^(\./)?definitions/request_email_validation.yaml$/': title: EmailValidationData - '/^(\./)?definitions/request_msisdn_validation.yaml$/': @@ -109,7 +109,7 @@ analyzer: - /^Notification|Result$/: type: "std::vector<{{1}}>" imports: "events/eventloader.h" - - /m\.room\.member$/: # Only used in an array (see also above) + - /m\.room\.member/: # Only used in an array (see also above) type: "EventsArray<RoomMemberEvent>" imports: "events/roommemberevent.h" - /state_event.yaml$/: StateEvents |