Skip to content

Commit 94285ba

Browse files
authored
cleanup: doxygen is recursive in libraries (again) (#10282)
1 parent a8e601a commit 94285ba

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

cmake/GoogleCloudCppCommon.cmake

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,23 @@ if (${CMAKE_VERSION} VERSION_LESS "3.12")
3535
message(STATUS "Doxygen generation only enabled for cmake 3.9 and higher")
3636
elseif (GOOGLE_CLOUD_CPP_GENERATE_DOXYGEN)
3737
find_package(Doxygen REQUIRED)
38-
set(DOXYGEN_RECURSIVE NO)
39-
set(DOXYGEN_FILE_PATTERNS *.h *.dox)
40-
set(DOXYGEN_EXCLUDE_PATTERNS "*_test.cc" "retry_traits.h")
38+
set(DOXYGEN_FILE_PATTERNS "*.dox" "*.h")
39+
set(DOXYGEN_EXCLUDE_PATTERNS
40+
# We should skip internal directories to speed up the build. We do not
41+
# use "*/internal/*" because Doxygen breaks when we include
42+
# "*/internal/*.inc" from a public header. (Don't ask me why).
43+
"*/internal/*.h"
44+
"*/internal/*.cc"
45+
# We should skip all tests.
46+
"*_test.cc"
47+
# TODO(#9841): remove this special case when the files are removed.
48+
"retry_traits.h"
49+
# Handwritten libraries may contain the following subdirectories, which
50+
# are not customer-facing. We can skip them.
51+
"*/benchmarks/*"
52+
"*/integration_tests/*"
53+
"*/testing/*"
54+
"*/tests/*")
4155
set(DOXYGEN_EXAMPLE_RECURSIVE NO)
4256
set(DOXYGEN_EXCLUDE_SYMLINKS YES)
4357
set(DOXYGEN_QUIET YES)
@@ -110,33 +124,21 @@ elseif (GOOGLE_CLOUD_CPP_GENERATE_DOXYGEN)
110124
DOXYGEN_ALIASES
111125
"googleapis_dev_link{2}=\"https://googleapis.dev/cpp/google-cloud-\\1/${GOOGLE_CLOUD_CPP_DOXYGEN_VERSION}/\\2\""
112126
)
113-
if (NOT ("cloud" STREQUAL "${GOOGLE_CLOUD_CPP_SUBPROJECT}"))
127+
set(GOOGLE_CLOUD_CPP_DOXYGEN_INPUTS "${CMAKE_CURRENT_SOURCE_DIR}")
128+
if ("cloud" STREQUAL "${GOOGLE_CLOUD_CPP_SUBPROJECT}")
129+
# We cannot recurse from the google/cloud directory, because it will
130+
# traverse all of the libraries. So we turn off recursion and manually
131+
# provide the subdirectories to be traversed.
132+
set(DOXYGEN_RECURSIVE NO)
133+
list(APPEND GOOGLE_CLOUD_CPP_DOXYGEN_INPUTS
134+
"${CMAKE_CURRENT_SOURCE_DIR}/mocks"
135+
"${CMAKE_CURRENT_SOURCE_DIR}/doc")
136+
else ()
137+
set(DOXYGEN_RECURSIVE YES)
114138
set(DOXYGEN_TAGFILES
115139
"${GOOGLE_CLOUD_CPP_COMMON_TAG}=https://googleapis.dev/cpp/google-cloud-common/${GOOGLE_CLOUD_CPP_DOXYGEN_VERSION}/"
116140
)
117141
endif ()
118-
119-
set(GOOGLE_CLOUD_CPP_DOXYGEN_INPUTS)
120-
set(GOOGLE_CLOUD_CPP_DOXYGEN_POSSIBLE_INPUTS
121-
# Scan the current directory (duh)
122-
"${CMAKE_CURRENT_SOURCE_DIR}"
123-
# Many libraries export mock classes for public consumption
124-
"${CMAKE_CURRENT_SOURCE_DIR}/mocks"
125-
# The Bigtable and Spanner libraries have some public APIs in `admin`.
126-
"${CMAKE_CURRENT_SOURCE_DIR}/admin"
127-
"${CMAKE_CURRENT_SOURCE_DIR}/admin/mocks"
128-
# The Storage library has some public APIs in `oauth2`.
129-
"${CMAKE_CURRENT_SOURCE_DIR}/oauth2"
130-
# Scan the examples, the directory name depends on the library
131-
"${CMAKE_CURRENT_SOURCE_DIR}/samples"
132-
"${CMAKE_CURRENT_SOURCE_DIR}/examples"
133-
# The landing page and other documentation is in the doc/
134-
"${CMAKE_CURRENT_SOURCE_DIR}/doc")
135-
foreach (input IN LISTS GOOGLE_CLOUD_CPP_DOXYGEN_POSSIBLE_INPUTS)
136-
if (EXISTS "${input}")
137-
list(APPEND GOOGLE_CLOUD_CPP_DOXYGEN_INPUTS "${input}")
138-
endif ()
139-
endforeach ()
140142
doxygen_add_docs(
141143
${GOOGLE_CLOUD_CPP_SUBPROJECT}-docs "${GOOGLE_CLOUD_CPP_DOXYGEN_INPUTS}"
142144
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}

0 commit comments

Comments
 (0)