File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ add_custom_target(google-cloud-cpp-protos)
165165
166166# Each subproject adds dependencies to this target to have their docs generated.
167167add_custom_target (doxygen-docs )
168+ add_custom_target (all -docfx )
168169
169170find_package (absl CONFIG REQUIRED )
170171if (${GOOGLE_CLOUD_CPP_ENABLE_GRPC} )
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ doc_args=(
2828 " -DCMAKE_BUILD_TYPE=Debug"
2929 " -DGOOGLE_CLOUD_CPP_GENERATE_DOXYGEN=ON"
3030 " -DGOOGLE_CLOUD_CPP_GEN_DOCS_FOR_GOOGLEAPIS_DEV=ON"
31- " -DGOOGLE_CLOUD_CPP_ENABLE=${ENABLED_FEATURES} "
31+ " -DGOOGLE_CLOUD_CPP_ENABLE=internal-docfx, ${ENABLED_FEATURES} "
3232 " -DGOOGLE_CLOUD_CPP_ENABLE_CCACHE=ON"
3333 " -DGOOGLE_CLOUD_CPP_ENABLE_WERROR=ON"
3434 " -DGOOGLE_CLOUD_CPP_DOXYGEN_CLANG_OPTIONS=-resource-dir=$( clang -print-resource-dir) "
@@ -68,6 +68,8 @@ cmake -GNinja "${doc_args[@]}" -S . -B cmake-out
6868# pre-generate all the proto headers, then call doxygen.
6969cmake --build cmake-out --target google-cloud-cpp-protos
7070cmake --build cmake-out --target doxygen-docs
71+ # TODO(#11245) - enable once all the libraries work
72+ # cmake --build cmake-out --target all-docfx
7173
7274if [[ " ${PROJECT_ID:- } " != " cloud-cpp-testing-resources" ]]; then
7375 io::log_h2 " Skipping upload of docs," \
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ RUN dnf makecache && dnf debuginfo-install -y libstdc++
4242# This is used by the docfx tool.
4343RUN dnf makecache && dnf install -y pugixml-devel
4444
45+ # This is used in the `publish-docs` build
46+ RUN dnf makecache && dnf install -y libxslt
47+
4548# Sets root's password to the empty string to enable users to get a root shell
4649# inside the container with `su -` and no password. Sudo would not work because
4750# we run these containers as the invoking user's uid, which does not exist in
Original file line number Diff line number Diff line change 1515# ~~~
1616
1717find_package (Doxygen QUIET )
18+ find_program (XSLTPROC xsltproc )
1819
1920function (google_cloud_cpp_doxygen_deploy_version VAR )
2021 set (VERSION "${PROJECT_VERSION} " )
@@ -158,6 +159,26 @@ function (google_cloud_cpp_doxygen_targets_impl library)
158159 if (opt_DEPENDS)
159160 add_dependencies (${library} -docs ${opt_DEPENDS} )
160161 endif ()
162+
163+ if (XSLTPROC AND TARGET doxygen2docfx)
164+ # Create a target to compile the XML output into docfx format.
165+ file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} /docfx" )
166+ add_custom_target (
167+ ${library} -docfx
168+ DEPENDS ${library} -docs doxygen2docfx
169+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} /docfx"
170+ COMMENT "Generate DoxFX YAML for ${library} "
171+ COMMAND
172+ ${XSLTPROC} -o
173+ "${CMAKE_CURRENT_BINARY_DIR} /xml/${library} .doxygen.xml"
174+ "${CMAKE_CURRENT_BINARY_DIR} /xml/combine.xslt"
175+ "${CMAKE_CURRENT_BINARY_DIR} /xml/index.xml"
176+ COMMAND
177+ doxygen2docfx
178+ "${CMAKE_CURRENT_BINARY_DIR} /xml/${library} .doxygen.xml"
179+ "${library} " "${VERSION} " )
180+ add_dependencies (all -docfx ${library} -docfx )
181+ endif ()
161182endfunction ()
162183
163184function (google_cloud_cpp_doxygen_targets library )
Original file line number Diff line number Diff line change @@ -173,6 +173,10 @@ function (google_cloud_cpp_enable_deps)
173173 if (experimental-opentelemetry_sdk IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
174174 list (INSERT GOOGLE_CLOUD_CPP_ENABLE 0 trace)
175175 endif ()
176+ # Building the documentation for each library depends on the docfx program.
177+ if (internal-docfx IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
178+ list (INSERT GOOGLE_CLOUD_CPP_ENABLE 0 internal-docfx)
179+ endif ()
176180 set (GOOGLE_CLOUD_CPP_ENABLE
177181 "${GOOGLE_CLOUD_CPP_ENABLE} "
178182 PARENT_SCOPE )
@@ -227,6 +231,7 @@ function (google_cloud_cpp_enable_features)
227231 foreach (feature ${GOOGLE_CLOUD_CPP_ENABLE} )
228232 if ("${feature} " STREQUAL "internal-docfx" )
229233 add_subdirectory (docfx )
234+ continue ()
230235 elseif ("${feature} " STREQUAL "generator" )
231236 add_subdirectory (generator )
232237 elseif ("${feature} " STREQUAL "experimental-storage-grpc" )
Original file line number Diff line number Diff line change @@ -64,3 +64,28 @@ ls -l $HOME/doc-pipeline/site
6464less $HOME/doc-pipeline/site/namespacegoogle.html
6565less $HOME/doc-pipeline/site/indexpage.html
6666```
67+
68+ ### Testing with one or all Libraries
69+
70+ This is a bit slow, but runs all the libraries through the docfx tool. First
71+ prepare the workspace for the ` publish-docs ` build:
72+
73+ ```
74+ ci/cloudbuild/build.sh -t publish-docs-pr
75+ ```
76+
77+ Then invoke the docfx tool in one library, for example:
78+
79+ ```
80+ ci/cloudbuild/build.sh -t publish-docs-pr --docker-shell
81+ # Run this inside the docker shell
82+ cmake --build cmake-out --target storage-docfx
83+ ```
84+
85+ Or to generate the documents for all libraries:
86+
87+ ```
88+ ci/cloudbuild/build.sh -t publish-docs-pr --docker-shell
89+ # Run this inside the docker shell
90+ cmake --build cmake-out --target all-docfx
91+ ```
You can’t perform that action at this time.
0 commit comments