Skip to content

Commit 676318e

Browse files
cburandtPietfried
authored andcommitted
docs(api): Move EVerest API asyncapi spec and build and provide HTMLs as part of EVerest doc (#1564)
* docs(api): Move asyncapi spec and provide HTMLs as part of EVerest doc --------- Signed-off-by: Christoph Burandt <christoph.burandt@pionix.de>
1 parent a958f42 commit 676318e

49 files changed

Lines changed: 596 additions & 173 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ endif()
6363

6464
option(CREATE_SYMLINKS "Create symlinks to javascript modules and auxillary files - for development purposes" OFF)
6565
option(CMAKE_RUN_CLANG_TIDY "Run clang-tidy" OFF)
66-
option(EVEREST_BUILD_API_DOCS "Build EVerest API documentation" OFF)
6766
option(ISO15118_2_GENERATE_AND_INSTALL_CERTIFICATES "Automatically generate and install certificates for development purposes" ON)
6867
option(EVEREST_ENABLE_RUN_SCRIPT_GENERATION "Enables the generation of run scripts (convenience scripts for starting available configurations)" ON)
6968
option(EVEREST_BUILD_DOCS "Build EVerest documentation" OFF)

cmake/everest-generate.cmake

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,36 @@ function(_ev_add_project)
8585
endif ()
8686
endif ()
8787

88+
# check for API
89+
set(API_DIR "${EVEREST_PROJECT_DIR}/docs/source/reference/EVerest_API")
90+
if (EXISTS ${API_DIR})
91+
message(STATUS "Adding API definitions from ${API_DIR}")
92+
file(GLOB API_FILES
93+
${API_DIR}/*.yaml
94+
)
95+
96+
if(EVEREST_BUILD_DOCS)
97+
find_package(
98+
trailbook-ext-everest
99+
0.1.0
100+
REQUIRED
101+
PATHS "${CMAKE_SOURCE_DIR}/cmake"
102+
)
103+
trailbook_ev_generate_api_doc(
104+
TRAILBOOK_NAME "everest"
105+
API_FILES ${API_FILES}
106+
)
107+
endif()
108+
109+
if (CALLED_FROM_WITHIN_PROJECT)
110+
install(
111+
DIRECTORY ${API_DIR}
112+
DESTINATION "${CMAKE_INSTALL_DATADIR}/everest"
113+
FILES_MATCHING PATTERN "*.yaml"
114+
)
115+
endif ()
116+
endif ()
117+
88118
# check for errors
89119
set(ERRORS_DIR "${EVEREST_PROJECT_DIR}/errors")
90120
if (EXISTS ${ERRORS_DIR})

cmake/fetch_async_api.cmake

Lines changed: 0 additions & 28 deletions
This file was deleted.

cmake/fetch_async_api_html_template.cmake

Lines changed: 0 additions & 29 deletions
This file was deleted.

cmake/generate-api-docs.cmake

Lines changed: 0 additions & 60 deletions
This file was deleted.

cmake/trailbook-ext-everest/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The following additional features are provided:
88

99
* cmake function: `trailbook_ev_add_module_explanation()`
1010
* cmake function: `trailbook_ev_create_snapshot()`
11+
* cmake function: `trailbook_ev_generate_api_doc()`
1112
* cmake function: `trailbook_ev_generate_rst_from_manifest()`
1213
* cmake function: `trailbook_ev_generate_rst_from_interface()`
1314
* cmake function: `trailbook_ev_generate_rst_from_types()`
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
if(asyncapi-cli_DIR)
2+
message(STATUS "Using asyncapi-cli at this location: ${asyncapi-cli_DIR}")
3+
else()
4+
message(STATUS "Retrieving asyncapi-cli using FetchContent")
5+
include(FetchContent)
6+
FetchContent_Declare(
7+
asyncapi-cli
8+
GIT_REPOSITORY https://github.com/asyncapi/cli.git
9+
GIT_TAG v2.7.1
10+
)
11+
FetchContent_MakeAvailable(asyncapi-cli)
12+
set(asyncapi-cli_DIR "${asyncapi-cli_SOURCE_DIR}")
13+
set(asyncapi-cli_FIND_COMPONENTS "bundling")
14+
endif()
15+
16+
set(ASYNCAPI_CLI_INSTALL_SENTINEL_PATH "${CMAKE_CURRENT_BINARY_DIR}/generated")
17+
set(ASYNCAPI_CLI_INSTALL_SENTINEL "${ASYNCAPI_CLI_INSTALL_SENTINEL_PATH}/asyncapi_cli_install_done")
18+
19+
if(NOT TARGET asyncapi_cli_install_target)
20+
add_custom_command(
21+
OUTPUT ${ASYNCAPI_CLI_INSTALL_SENTINEL}
22+
23+
# Do installation
24+
COMMAND ${CMAKE_COMMAND} -E chdir ${asyncapi-cli_DIR} npm install
25+
COMMAND ${CMAKE_COMMAND} -E chdir ${asyncapi-cli_DIR} npm run build
26+
27+
# Create sentinel file
28+
COMMAND ${CMAKE_COMMAND} -E make_directory ${ASYNCAPI_CLI_INSTALL_SENTINEL_PATH}
29+
COMMAND ${CMAKE_COMMAND} -E touch ${ASYNCAPI_CLI_INSTALL_SENTINEL}
30+
31+
COMMENT "AsyncApi/cli Install once only"
32+
)
33+
34+
add_custom_target(asyncapi_cli_install_target
35+
DEPENDS ${ASYNCAPI_CLI_INSTALL_SENTINEL}
36+
)
37+
else()
38+
message(STATUS "Skipping definition of 'asyncapi_cli_install_target'; already exists.")
39+
endif()
40+
41+
set(ASYNCAPI_CMD ${asyncapi-cli_DIR}/bin/run)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
if(asyncapi-html-template_DIR)
2+
message(STATUS "Using existing asyncapi-html-template location: ${asyncapi-html-template_DIR}")
3+
else()
4+
find_package(asyncapi-html-template
5+
COMPONENTS bundling
6+
PATHS ../asyncapi-html-template
7+
)
8+
9+
if(NOT asyncapi-html-template_FOUND)
10+
message(STATUS "Retrieving asyncapi-html-template using FetchContent")
11+
include(FetchContent)
12+
FetchContent_Declare(
13+
asyncapi-html-template
14+
GIT_REPOSITORY https://github.com/asyncapi/html-template.git
15+
GIT_TAG v3.0.0
16+
)
17+
FetchContent_MakeAvailable(asyncapi-html-template)
18+
set(asyncapi-html-template_DIR "${asyncapi-html-template_SOURCE_DIR}")
19+
set(asyncapi-html-template_FIND_COMPONENTS "bundling")
20+
endif()
21+
endif()
22+
23+
set(ASYNCAPI_HTML_TEMPLATE_INSTALL_SENTINEL_PATH "${CMAKE_CURRENT_BINARY_DIR}/generate")
24+
set(ASYNCAPI_HTML_TEMPLATE_INSTALL_SENTINEL "${ASYNCAPI_HTML_TEMPLATE_INSTALL_SENTINEL_PATH}/asyncapi_html_template_install_done")
25+
26+
if(NOT TARGET asyncapi_html_template_install_target)
27+
add_custom_command(
28+
OUTPUT ${ASYNCAPI_HTML_TEMPLATE_INSTALL_SENTINEL}
29+
30+
# Do installation
31+
COMMAND ${CMAKE_COMMAND} -E chdir ${asyncapi-html-template_DIR} npm install
32+
33+
# Create sentinel file
34+
COMMAND ${CMAKE_COMMAND} -E make_directory ${ASYNCAPI_HTML_TEMPLATE_INSTALL_SENTINEL_PATH}
35+
COMMAND ${CMAKE_COMMAND} -E touch ${ASYNCAPI_HTML_TEMPLATE_INSTALL_SENTINEL}
36+
37+
COMMENT "AsyncApi/html-template Install once only"
38+
)
39+
40+
add_custom_target(asyncapi_html_template_install_target
41+
DEPENDS ${ASYNCAPI_HTML_TEMPLATE_INSTALL_SENTINEL}
42+
)
43+
else()
44+
message(STATUS "Skipping definition of 'asyncapi_html_template_install_target'; already exists.")
45+
endif()

0 commit comments

Comments
 (0)