From c28211698b8f9b82cafc0f9d9457e40c6c17632a Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 20 Aug 2017 18:56:58 +0900 Subject: Added files to (eventually) generate *Job classes automatically KitsuneRal/api-generator project is a place where all the heavy lifting will (eventually) be implemented. This commit marks a point when the generated files at least compile (whether they work is not tested yet). Return values are so far entirely ignored. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a345e06..4bf47f71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,9 @@ set(libqmatrixclient_SRCS set(example_SRCS examples/qmc-example.cpp) -add_library(qmatrixclient ${libqmatrixclient_SRCS}) +file (STRINGS jobs/generated/apifiles.txt libqmatrixclient_job_SRCS REGEX "\\.cpp$") + +add_library(qmatrixclient ${libqmatrixclient_SRCS} ${libqmatrixclient_job_SRCS}) set_property(TARGET qmatrixclient PROPERTY VERSION "0.0.0") set_property(TARGET qmatrixclient PROPERTY SOVERSION 0 ) -- cgit v1.2.3 From f72923d2d82ca463bba22e8c97f225f54113ed68 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 3 Sep 2017 17:53:46 +0900 Subject: CMakeLists: add_custom_target(update-api), aux_source_directory to load files list - cmake --target update-api can be used to update the api files - aux_source_directory() is used to enumerate generated files instead of apifiles.txt (we wouldn't be able to rerun CMake on the changed files list anyway). --- CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bf47f71..257c5ee5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,9 +83,21 @@ set(libqmatrixclient_SRCS jobs/logoutjob.cpp ) -set(example_SRCS examples/qmc-example.cpp) +if (MATRIX_DOC_PATH AND APIGEN_PATH) + add_custom_target(update-api + ${APIGEN_PATH} --config jobs/apigen.yaml --out jobs/generated + ${MATRIX_DOC_PATH}/api/client-server + content-repo.yaml- cas_login_redirect.yaml- cas_login_ticket.yaml- + old_sync.yaml- room_initial_sync.yaml- + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + SOURCES jobs/apigen.yaml jobs/{{base}}.h.mustache jobs/{{base}}.cpp.mustache + VERBATIM + ) +endif() -file (STRINGS jobs/generated/apifiles.txt libqmatrixclient_job_SRCS REGEX "\\.cpp$") +aux_source_directory(jobs/generated libqmatrixclient_job_SRCS) + +set(example_SRCS examples/qmc-example.cpp) add_library(qmatrixclient ${libqmatrixclient_SRCS} ${libqmatrixclient_job_SRCS}) set_property(TARGET qmatrixclient PROPERTY VERSION "0.0.0") -- cgit v1.2.3 From ce1bbe88509715c9a35bb7aeeb5f20f0d4918ec4 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 2 Oct 2017 20:07:59 +0900 Subject: api-generator has been renamed to gtad --- CMakeLists.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index f4358521..44f63c79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,11 @@ if (CMAKE_BUILD_TYPE) endif(CMAKE_BUILD_TYPE) message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" ) message( STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" ) +if (MATRIX_DOC_PATH AND GTAD_PATH) + message( STATUS "Generating API stubs enabled" ) + message( STATUS " Using GTAD at ${GTAD_PATH}" ) + message( STATUS " Using CS API files at ${MATRIX_DOC_PATH}/api/client-server" ) +endif () message( STATUS "=============================================================================" ) message( STATUS ) @@ -84,16 +89,14 @@ set(libqmatrixclient_SRCS jobs/logoutjob.cpp ) -aux_source_directory(jobs/generated libqmatrixclient_job_SRCS) - -if (MATRIX_DOC_PATH AND APIGEN_PATH) +if (MATRIX_DOC_PATH AND GTAD_PATH) add_custom_target(update-api - ${APIGEN_PATH} --config jobs/apigen.yaml --out jobs/generated + ${GTAD_PATH} --config jobs/gtad.yaml --out jobs/generated ${MATRIX_DOC_PATH}/api/client-server content-repo.yaml- cas_login_redirect.yaml- cas_login_ticket.yaml- old_sync.yaml- room_initial_sync.yaml- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - SOURCES jobs/apigen.yaml jobs/{{base}}.h.mustache jobs/{{base}}.cpp.mustache + SOURCES jobs/gtad.yaml jobs/{{base}}.h.mustache jobs/{{base}}.cpp.mustache VERBATIM ) endif() -- cgit v1.2.3 From 878248db6122952998b390cf8ff4591c3f144474 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 19 Oct 2017 11:24:15 +0900 Subject: Be more friendly to IDE, list the API files --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b1d72131..d359214e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,12 @@ set(libqmatrixclient_SRCS jobs/mediathumbnailjob.cpp ) +set(API_DEF_PATH ${MATRIX_DOC_PATH}/api/client-server/) +file(GLOB_RECURSE API_DEFS RELATIVE ${PROJECT_SOURCE_DIR} + ${API_DEF_PATH}/*.yaml + ${API_DEF_PATH}/definitions/*.yaml + ${MATRIX_DOC_PATH}/event-schemas/schema/* +) if (MATRIX_DOC_PATH AND GTAD_PATH) add_custom_target(update-api ${GTAD_PATH} --config jobs/gtad.yaml --out jobs/generated @@ -95,7 +101,9 @@ if (MATRIX_DOC_PATH AND GTAD_PATH) content-repo.yaml- cas_login_redirect.yaml- cas_login_ticket.yaml- old_sync.yaml- room_initial_sync.yaml- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - SOURCES jobs/gtad.yaml jobs/{{base}}.h.mustache jobs/{{base}}.cpp.mustache + SOURCES jobs/gtad.yaml + jobs/{{base}}.h.mustache jobs/{{base}}.cpp.mustache + ${API_DEFS} VERBATIM ) endif() -- cgit v1.2.3 From 0c5a042104eaa6f8efb0dfc1c0eacca161d5787f Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 6 Dec 2017 21:29:07 +0900 Subject: GTAD: Enable content-repo stubs generation --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 2be54cb0..a1e96368 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if (MATRIX_DOC_PATH AND GTAD_PATH) add_custom_target(update-api ${GTAD_PATH} --config jobs/gtad.yaml --out jobs/generated ${MATRIX_DOC_PATH}/api/client-server - content-repo.yaml- cas_login_redirect.yaml- cas_login_ticket.yaml- + cas_login_redirect.yaml- cas_login_ticket.yaml- old_sync.yaml- room_initial_sync.yaml- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} SOURCES jobs/gtad.yaml -- cgit v1.2.3 From e623303aa2077110113d1cb92b70e758ba1533b0 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 4 Jan 2018 23:27:22 +0900 Subject: Disable generation of jobs that stand in the way We have a better SyncJob and SetRoomStateJob yet. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1aa06198..c1343d9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,7 @@ if (MATRIX_DOC_PATH AND GTAD_PATH) ${MATRIX_DOC_PATH}/api/client-server cas_login_redirect.yaml- cas_login_ticket.yaml- old_sync.yaml- room_initial_sync.yaml- + sync.yaml- room_state.yaml- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} SOURCES jobs/gtad.yaml jobs/{{base}}.h.mustache jobs/{{base}}.cpp.mustache -- cgit v1.2.3 From 5d85fc6335d4b49438a83e1e592ccac5a41d2332 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 5 Jan 2018 17:33:32 +0900 Subject: CMakeLists.txt: Exclude more API files from generation All of these new exclusions have parameters named 'signed', 'unsigned' and 'default' which are C++ reserverd words. GTAD does not give a proper workaround for these yet (see #24) so exclude them for now. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index c1343d9d..827497db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,9 @@ if (MATRIX_DOC_PATH AND GTAD_PATH) cas_login_redirect.yaml- cas_login_ticket.yaml- old_sync.yaml- room_initial_sync.yaml- sync.yaml- room_state.yaml- + event_context.yaml- joining.yaml- + notifications.yaml- peeking_events.yaml- + pushrules.yaml- rooms.yaml- search.yaml- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} SOURCES jobs/gtad.yaml jobs/{{base}}.h.mustache jobs/{{base}}.cpp.mustache -- cgit v1.2.3 From 0199c963de5a46a6526389829e210f5c68226911 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 12 Jan 2018 22:01:26 +0900 Subject: BaseJob::Data -> RequestData; support QIODevice* input/output --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 827497db..533d604f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ set(libqmatrixclient_SRCS events/roomavatarevent.cpp events/typingevent.cpp events/receiptevent.cpp + jobs/requestdata.cpp jobs/basejob.cpp jobs/checkauthmethods.cpp jobs/sendeventjob.cpp -- cgit v1.2.3 From 24b60a9693d032cc30ce75803730e4727b418087 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 12 Jan 2018 22:07:33 +0900 Subject: DownloadFileJob Instead of exposing a QIODevice as GetContentJob does it gets a filename and saves the incoming payload into it. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 533d604f..c0ffc0b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,7 @@ set(libqmatrixclient_SRCS jobs/roommessagesjob.cpp jobs/syncjob.cpp jobs/mediathumbnailjob.cpp + jobs/downloadfilejob.cpp ) set(API_DEF_PATH ${MATRIX_DOC_PATH}/api/client-server/) -- cgit v1.2.3 From 341bea5fc7df0143fa118072d2dbb8158cc6eb23 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 13 Apr 2018 20:31:05 +0900 Subject: CMakeLists.txt: minor refactoring --- CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 29171e7e..094ec488 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,9 +97,10 @@ file(GLOB_RECURSE API_DEFS RELATIVE ${PROJECT_SOURCE_DIR} ${API_DEF_PATH}/definitions/*.yaml ${MATRIX_DOC_PATH}/event-schemas/schema/* ) +set(JOBS_SRC_DIR lib/jobs) if (MATRIX_DOC_PATH AND GTAD_PATH) add_custom_target(update-api - ${GTAD_PATH} --config jobs/gtad.yaml --out jobs/generated + ${GTAD_PATH} --config ${JOBS_SRC_DIR}/gtad.yaml --out ${JOBS_SRC_DIR}/generated ${MATRIX_DOC_PATH}/api/client-server cas_login_redirect.yaml- cas_login_ticket.yaml- old_sync.yaml- room_initial_sync.yaml- @@ -108,14 +109,14 @@ if (MATRIX_DOC_PATH AND GTAD_PATH) notifications.yaml- peeking_events.yaml- pushrules.yaml- rooms.yaml- search.yaml- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - SOURCES lib/jobs/gtad.yaml - lib/jobs/{{base}}.h.mustache lib/jobs/{{base}}.cpp.mustache + SOURCES ${JOBS_SRC_DIR}/gtad.yaml + ${JOBS_SRC_DIR}/{{base}}.h.mustache ${JOBS_SRC_DIR}/{{base}}.cpp.mustache ${API_DEFS} VERBATIM ) endif() -aux_source_directory(lib/jobs/generated libqmatrixclient_job_SRCS) +aux_source_directory(${JOBS_SRC_DIR}/generated libqmatrixclient_job_SRCS) set(example_SRCS examples/qmc-example.cpp) -- cgit v1.2.3 From d6c9f76d4c2b27869b8590665a9001ff77477421 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 30 Apr 2018 22:19:00 +0900 Subject: Build systems: add jobs/generated/definitions to the mix --- CMakeLists.txt | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b966476f..49608f95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,36 +91,37 @@ set(libqmatrixclient_SRCS lib/jobs/downloadfilejob.cpp ) -set(API_DEF_PATH ${MATRIX_DOC_PATH}/api/client-server/) +set(API_DEF_PATH ${MATRIX_DOC_PATH}/api/client-server) file(GLOB_RECURSE API_DEFS RELATIVE ${PROJECT_SOURCE_DIR} ${API_DEF_PATH}/*.yaml ${API_DEF_PATH}/definitions/*.yaml ${MATRIX_DOC_PATH}/event-schemas/schema/* ) -set(JOBS_SRC_DIR lib/jobs) +set(GTAD_CONFIG_DIR lib/jobs) +set(GEN_SRC_DIR lib/jobs/generated) if (MATRIX_DOC_PATH AND GTAD_PATH) add_custom_target(update-api - ${GTAD_PATH} --config ${JOBS_SRC_DIR}/gtad.yaml --out ${JOBS_SRC_DIR}/generated - ${MATRIX_DOC_PATH}/api/client-server + ${GTAD_PATH} --config ${GTAD_CONFIG_DIR}/gtad.yaml --out ${GEN_SRC_DIR} + ${API_DEF_PATH} cas_login_redirect.yaml- cas_login_ticket.yaml- - old_sync.yaml- room_initial_sync.yaml- - sync.yaml- room_state.yaml- - event_context.yaml- joining.yaml- - notifications.yaml- peeking_events.yaml- - pushrules.yaml- rooms.yaml- search.yaml- + old_sync.yaml- room_initial_sync.yaml- # deprecated + sync.yaml- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - SOURCES ${JOBS_SRC_DIR}/gtad.yaml - ${JOBS_SRC_DIR}/{{base}}.h.mustache ${JOBS_SRC_DIR}/{{base}}.cpp.mustache + SOURCES ${GTAD_CONFIG_DIR}/gtad.yaml + ${GTAD_CONFIG_DIR}/{{base}}.h.mustache + ${GTAD_CONFIG_DIR}/{{base}}.cpp.mustache ${API_DEFS} VERBATIM ) endif() -aux_source_directory(${JOBS_SRC_DIR}/generated libqmatrixclient_job_SRCS) +aux_source_directory(${GEN_SRC_DIR} libqmatrixclient_job_SRCS) +aux_source_directory(${GEN_SRC_DIR}/definitions libqmatrixclient_def_SRCS) set(example_SRCS examples/qmc-example.cpp) -add_library(QMatrixClient ${libqmatrixclient_SRCS} ${libqmatrixclient_job_SRCS}) +add_library(QMatrixClient ${libqmatrixclient_SRCS} + ${libqmatrixclient_job_SRCS} ${libqmatrixclient_def_SRCS}) set(API_VERSION "0.2") set_property(TARGET QMatrixClient PROPERTY VERSION "${API_VERSION}.0") set_property(TARGET QMatrixClient PROPERTY SOVERSION 0 ) -- cgit v1.2.3 From 564d518c086f2aeab0f0466b7cd1915e20edc7da Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 3 May 2018 21:23:28 +0900 Subject: GetRoomEventsJob (replaces RoomMessagesJob) + refactoring 1. Updates in this commit (see further) allow to generate and build GetRoomEventsJob from message_pagination.yaml; this job completely preempts RoomMessagesJob. 2. EventsBatch<> is no more a thing; there's EventsArray<> to replace it but it's loaded from a JSON array rather than an event batch (a JSON array inside another JSON object). SyncJob that used it extensively has been moved to "conventional" containers (Events, RoomEvents and the newly introduced StateEvents). RoomMessagesJob that also used EventsBatch<> is decommissioned (see above). 3. RoomEventsRange is now an alias for Range, defined in util.h (otherwise almost the same). 4. Connection::getMessages() is no more. Use Room::getPreviousContent() and Connection::callApi() instead. 5. Moving things around in Room, since SyncJob now supplies state events in more specific StateEvents, rather than RoomEvents. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 49608f95..c69d0cfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,6 @@ set(libqmatrixclient_SRCS lib/jobs/sendeventjob.cpp lib/jobs/setroomstatejob.cpp lib/jobs/joinroomjob.cpp - lib/jobs/roommessagesjob.cpp lib/jobs/syncjob.cpp lib/jobs/mediathumbnailjob.cpp lib/jobs/downloadfilejob.cpp -- cgit v1.2.3 From a5b6d786878ab5c67a7b436ba475e8ac4d22f1f0 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 3 May 2018 22:41:12 +0900 Subject: Preempt jobs/joinroomjob.* with jobs/generated/joining.* Enables responding to third-party invites. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index c69d0cfa..5da87063 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,6 @@ set(libqmatrixclient_SRCS lib/jobs/checkauthmethods.cpp lib/jobs/sendeventjob.cpp lib/jobs/setroomstatejob.cpp - lib/jobs/joinroomjob.cpp lib/jobs/syncjob.cpp lib/jobs/mediathumbnailjob.cpp lib/jobs/downloadfilejob.cpp -- cgit v1.2.3 From 4cbe1a5fe9b0ae17e89425c3127db2af9b328320 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 4 May 2018 12:12:07 +0900 Subject: Preempt job/setroomstatejob.* with jobs/generated/room_state.* The template part (not exposed in the auto-generated class) goes to Room::Private::requestSetState(). Also, Room::setMemberState() to interface with User class. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 5da87063..96bca983 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,6 @@ set(libqmatrixclient_SRCS lib/jobs/basejob.cpp lib/jobs/checkauthmethods.cpp lib/jobs/sendeventjob.cpp - lib/jobs/setroomstatejob.cpp lib/jobs/syncjob.cpp lib/jobs/mediathumbnailjob.cpp lib/jobs/downloadfilejob.cpp -- cgit v1.2.3 From 49022915fde72b83d9f18944c268110b01fa3469 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 4 May 2018 23:04:04 +0900 Subject: New home for the generated code - lib/csapi --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 96bca983..935ba3dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,8 +94,8 @@ file(GLOB_RECURSE API_DEFS RELATIVE ${PROJECT_SOURCE_DIR} ${API_DEF_PATH}/definitions/*.yaml ${MATRIX_DOC_PATH}/event-schemas/schema/* ) -set(GTAD_CONFIG_DIR lib/jobs) -set(GEN_SRC_DIR lib/jobs/generated) +set(GTAD_CONFIG_DIR lib/csapi) +set(GEN_SRC_DIR lib/csapi) if (MATRIX_DOC_PATH AND GTAD_PATH) add_custom_target(update-api ${GTAD_PATH} --config ${GTAD_CONFIG_DIR}/gtad.yaml --out ${GEN_SRC_DIR} -- cgit v1.2.3