diff --git a/multibody/parsing/BUILD.bazel b/multibody/parsing/BUILD.bazel index e4b12c448c6e..361de302a9c3 100644 --- a/multibody/parsing/BUILD.bazel +++ b/multibody/parsing/BUILD.bazel @@ -86,7 +86,7 @@ drake_cc_library( "//geometry:proximity_properties", "//math:geometric_transform", "//multibody/plant", - "@sdformat", + "@sdformat_internal//:sdformat", "@tinyxml2", ], ) @@ -99,7 +99,7 @@ drake_cc_library( visibility = ["//visibility:private"], deps = [ "//common:diagnostic_policy", - "@sdformat", + "@sdformat_internal//:sdformat", ], ) @@ -118,7 +118,7 @@ drake_cc_library( "//geometry:geometry_roles", "//geometry:shape_specification", "//multibody/plant:coulomb_friction", - "@sdformat", + "@sdformat_internal//:sdformat", ], ) @@ -136,7 +136,7 @@ drake_cc_library( ":detail_urdf_parser", ":scoped_names", "//multibody/plant", - "@sdformat", + "@sdformat_internal//:sdformat", ], ) diff --git a/tools/workspace/BUILD.bazel b/tools/workspace/BUILD.bazel index 4dfdd3954521..048a5aa29880 100644 --- a/tools/workspace/BUILD.bazel +++ b/tools/workspace/BUILD.bazel @@ -77,8 +77,8 @@ _DRAKE_EXTERNAL_PACKAGE_INSTALLS = ["@%s//:install" % p for p in [ "fcl", "fmt", "ghc_filesystem", - "ignition_math", - "ignition_utils", + "gz_math_internal", + "gz_utils_internal", "lcm", "meshcat", "meshcat_python", @@ -87,7 +87,7 @@ _DRAKE_EXTERNAL_PACKAGE_INSTALLS = ["@%s//:install" % p for p in [ "petsc", "pybind11", "qhull", - "sdformat", + "sdformat_internal", "spdlog", "tinyobjloader", "usockets", diff --git a/tools/workspace/default.bzl b/tools/workspace/default.bzl index eee39dbd6340..040e8db9afd6 100644 --- a/tools/workspace/default.bzl +++ b/tools/workspace/default.bzl @@ -36,9 +36,11 @@ load("@drake//tools/workspace/glx:repository.bzl", "glx_repository") load("@drake//tools/workspace/googlebenchmark:repository.bzl", "googlebenchmark_repository") # noqa load("@drake//tools/workspace/gtest:repository.bzl", "gtest_repository") load("@drake//tools/workspace/gurobi:repository.bzl", "gurobi_repository") +load("@drake//tools/workspace/gz_math_internal:repository.bzl", "gz_math_internal_repository") # noqa +load("@drake//tools/workspace/gz_math_internal:repository.bzl", "ignition_math_repository") # noqa +load("@drake//tools/workspace/gz_utils_internal:repository.bzl", "gz_utils_internal_repository") # noqa +load("@drake//tools/workspace/gz_utils_internal:repository.bzl", "ignition_utils_repository") # noqa load("@drake//tools/workspace/ibex:repository.bzl", "ibex_repository") -load("@drake//tools/workspace/ignition_math:repository.bzl", "ignition_math_repository") # noqa -load("@drake//tools/workspace/ignition_utils:repository.bzl", "ignition_utils_repository") # noqa load("@drake//tools/workspace/intel_realsense_ros:repository.bzl", "intel_realsense_ros_repository") # noqa load("@drake//tools/workspace/ipopt:repository.bzl", "ipopt_repository") load("@drake//tools/workspace/json:repository.bzl", "json_repository") @@ -79,7 +81,8 @@ load("@drake//tools/workspace/ros_xacro:repository.bzl", "ros_xacro_repository") load("@drake//tools/workspace/rules_pkg:repository.bzl", "rules_pkg_repository") # noqa load("@drake//tools/workspace/rules_python:repository.bzl", "rules_python_repository") # noqa load("@drake//tools/workspace/scs:repository.bzl", "scs_repository") -load("@drake//tools/workspace/sdformat:repository.bzl", "sdformat_repository") +load("@drake//tools/workspace/sdformat_internal:repository.bzl", "sdformat_internal_repository") # noqa +load("@drake//tools/workspace/sdformat_internal:repository.bzl", "sdformat_repository") # noqa load("@drake//tools/workspace/snopt:repository.bzl", "snopt_repository") load("@drake//tools/workspace/spdlog:repository.bzl", "spdlog_repository") load("@drake//tools/workspace/stduuid:repository.bzl", "stduuid_repository") @@ -178,12 +181,16 @@ def add_default_repositories(excludes = [], mirrors = DEFAULT_MIRRORS): gtest_repository(name = "gtest", mirrors = mirrors) if "gurobi" not in excludes: gurobi_repository(name = "gurobi") + if "gz_math_internal" not in excludes: + gz_math_internal_repository(name = "gz_math_internal", mirrors = mirrors) # noqa + if "gz_utils_internal" not in excludes: + gz_utils_internal_repository(name = "gz_utils_internal", mirrors = mirrors) # noqa if "ibex" not in excludes: ibex_repository(name = "ibex", mirrors = mirrors) if "ignition_math" not in excludes: - ignition_math_repository(name = "ignition_math", mirrors = mirrors) + ignition_math_repository(name = "ignition_math") if "ignition_utils" not in excludes: - ignition_utils_repository(name = "ignition_utils", mirrors = mirrors) + ignition_utils_repository(name = "ignition_utils") if "intel_realsense_ros" not in excludes: intel_realsense_ros_repository(name = "intel_realsense_ros", mirrors = mirrors) # noqa if "ipopt" not in excludes: @@ -265,7 +272,10 @@ def add_default_repositories(excludes = [], mirrors = DEFAULT_MIRRORS): if "scs" not in excludes: scs_repository(name = "scs", mirrors = mirrors) if "sdformat" not in excludes: - sdformat_repository(name = "sdformat", mirrors = mirrors) + # Deprecated for removal on 2022-10-01. + sdformat_repository(name = "sdformat") + if "sdformat_internal" not in excludes: + sdformat_internal_repository(name = "sdformat_internal", mirrors = mirrors) # noqa if "snopt" not in excludes: snopt_repository(name = "snopt") if "spdlog" not in excludes: diff --git a/tools/workspace/ignition_math/BUILD.bazel b/tools/workspace/gz_math_internal/BUILD.bazel similarity index 100% rename from tools/workspace/ignition_math/BUILD.bazel rename to tools/workspace/gz_math_internal/BUILD.bazel diff --git a/tools/workspace/ignition_math/package.BUILD.bazel b/tools/workspace/gz_math_internal/package.BUILD.bazel similarity index 99% rename from tools/workspace/ignition_math/package.BUILD.bazel rename to tools/workspace/gz_math_internal/package.BUILD.bazel index 76341dbc9a1f..d2fdf029d7a4 100644 --- a/tools/workspace/ignition_math/package.BUILD.bazel +++ b/tools/workspace/gz_math_internal/package.BUILD.bazel @@ -159,7 +159,7 @@ public_headers = public_headers_no_gen + [ # explicitly listed sources plus private headers. The explicitly listed # hdrs= matches upstream's public headers. cc_library( - name = "ignition_math", + name = "gz_math", srcs = [ "src/Angle.cc", "src/AxisAlignedBox.cc", diff --git a/tools/workspace/gz_math_internal/repository.bzl b/tools/workspace/gz_math_internal/repository.bzl new file mode 100644 index 000000000000..93274ef75428 --- /dev/null +++ b/tools/workspace/gz_math_internal/repository.bzl @@ -0,0 +1,35 @@ +# -*- python -*- + +load("//tools/workspace:github.bzl", "github_archive") + +def gz_math_internal_repository( + name, + mirrors = None): + # When updating this commit, also remember to adjust the PROJECT_* + # constants in ./package.BUILD.bazel to match the new version number. + github_archive( + name = name, + repository = "gazebosim/gz-math", + commit = "ignition-math6_6.10.0", + sha256 = "94e853e1dfba97ebec4b6152691a89af1e94660b02f4ecdf04356b763c2848bd", # noqa + build_file = "@drake//tools/workspace/gz_math_internal:package.BUILD.bazel", # noqa + mirrors = mirrors, + ) + +# The non-internal repository rule is deprecated. + +def _deprecated(repository_ctx): + repository_ctx.file( + "BUILD.bazel", + content = """ +cc_library( + name = "ignition_math", + deps = ["@gz_math_internal//:gz_math"], + deprecation = "DRAKE DEPRECATED: The @ignition_math external is deprecated and will be removed on or after 2022-10-01.", # noqa + visibility = ["//visibility:public"], +) +""", + executable = False, + ) + +ignition_math_repository = repository_rule(implementation = _deprecated) diff --git a/tools/workspace/ignition_utils/BUILD.bazel b/tools/workspace/gz_utils_internal/BUILD.bazel similarity index 100% rename from tools/workspace/ignition_utils/BUILD.bazel rename to tools/workspace/gz_utils_internal/BUILD.bazel diff --git a/tools/workspace/ignition_utils/package.BUILD.bazel b/tools/workspace/gz_utils_internal/package.BUILD.bazel similarity index 98% rename from tools/workspace/ignition_utils/package.BUILD.bazel rename to tools/workspace/gz_utils_internal/package.BUILD.bazel index 2ce8f04787d8..1a24f95b7cc6 100644 --- a/tools/workspace/ignition_utils/package.BUILD.bazel +++ b/tools/workspace/gz_utils_internal/package.BUILD.bazel @@ -87,7 +87,7 @@ public_headers = public_headers_no_gen + [ ] cc_library( - name = "ignition_utils", + name = "gz_utils", srcs = private_headers, hdrs = public_headers, includes = ["include"], diff --git a/tools/workspace/gz_utils_internal/repository.bzl b/tools/workspace/gz_utils_internal/repository.bzl new file mode 100644 index 000000000000..970b6c7efcf7 --- /dev/null +++ b/tools/workspace/gz_utils_internal/repository.bzl @@ -0,0 +1,35 @@ +# -*- python -*- + +load("//tools/workspace:github.bzl", "github_archive") + +def gz_utils_internal_repository( + name, + mirrors = None): + github_archive( + name = name, + repository = "gazebosim/gz-utils", + # When updating this commit, also remember to adjust the PROJECT_* + # constants in ./package.BUILD.bazel to match the new version number. + commit = "ignition-utils1_1.0.0", + sha256 = "55d3285692392f9493a35b680f275ec116584baedeef90de57d2b03dfd952d9d", # noqa + build_file = "@drake//tools/workspace/gz_utils_internal:package.BUILD.bazel", # noqa + mirrors = mirrors, + ) + +# The non-internal repository rule is deprecated. + +def _deprecated(repository_ctx): + repository_ctx.file( + "BUILD.bazel", + content = """ +cc_library( + name = "ignition_utils", + deps = ["@gz_utils_internal//:gz_utils"], + deprecation = "DRAKE DEPRECATED: The @ignition_utils external is deprecated and will be removed on or after 2022-10-01.", # noqa + visibility = ["//visibility:public"], +) +""", + executable = False, + ) + +ignition_utils_repository = repository_rule(implementation = _deprecated) diff --git a/tools/workspace/ignition_math/repository.bzl b/tools/workspace/ignition_math/repository.bzl deleted file mode 100644 index f73311d54619..000000000000 --- a/tools/workspace/ignition_math/repository.bzl +++ /dev/null @@ -1,18 +0,0 @@ -# -*- python -*- - -load("//tools/workspace:github.bzl", "github_archive") - -# TODO(jwnimmer-tri) Rename this to match upstream gz-math. -def ignition_math_repository( - name, - mirrors = None): - # When updating this commit, also remember to adjust the PROJECT_* - # constants in ./package.BUILD.bazel to match the new version number. - github_archive( - name = name, - repository = "gazebosim/gz-math", - commit = "ignition-math6_6.10.0", - sha256 = "94e853e1dfba97ebec4b6152691a89af1e94660b02f4ecdf04356b763c2848bd", # noqa - build_file = "@drake//tools/workspace/ignition_math:package.BUILD.bazel", # noqa - mirrors = mirrors, - ) diff --git a/tools/workspace/ignition_utils/repository.bzl b/tools/workspace/ignition_utils/repository.bzl deleted file mode 100644 index ed6fcc6d343f..000000000000 --- a/tools/workspace/ignition_utils/repository.bzl +++ /dev/null @@ -1,18 +0,0 @@ -# -*- python -*- - -load("//tools/workspace:github.bzl", "github_archive") - -# TODO(jwnimmer-tri) Rename this to match upstream gz-utils. -def ignition_utils_repository( - name, - mirrors = None): - github_archive( - name = name, - repository = "gazebosim/gz-utils", - # When updating this commit, also remember to adjust the PROJECT_* - # constants in ./package.BUILD.bazel to match the new version number. - commit = "ignition-utils1_1.0.0", - sha256 = "55d3285692392f9493a35b680f275ec116584baedeef90de57d2b03dfd952d9d", # noqa - build_file = "@drake//tools/workspace/ignition_utils:package.BUILD.bazel", # noqa - mirrors = mirrors, - ) diff --git a/tools/workspace/sdformat/repository.bzl b/tools/workspace/sdformat/repository.bzl deleted file mode 100644 index a01d618447dd..000000000000 --- a/tools/workspace/sdformat/repository.bzl +++ /dev/null @@ -1,21 +0,0 @@ -# -*- python -*- - -load("//tools/workspace:github.bzl", "github_archive") - -def sdformat_repository( - name, - mirrors = None): - github_archive( - name = name, - repository = "gazebosim/sdformat", - commit = "sdformat12_12.5.0", - build_file = "@drake//tools/workspace/sdformat:package.BUILD.bazel", - sha256 = "3896772db68b7ca7b18bbf1945a72206885b03d3f0caf29491be5b53b79a7124", # noqa - patches = [ - "@drake//tools/workspace/sdformat:patches/console.patch", - "@drake//tools/workspace/sdformat:patches/deprecation_unit_testing.patch", # noqa - "@drake//tools/workspace/sdformat:patches/no_global_config.patch", - "@drake//tools/workspace/sdformat:patches/no_urdf.patch", - ], - mirrors = mirrors, - ) diff --git a/tools/workspace/sdformat/BUILD.bazel b/tools/workspace/sdformat_internal/BUILD.bazel similarity index 82% rename from tools/workspace/sdformat/BUILD.bazel rename to tools/workspace/sdformat_internal/BUILD.bazel index d4b739ac34f4..df9c31528512 100644 --- a/tools/workspace/sdformat/BUILD.bazel +++ b/tools/workspace/sdformat_internal/BUILD.bazel @@ -6,7 +6,7 @@ load("//tools/lint:lint.bzl", "add_lint_tests") exports_files( ["embed_sdf.py"], - visibility = ["@sdformat//:__pkg__"], + visibility = ["@sdformat_internal//:__pkg__"], ) drake_cc_binary( @@ -15,7 +15,7 @@ drake_cc_binary( deps = [ "//common:essential", "@gflags", - "@sdformat//:ign_sdf_cmdline", + "@sdformat_internal//:ign_sdf_cmdline", ], ) diff --git a/tools/workspace/sdformat/embed_sdf.py b/tools/workspace/sdformat_internal/embed_sdf.py similarity index 100% rename from tools/workspace/sdformat/embed_sdf.py rename to tools/workspace/sdformat_internal/embed_sdf.py diff --git a/tools/workspace/sdformat/ign_sdf_main.cc b/tools/workspace/sdformat_internal/ign_sdf_main.cc similarity index 100% rename from tools/workspace/sdformat/ign_sdf_main.cc rename to tools/workspace/sdformat_internal/ign_sdf_main.cc diff --git a/tools/workspace/sdformat/package.BUILD.bazel b/tools/workspace/sdformat_internal/package.BUILD.bazel similarity index 98% rename from tools/workspace/sdformat/package.BUILD.bazel rename to tools/workspace/sdformat_internal/package.BUILD.bazel index 8c9aadc7fd56..f1edb8b647cc 100644 --- a/tools/workspace/sdformat/package.BUILD.bazel +++ b/tools/workspace/sdformat_internal/package.BUILD.bazel @@ -134,7 +134,7 @@ genrule( py_binary( name = "embed_sdf", - srcs = ["@drake//tools/workspace/sdformat:embed_sdf.py"], + srcs = ["@drake//tools/workspace/sdformat_internal:embed_sdf.py"], python_version = "PY3", srcs_version = "PY3", ) @@ -241,8 +241,8 @@ cc_library( includes = ["include"], linkstatic = 1, deps = [ - "@ignition_math", - "@ignition_utils", + "@gz_math_internal//:gz_math", + "@gz_utils_internal//:gz_utils", "@tinyxml2", # N.B. It's very unusual to add a dependency from a third-party library # onto Drake, but in this case it's the simplest way to be able to send diff --git a/tools/workspace/sdformat/patches/console.patch b/tools/workspace/sdformat_internal/patches/console.patch similarity index 100% rename from tools/workspace/sdformat/patches/console.patch rename to tools/workspace/sdformat_internal/patches/console.patch diff --git a/tools/workspace/sdformat/patches/deprecation_unit_testing.patch b/tools/workspace/sdformat_internal/patches/deprecation_unit_testing.patch similarity index 100% rename from tools/workspace/sdformat/patches/deprecation_unit_testing.patch rename to tools/workspace/sdformat_internal/patches/deprecation_unit_testing.patch diff --git a/tools/workspace/sdformat/patches/no_global_config.patch b/tools/workspace/sdformat_internal/patches/no_global_config.patch similarity index 100% rename from tools/workspace/sdformat/patches/no_global_config.patch rename to tools/workspace/sdformat_internal/patches/no_global_config.patch diff --git a/tools/workspace/sdformat/patches/no_urdf.patch b/tools/workspace/sdformat_internal/patches/no_urdf.patch similarity index 100% rename from tools/workspace/sdformat/patches/no_urdf.patch rename to tools/workspace/sdformat_internal/patches/no_urdf.patch diff --git a/tools/workspace/sdformat_internal/repository.bzl b/tools/workspace/sdformat_internal/repository.bzl new file mode 100644 index 000000000000..7a76ffd38560 --- /dev/null +++ b/tools/workspace/sdformat_internal/repository.bzl @@ -0,0 +1,39 @@ +# -*- python -*- + +load("//tools/workspace:github.bzl", "github_archive") + +def sdformat_internal_repository( + name, + mirrors = None): + github_archive( + name = name, + repository = "gazebosim/sdformat", + commit = "sdformat12_12.5.0", + build_file = "@drake//tools/workspace/sdformat_internal:package.BUILD.bazel", # noqa + sha256 = "3896772db68b7ca7b18bbf1945a72206885b03d3f0caf29491be5b53b79a7124", # noqa + patches = [ + "@drake//tools/workspace/sdformat_internal:patches/console.patch", + "@drake//tools/workspace/sdformat_internal:patches/deprecation_unit_testing.patch", # noqa + "@drake//tools/workspace/sdformat_internal:patches/no_global_config.patch", # noqa + "@drake//tools/workspace/sdformat_internal:patches/no_urdf.patch", + ], + mirrors = mirrors, + ) + +# The non-internal repository rule is deprecated. + +def _deprecated(repository_ctx): + repository_ctx.file( + "BUILD.bazel", + content = """ +cc_library( + name = "sdformat", + deps = ["@sdformat_internal//:sdformat"], + deprecation = "DRAKE DEPRECATED: The @sdformat external is deprecated and will be removed on or after 2022-10-01.", # noqa + visibility = ["//visibility:public"], +) +""", + executable = False, + ) + +sdformat_repository = repository_rule(implementation = _deprecated) diff --git a/tools/workspace/sdformat/test/ign_sdf_test.py b/tools/workspace/sdformat_internal/test/ign_sdf_test.py similarity index 97% rename from tools/workspace/sdformat/test/ign_sdf_test.py rename to tools/workspace/sdformat_internal/test/ign_sdf_test.py index e13e2a7e5491..1bfc0bfecdd6 100644 --- a/tools/workspace/sdformat/test/ign_sdf_test.py +++ b/tools/workspace/sdformat_internal/test/ign_sdf_test.py @@ -57,7 +57,7 @@ class TestIgnSdf(unittest.TestCase): def setUp(self): self.maxDiff = None - self.bin = "tools/workspace/sdformat/ign_sdf" + self.bin = "tools/workspace/sdformat_internal/ign_sdf" self.input_file = os.path.join( os.environ["TEST_TMPDIR"], "example.sdf" )