diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..f2d06137 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,12 @@ +common --enable_bzlmod +common --lockfile_mode=off + +# Add C++17 compiler flags. +build --cxxopt=-std=c++17 +build --host_cxxopt=-std=c++17 + +build --force_pic +build --strip=never +build --strict_system_includes +build --fission=dbg +build --features=per_object_debug_info diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 00000000..66ce77b7 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.0.0 diff --git a/.gitignore b/.gitignore index 9cd526d6..e7f7852a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,13 @@ +# CMake folders build build_* + +# OS generated files .DS_Store *.swp + +# Python generaated files +*.pyc + +# Bazel generated files +bazel-* diff --git a/BUILD.bazel b/BUILD.bazel index 9ebf6f9c..96ad4009 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,22 +1,9 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_configure_header", - "gz_export_header", - "gz_include_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) +load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") +load("@rules_gz//gz:headers.bzl", "gz_configure_header", "gz_export_header", "gz_include_header") load("@rules_license//rules:license.bzl", "license") package( - default_applicable_licenses = [GZ_ROOT + "common:license"], - default_visibility = GZ_VISIBILITY, - features = GZ_FEATURES, + default_applicable_licenses = [":license"], ) license( @@ -24,9 +11,10 @@ license( package_name = "gz-common", ) -licenses(["notice"]) - -exports_files(["LICENSE"]) +exports_files([ + "LICENSE", + "MODULE.bazel", +]) gz_configure_header( name = "config", @@ -45,26 +33,21 @@ gz_export_header( public_headers_no_gen = glob([ "include/gz/common/*.hh", "include/gz/common/detail/*.hh", - "include/gz/common/graph/*.hh", ]) private_headers = glob(["src/*.hh"]) sources = glob( ["src/*.cc"], - exclude = [ - "src/Plugin.cc", - "src/PluginLoader.cc", - "src/*_TEST.cc", - ], + exclude = ["src/*_TEST.cc"], ) gz_include_header( - name = "commonhh_genrule", + name = "common_hh_genrule", out = "include/gz/common.hh", hdrs = public_headers_no_gen + [ - "include/gz/common/config.hh", "include/gz/common/Export.hh", + "include/gz/common/config.hh", ], ) @@ -75,39 +58,49 @@ public_headers = public_headers_no_gen + [ ] cc_library( - name = "common", + name = "gz-common", srcs = sources + private_headers, hdrs = public_headers, - copts = [ - "-fexceptions", - "-Wno-unused-value", - ], + copts = ["-fexceptions"], includes = ["include"], + visibility = ["//visibility:public"], deps = [ - GZ_ROOT + "utils", - GZ_ROOT + "math", - "@uuid", + "@gz-utils", + "@libuuid//:uuid", ], ) +# Tests test_sources = glob( - include = ["src/*_TEST.cc"], - exclude = [ - "src/PluginUtils_TEST.cc", - "src/PluginLoader_TEST.cc", + [ + "src/*_TEST.cc", ], ) [cc_test( name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), srcs = [src], - copts = ["-fexceptions"], deps = [ - ":common", - GZ_ROOT + "common/testing", - "@gtest", - "@gtest//:gtest_main", + ":gz-common", + "//testing", + "@gz-math", + "@googletest//:gtest_main", ], ) for src in test_sources] -add_lint_tests() +# Bazel linting +buildifier( + name = "buildifier.fix", + exclude_patterns = ["./.git/*"], + lint_mode = "fix", + mode = "fix", +) + +buildifier_test( + name = "buildifier.test", + exclude_patterns = ["./.git/*"], + lint_mode = "warn", + mode = "diff", + no_sandbox = True, + workspace = "//:MODULE.bazel", +) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..c71af546 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,15 @@ +## MODULE.bazel +module( + name = "gz-common", + repo_name = "org_gazebosim_gz-common", +) + +bazel_dep(name = "buildifier_prebuilt", version = "6.1.2") +bazel_dep(name = "googletest", version = "1.14.0") +bazel_dep(name = "rules_license", version = "0.0.8") + +bazel_dep(name = "rules_gz") +bazel_dep(name = "gz-utils") +bazel_dep(name = "gz-math") + +bazel_dep(name = "libuuid", version = "2.39.3.bcr.1") diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 00000000..e69de29b diff --git a/av/BUILD.bazel b/av/BUILD.bazel index 8f833d54..e69de29b 100644 --- a/av/BUILD.bazel +++ b/av/BUILD.bazel @@ -1,82 +0,0 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_export_header", - "gz_include_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) - -package( - default_applicable_licenses = [GZ_ROOT + "common:license"], - features = GZ_FEATURES, -) - -public_headers_no_gen = glob([ - "include/gz/common/*.hh", - "include/gz/common/**/*.hh", -]) - -sources = glob( - ["src/*.cc"], - exclude = ["src/*_TEST.cc"], -) - -test_sources = glob(["src/*_TEST.cc"]) - -gz_export_header( - name = "include/gz/common/av/Export.hh", - export_base = "GZ_COMMON_AV", - lib_name = "gz-common-av", - visibility = ["//visibility:private"], -) - -gz_include_header( - name = "av_hh_genrule", - out = "include/gz/common/av.hh", - hdrs = public_headers_no_gen + [ - "include/gz/common/av/Export.hh", - ], -) - -public_headers = public_headers_no_gen + [ - "include/gz/common/av/Export.hh", - "include/gz/common/av.hh", -] - -cc_library( - name = "av", - srcs = sources, - hdrs = public_headers, - includes = ["include"], - visibility = GZ_VISIBILITY, - deps = [ - GZ_ROOT + "common", - GZ_ROOT + "utils", - "@ffmpeg//:libavcodec", - "@ffmpeg//:libavformat", - "@ffmpeg//:libavutil", - "@ffmpeg//:libswscale", - ], -) - -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], - data = [GZ_ROOT + "common/test:data"], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "common", - }, - deps = [ - ":av", - GZ_ROOT + "common/testing", - "@gtest//:gtest_main", - ], -) for src in test_sources] - -add_lint_tests() diff --git a/events/BUILD.bazel b/events/BUILD.bazel index 23af24c1..e69de29b 100644 --- a/events/BUILD.bazel +++ b/events/BUILD.bazel @@ -1,73 +0,0 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_export_header", - "gz_include_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) - -package( - default_applicable_licenses = [GZ_ROOT + "common:license"], - features = GZ_FEATURES, -) - -public_headers_no_gen = glob([ - "include/gz/common/*.hh", - "include/gz/common/**/*.hh", -]) - -sources = glob( - ["src/*.cc"], - exclude = ["src/*_TEST.cc"], -) - -test_sources = glob(["src/*_TEST.cc"]) - -gz_export_header( - name = "include/gz/common/events/Export.hh", - export_base = "GZ_COMMON_EVENTS", - lib_name = "gz-common-events", - visibility = ["//visibility:private"], -) - -gz_include_header( - name = "events_hh_genrule", - out = "include/gz/common/events.hh", - hdrs = public_headers_no_gen + [ - "include/gz/common/events/Export.hh", - ], -) - -public_headers = public_headers_no_gen + [ - "include/gz/common/events/Export.hh", - "include/gz/common/events.hh", -] - -cc_library( - name = "events", - srcs = sources, - hdrs = public_headers, - includes = ["include"], - visibility = GZ_VISIBILITY, - deps = [ - GZ_ROOT + "common", - GZ_ROOT + "utils", - ], -) - -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], - deps = [ - ":events", - GZ_ROOT + "common/testing", - "@gtest//:gtest_main", - ], -) for src in test_sources] - -add_lint_tests() diff --git a/geospatial/BUILD.bazel b/geospatial/BUILD.bazel index 317adb24..e69de29b 100644 --- a/geospatial/BUILD.bazel +++ b/geospatial/BUILD.bazel @@ -1,84 +0,0 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_export_header", - "gz_include_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) - -package( - default_applicable_licenses = [GZ_ROOT + "common:license"], - features = GZ_FEATURES, -) - -public_headers_no_gen = glob([ - "include/gz/common/*.hh", - "include/gz/common/**/*.hh", -]) - -sources = glob( - ["src/*.cc"], - exclude = ["src/*_TEST.cc"], -) - -test_sources = glob(["src/*_TEST.cc"]) - -gz_export_header( - name = "include/gz/common/geospatial/Export.hh", - export_base = "GZ_COMMON_GEOSPATIAL", - lib_name = "gz-common-geospatial", - visibility = ["//visibility:private"], -) - -gz_include_header( - name = "geospatial_hh_genrule", - out = "include/gz/common/geospatial.hh", - hdrs = public_headers_no_gen + [ - "include/gz/common/geospatial/Export.hh", - ], -) - -public_headers = public_headers_no_gen + [ - "include/gz/common/geospatial/Export.hh", - "include/gz/common/geospatial.hh", -] - -cc_library( - name = "geospatial", - srcs = sources, - hdrs = public_headers, - copts = [ - "-Wno-unused-value", - "-fexceptions", - ], - includes = ["include"], - visibility = GZ_VISIBILITY, - deps = [ - GZ_ROOT + "common", - GZ_ROOT + "common/graphics", - GZ_ROOT + "utils", - "@gdal", - ], -) - -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], - data = [GZ_ROOT + "common/test:data"], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "common", - }, - deps = [ - ":geospatial", - GZ_ROOT + "common/testing", - "@gtest//:gtest_main", - ], -) for src in test_sources] - -add_lint_tests() diff --git a/graphics/BUILD.bazel b/graphics/BUILD.bazel index dfeeaa4f..e69de29b 100644 --- a/graphics/BUILD.bazel +++ b/graphics/BUILD.bazel @@ -1,90 +0,0 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_export_header", - "gz_include_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) - -package( - default_applicable_licenses = [GZ_ROOT + "common:license"], - features = GZ_FEATURES, -) - -public_headers_no_gen = glob([ - "include/gz/common/*.hh", - "include/gz/common/**/*.hh", -]) - -private_headers = glob(["src/VHACD/*.h"]) - -sources = glob( - ["src/*.cc"], - exclude = ["src/*_TEST.cc"], -) - -test_sources = glob(["src/*_TEST.cc"]) - -gz_export_header( - name = "include/gz/common/graphics/Export.hh", - export_base = "GZ_COMMON_GRAPHICS", - lib_name = "gz-common-graphics", - visibility = ["//visibility:private"], -) - -gz_include_header( - name = "graphics_hh_genrule", - out = "include/gz/common/graphics.hh", - hdrs = public_headers_no_gen + [ - "include/gz/common/graphics/Export.hh", - ], -) - -public_headers = public_headers_no_gen + [ - "include/gz/common/graphics/Export.hh", - "include/gz/common/graphics.hh", - "src/tiny_obj_loader.h", -] - -cc_library( - name = "graphics", - srcs = sources + private_headers, - hdrs = public_headers, - copts = [ - "-Wno-implicit-fallthrough", - "-Wno-unused-value", - ], - includes = ["include"], - visibility = GZ_VISIBILITY, - deps = [ - "@assimp", - "@freeimage", - "@glib", - "@gts", - "@tinyxml2", - GZ_ROOT + "common", - GZ_ROOT + "utils", - ], -) - -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], - data = [GZ_ROOT + "common/test:data"], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "common", - }, - deps = [ - ":graphics", - GZ_ROOT + "common/testing", - "@gtest//:gtest_main", - ], -) for src in test_sources] - -add_lint_tests() diff --git a/io/BUILD.bazel b/io/BUILD.bazel index 5a99ada6..e69de29b 100644 --- a/io/BUILD.bazel +++ b/io/BUILD.bazel @@ -1,80 +0,0 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_export_header", - "gz_include_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) - -package( - default_applicable_licenses = [GZ_ROOT + "common:license"], - features = GZ_FEATURES, -) - -public_headers_no_gen = glob([ - "include/gz/common/*.hh", - "include/gz/common/**/*.hh", -]) - -sources = glob( - ["src/*.cc"], - exclude = ["src/*_TEST.cc"], -) - -test_sources = glob(["src/*_TEST.cc"]) - -gz_export_header( - name = "include/gz/common/io/Export.hh", - export_base = "GZ_COMMON_IO", - lib_name = "gz-common-io", - visibility = ["//visibility:private"], -) - -gz_include_header( - name = "io_hh_genrule", - out = "include/gz/common/io.hh", - hdrs = public_headers_no_gen + [ - "include/gz/common/io/Export.hh", - ], -) - -public_headers = public_headers_no_gen + [ - "include/gz/common/io/Export.hh", - "include/gz/common/io.hh", -] - -cc_library( - name = "io", - srcs = sources, - hdrs = public_headers, - copts = [ - "-fexceptions", - ], - includes = ["include"], - visibility = GZ_VISIBILITY, - deps = [ - GZ_ROOT + "common", - GZ_ROOT + "utils", - ], -) - -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "common", - }, - deps = [ - ":io", - GZ_ROOT + "common/testing", - "@gtest//:gtest_main", - ], -) for src in test_sources] - -add_lint_tests() diff --git a/profiler/BUILD.bazel b/profiler/BUILD.bazel index 1bbd351e..e69de29b 100644 --- a/profiler/BUILD.bazel +++ b/profiler/BUILD.bazel @@ -1,132 +0,0 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "cmake_configure_file", - "gz_export_header", - "gz_include_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) - -package( - default_applicable_licenses = [GZ_ROOT + "common:license"], - features = GZ_FEATURES, -) - -# Configuration for UNIX -RMT_ENABLED = 1 - -RMT_USE_TINYCRT = 0 - -RMT_USE_CUDA = 0 - -RMT_USE_D3D11 = 0 - -RMT_USE_OPENGL = 1 - -RMT_USE_METAL = 0 - -cmake_configure_file( - name = "remotery_config", - src = "src/RemoteryConfig.h.in", - out = "include/RemoteryConfig.h", - cmakelists = ["CMakeLists.txt"], - defines = [ - "RMT_ENABLED=%d" % RMT_ENABLED, - "RMT_USE_TINYCRT=%d" % RMT_USE_TINYCRT, - "RMT_USE_CUDA=%d" % RMT_USE_CUDA, - "RMT_USE_D3D11=%d" % RMT_USE_D3D11, - "RMT_USE_OPENGL=%d" % RMT_USE_OPENGL, - "RMT_USE_METAL=%d" % RMT_USE_METAL, - ], - visibility = ["//visibility:private"], -) - -public_headers_no_gen = [ - "include/gz/common/Profiler.hh", -] - -sources = [ - "src/Profiler.cc", - "src/RemoteryProfilerImpl.cc", -] - -gz_export_header( - name = "include/gz/common/profiler/Export.hh", - export_base = "GZ_COMMON_PROFILER", - lib_name = "gz-common-profiler", - visibility = ["//visibility:private"], -) - -gz_include_header( - name = "profiler_hh_genrule", - out = "include/gz/common/profiler.hh", - hdrs = public_headers_no_gen + [ - "include/gz/common/profiler/Export.hh", - ], -) - -public_headers = public_headers_no_gen + [ - "include/gz/common/profiler/Export.hh", - "include/gz/common/profiler.hh", -] - -private_headers = [ - "src/ProfilerImpl.hh", - "src/RemoteryProfilerImpl.hh", - "include/RemoteryConfig.h", -] - -cc_library( - name = "remotery", - srcs = ["src/Remotery/lib/Remotery.c"], - hdrs = ["src/Remotery/lib/Remotery.h"], - includes = ["src/Remotery/lib"], -) - -cc_library( - name = "profiler", - srcs = sources, - hdrs = public_headers + private_headers, - defines = [ - "GZ_PROFILER_ENABLE=1", - "GZ_PROFILER_REMOTERY=1", - ], - includes = ["include"], - visibility = GZ_VISIBILITY, - deps = [ - GZ_ROOT + "common", - ":remotery", - ], -) - -cc_test( - name = "Profiler_Disabled_TEST", - srcs = ["src/Profiler_Disabled_TEST.cc"], - copts = ["-Wno-macro-redefined"], - defines = [ - "GZ_PROFILER_ENABLE=0", - "GZ_PROFILER_REMOTERY=0", - ], - deps = [ - ":profiler", - "@gtest", - "@gtest//:gtest_main", - ], -) - -cc_test( - name = "Profiler_Remotery_TEST", - srcs = ["src/Profiler_Remotery_TEST.cc"], - deps = [ - ":profiler", - "@gtest", - "@gtest//:gtest_main", - ], -) - -add_lint_tests() diff --git a/test/BUILD.bazel b/test/BUILD.bazel index b0c103bb..e69de29b 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -1,55 +0,0 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) - -package( - default_applicable_licenses = [GZ_ROOT + "common:license"], - features = GZ_FEATURES, -) - -cc_test( - name = "INTEGRATION_console", - srcs = ["integration/console.cc"], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "common", - }, - deps = [ - GZ_ROOT + "common", - GZ_ROOT + "common/testing", - "@gtest//:gtest_main", - ], -) - -cc_test( - name = "INTEGRATION_mesh", - srcs = ["integration/mesh.cc"], - data = [ - "data/box.dae", - "data/box.fbx", - "data/box.glb", - "data/box.mtl", - "data/box.obj", - ], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "common", - }, - deps = [ - GZ_ROOT + "common", - GZ_ROOT + "common/graphics", - GZ_ROOT + "common/testing", - GZ_ROOT + "math", - "@gtest//:gtest_main", - ], -) - -exports_files(["data"]) - -add_lint_tests() diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel index be0dd2c6..b7760beb 100644 --- a/testing/BUILD.bazel +++ b/testing/BUILD.bazel @@ -1,82 +1,81 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "gz_export_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) +load("@rules_gz//gz:headers.bzl", "gz_include_header", "gz_export_header") +load("@rules_license//rules:license.bzl", "license") package( - default_applicable_licenses = [GZ_ROOT + "common:license"], - features = GZ_FEATURES, + default_applicable_licenses = ["//:license"], ) +public_headers_no_gen = glob([ + "include/gz/common/testing/*.hh", + "include/gz/common/testing/detail/*.hh", +]) + gz_export_header( name = "include/gz/common/testing/Export.hh", export_base = "GZ_COMMON_TESTING", - lib_name = "gz-common-testing", + lib_name = "gz-common", visibility = ["//visibility:private"], ) -public_headers = glob([ - "include/gz/common/testing/*.hh", - "include/gz/common/testing/detail/*.hh", -]) + ["include/gz/common/testing/Export.hh"] +public_headers = public_headers_no_gen + [ + "include/gz/common/testing/Export.hh" +] + +gz_include_header( + name = "testing_hh_genrule", + out = "include/gz/common/testing.hh", + hdrs = public_headers, +) cc_library( name = "testing", srcs = [ - "src/BazelTestPaths.cc", - "src/CMakeTestPaths.cc", - "src/TestPaths.cc", - "src/Utils.cc", + "src/BazelTestPaths.cc", + "src/CMakeTestPaths.cc", + "src/RedirectConsoleStream.cc", + "src/TestPaths.cc", + "src/Utils.cc" + ], + hdrs = public_headers + [ + "include/gz/common/testing.hh", ], - hdrs = public_headers, - copts = ["-fexceptions"], includes = ["include"], - visibility = ["//visibility:public"], deps = [ - GZ_ROOT + "common", + "//:gz-common", ], + visibility = ["//visibility:public"] ) cc_test( - name = "AutoLogFixture_TEST", - srcs = ["src/AutoLogFixture_TEST.cc"], - deps = [ - ":testing", - "@gtest//:gtest_main", - ], + name = "AutoLogFixture_TEST", + srcs = [ + "src/AutoLogFixture_TEST.cc", + ], + deps = [ + "@googletest//:gtest_main", + ":testing", + ] ) cc_test( - name = "BazelTestPaths_TEST", - srcs = ["src/BazelTestPaths_TEST.cc"], - data = glob(["test_files/**"]), - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "common", - }, - deps = [ - ":testing", - "@gtest//:gtest_main", - ], + name = "BazelTestPaths_TEST", + srcs = [ + "src/BazelTestPaths_TEST.cc", + ], + data = ["test_files"], + deps = [ + "@googletest//:gtest_main", + ":testing", + ] ) cc_test( - name = "Utils_TEST", - srcs = ["src/Utils_TEST.cc"], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "common", - }, - deps = [ - ":testing", - "@gtest//:gtest_main", - ], + name = "RedirectConsoleStream_TEST", + srcs = [ + "src/RedirectConsoleStream_TEST.cc", + ], + deps = [ + "@googletest//:gtest_main", + ":testing", + ] ) - -add_lint_tests() diff --git a/testing/src/BazelTestPaths.cc b/testing/src/BazelTestPaths.cc index fdf55e33..8c38937d 100644 --- a/testing/src/BazelTestPaths.cc +++ b/testing/src/BazelTestPaths.cc @@ -20,6 +20,8 @@ #include #include +#include + namespace gz::common::testing { @@ -31,10 +33,18 @@ bool BazelTestPaths::ProjectSourcePath(std::string &_sourceDir) { std::string test_srcdir, bazel_path; - if (common::env("TEST_SRCDIR", test_srcdir) && - common::env("GZ_BAZEL_PATH", bazel_path)) + + auto env = gz::utils::env(); + + for (auto &[k, v]: env) + { + std::cout << k << " " << v << std::endl; + } + + + if (common::env("TEST_SRCDIR", test_srcdir)) { - _sourceDir = gz::common::joinPaths(test_srcdir, "gz", bazel_path); + _sourceDir = gz::common::joinPaths(test_srcdir, "_main"); return true; } else diff --git a/testing/src/TestPaths.cc b/testing/src/TestPaths.cc index af6cd036..6255ad1b 100644 --- a/testing/src/TestPaths.cc +++ b/testing/src/TestPaths.cc @@ -36,7 +36,7 @@ TestPaths::~TestPaths() = default; BuildType TestBuildType(const std::string &_projectSourcePath) { std::string gz_bazel; - bool gz_bazel_set = common::env("GZ_BAZEL", gz_bazel); + bool gz_bazel_set = common::env("BAZEL_TEST", gz_bazel); bool gz_cmake_set = !_projectSourcePath.empty(); if (gz_bazel_set && gz_cmake_set)