Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit f7f7334

Browse files
authored
Build fix: cmake-format and bazel.
* Format with cmake-format 0.6.0. The new version changes the amount of indentation. * Upgrade bazel or else we get a prometheus-cpp BUILD error.
1 parent f718f3d commit f7f7334

File tree

13 files changed

+389
-445
lines changed

13 files changed

+389
-445
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ if(CCACHE_PROGRAM)
2121
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
2222
endif()
2323

24-
project(opencensus-cpp VERSION 0.5.0 LANGUAGES CXX)
24+
project(
25+
opencensus-cpp
26+
VERSION 0.5.0
27+
LANGUAGES CXX)
2528

2629
option(FUZZER "Either OFF or e.g. -fsanitize=fuzzer,address" OFF)
2730

cmake/OpenCensusDeps.cmake

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,22 @@
1414

1515
include(FetchContent)
1616

17-
FetchContent_Declare(googletest
18-
GIT_REPOSITORY https://github.com/abseil/googletest
19-
GIT_TAG ed2fe122f8dc9aca844d724986d1d5cf5b65ea4e)
20-
FetchContent_Declare(abseil
21-
GIT_REPOSITORY https://github.com/abseil/abseil-cpp
22-
GIT_TAG 2c8421e1c6cef0da9e8a20b01c15256ec9ec116d)
23-
FetchContent_Declare(prometheus
24-
GIT_REPOSITORY https://github.com/jupp0r/prometheus-cpp
25-
GIT_TAG master)
26-
FetchContent_Declare(benchmark
27-
GIT_REPOSITORY https://github.com/google/benchmark
28-
GIT_TAG master)
17+
FetchContent_Declare(
18+
googletest
19+
GIT_REPOSITORY https://github.com/abseil/googletest
20+
GIT_TAG ed2fe122f8dc9aca844d724986d1d5cf5b65ea4e)
21+
FetchContent_Declare(
22+
abseil
23+
GIT_REPOSITORY https://github.com/abseil/abseil-cpp
24+
GIT_TAG 2c8421e1c6cef0da9e8a20b01c15256ec9ec116d)
25+
FetchContent_Declare(
26+
prometheus
27+
GIT_REPOSITORY https://github.com/jupp0r/prometheus-cpp
28+
GIT_TAG master)
29+
FetchContent_Declare(
30+
benchmark
31+
GIT_REPOSITORY https://github.com/google/benchmark
32+
GIT_TAG master)
2933

3034
FetchContent_GetProperties(googletest)
3135
if(BUILD_TESTING)
@@ -60,12 +64,18 @@ endif()
6064
FetchContent_GetProperties(prometheus)
6165
if(NOT prometheus_POPULATED)
6266
message(STATUS "Dependency: prometheus")
63-
set(ENABLE_PUSH OFF CACHE BOOL "Build prometheus-cpp push library" FORCE)
64-
set(ENABLE_PULL OFF CACHE BOOL "Build prometheus-cpp pull library" FORCE)
67+
set(ENABLE_PUSH
68+
OFF
69+
CACHE BOOL "Build prometheus-cpp push library" FORCE)
70+
set(ENABLE_PULL
71+
OFF
72+
CACHE BOOL "Build prometheus-cpp pull library" FORCE)
6573
set(ENABLE_COMPRESSION
6674
OFF
6775
CACHE BOOL "Enable gzip compression for prometheus-cpp" FORCE)
68-
set(ENABLE_TESTING OFF CACHE BOOL "Build test for prometheus-cpp" FORCE)
76+
set(ENABLE_TESTING
77+
OFF
78+
CACHE BOOL "Build test for prometheus-cpp" FORCE)
6979
FetchContent_Populate(prometheus)
7080
add_subdirectory(${prometheus_SOURCE_DIR} ${prometheus_BINARY_DIR}
7181
EXCLUDE_FROM_ALL)

cmake/OpenCensusHelpers.cmake

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ function(prepend_opencensus OUT DEPS)
2222
list(APPEND _DEPS "opencensus_${dep}")
2323
endif()
2424
endforeach()
25-
set(${OUT} ${_DEPS} PARENT_SCOPE)
25+
set(${OUT}
26+
${_DEPS}
27+
PARENT_SCOPE)
2628
endfunction()
2729

2830
# Helper function like bazel's cc_test. Usage:
@@ -33,10 +35,7 @@ function(opencensus_test NAME SRC)
3335
set(_NAME "opencensus_${NAME}")
3436
add_executable(${_NAME} ${SRC})
3537
prepend_opencensus(DEPS "${ARGN}")
36-
target_link_libraries(${_NAME}
37-
"${DEPS}"
38-
gmock
39-
gtest_main)
38+
target_link_libraries(${_NAME} "${DEPS}" gmock gtest_main)
4039
add_test(NAME ${_NAME} COMMAND ${_NAME})
4140
endif()
4241
endfunction()
@@ -57,11 +56,7 @@ endfunction()
5756
# Helper function like bazel's cc_library. Libraries are namespaced as
5857
# opencensus_* and public libraries are also aliased as opencensus-cpp::*.
5958
function(opencensus_lib NAME)
60-
cmake_parse_arguments(ARG
61-
"PUBLIC"
62-
""
63-
"SRCS;DEPS"
64-
${ARGN})
59+
cmake_parse_arguments(ARG "PUBLIC" "" "SRCS;DEPS" ${ARGN})
6560
set(_NAME "opencensus_${NAME}")
6661
prepend_opencensus(ARG_DEPS "${ARG_DEPS}")
6762
if(ARG_SRCS)

examples/helloworld/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
find_package(Threads REQUIRED)
1616

1717
add_executable(opencensus_examples_helloworld helloworld.cc)
18-
target_link_libraries(opencensus_examples_helloworld
19-
absl::strings
20-
opencensus-cpp::exporters_stats_stdout
21-
opencensus-cpp::exporters_trace_stdout
22-
opencensus-cpp::stats
23-
opencensus-cpp::trace
24-
Threads::Threads)
18+
target_link_libraries(
19+
opencensus_examples_helloworld
20+
absl::strings
21+
opencensus-cpp::exporters_stats_stdout
22+
opencensus-cpp::exporters_trace_stdout
23+
opencensus-cpp::stats
24+
opencensus-cpp::trace
25+
Threads::Threads)

opencensus/common/internal/CMakeLists.txt

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
opencensus_lib(common_hostname
16-
SRCS
17-
hostname.cc
18-
DEPS
19-
absl::strings)
20-
21-
opencensus_lib(common_random
22-
SRCS
23-
random.cc
24-
DEPS
25-
absl::base
26-
absl::synchronization
27-
absl::time)
15+
opencensus_lib(common_hostname SRCS hostname.cc DEPS absl::strings)
16+
17+
opencensus_lib(
18+
common_random
19+
SRCS
20+
random.cc
21+
DEPS
22+
absl::base
23+
absl::synchronization
24+
absl::time)
2825

2926
opencensus_lib(common_stats_object DEPS absl::time)
3027

@@ -40,8 +37,5 @@ opencensus_test(common_random_test random_test.cc common_random)
4037

4138
opencensus_benchmark(common_random_benchmark random_benchmark.cc common_random)
4239

43-
opencensus_test(common_stats_object_test
44-
stats_object_test.cc
45-
common_stats_object
46-
absl::strings
47-
absl::span)
40+
opencensus_test(common_stats_object_test stats_object_test.cc
41+
common_stats_object absl::strings absl::span)

opencensus/context/CMakeLists.txt

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,24 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
opencensus_lib(context
16-
PUBLIC
17-
SRCS
18-
internal/context.cc
19-
internal/with_context.cc
20-
DEPS
21-
tags
22-
trace)
15+
opencensus_lib(
16+
context
17+
PUBLIC
18+
SRCS
19+
internal/context.cc
20+
internal/with_context.cc
21+
DEPS
22+
tags
23+
trace)
2324

24-
opencensus_test(context_context_test
25-
internal/context_test.cc
26-
context
27-
tags_context_util
28-
tags_with_tag_map
29-
trace_context_util
30-
trace_with_span)
25+
opencensus_test(
26+
context_context_test
27+
internal/context_test.cc
28+
context
29+
tags_context_util
30+
tags_with_tag_map
31+
trace_context_util
32+
trace_with_span)
3133

3234
opencensus_test(context_with_context_test internal/with_context_test.cc context)
3335

opencensus/exporters/stats/prometheus/CMakeLists.txt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
opencensus_lib(exporters_stats_prometheus
16-
PUBLIC
17-
SRCS
18-
internal/prometheus_exporter.cc
19-
DEPS
20-
exporters_stats_prometheus_utils
21-
stats)
15+
opencensus_lib(
16+
exporters_stats_prometheus
17+
PUBLIC
18+
SRCS
19+
internal/prometheus_exporter.cc
20+
DEPS
21+
exporters_stats_prometheus_utils
22+
stats)
2223

23-
opencensus_lib(exporters_stats_prometheus_utils
24-
SRCS
25-
internal/prometheus_utils.cc
26-
DEPS
27-
stats
28-
absl::strings
29-
absl::time
30-
prometheus-cpp::core)
24+
opencensus_lib(
25+
exporters_stats_prometheus_utils
26+
SRCS
27+
internal/prometheus_utils.cc
28+
DEPS
29+
stats
30+
absl::strings
31+
absl::time
32+
prometheus-cpp::core)
3133

32-
opencensus_test(exporters_stats_prometheus_utils_test
33-
internal/prometheus_utils_test.cc
34-
exporters_stats_prometheus_utils
35-
stats
36-
stats_test_utils)
34+
opencensus_test(
35+
exporters_stats_prometheus_utils_test internal/prometheus_utils_test.cc
36+
exporters_stats_prometheus_utils stats stats_test_utils)

opencensus/exporters/stats/stdout/CMakeLists.txt

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
opencensus_lib(exporters_stats_stdout
16-
PUBLIC
17-
SRCS
18-
internal/stdout_exporter.cc
19-
DEPS
20-
stats
21-
absl::memory
22-
absl::strings
23-
absl::time)
15+
opencensus_lib(
16+
exporters_stats_stdout
17+
PUBLIC
18+
SRCS
19+
internal/stdout_exporter.cc
20+
DEPS
21+
stats
22+
absl::memory
23+
absl::strings
24+
absl::time)
2425

25-
opencensus_test(exporters_stats_stdout_test
26-
internal/stdout_exporter_test.cc
27-
exporters_stats_stdout
28-
stats
29-
stats_test_utils
30-
absl::time)
26+
opencensus_test(exporters_stats_stdout_test internal/stdout_exporter_test.cc
27+
exporters_stats_stdout stats stats_test_utils absl::time)

opencensus/exporters/trace/stdout/CMakeLists.txt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
opencensus_lib(exporters_trace_stdout
16-
PUBLIC
17-
SRCS
18-
internal/stdout_exporter.cc
19-
DEPS
20-
trace
21-
absl::base
22-
absl::memory)
15+
opencensus_lib(
16+
exporters_trace_stdout
17+
PUBLIC
18+
SRCS
19+
internal/stdout_exporter.cc
20+
DEPS
21+
trace
22+
absl::base
23+
absl::memory)
2324

24-
opencensus_test(exporters_trace_stdout_test
25-
internal/stdout_exporter_test.cc
26-
exporters_trace_stdout
27-
trace
28-
absl::time)
25+
opencensus_test(exporters_trace_stdout_test internal/stdout_exporter_test.cc
26+
exporters_trace_stdout trace absl::time)

0 commit comments

Comments
 (0)