Skip to content

Commit

Permalink
[workspace] Flag sdformat, ignition_math, ignition_utils as internal
Browse files Browse the repository at this point in the history
We are substantially patching these libraries to weave them into Drake.
We should not give the illusion to users that they are available for
reuse downstream.

Also take this opportunity to track the ignition => gz project rename.
  • Loading branch information
jwnimmer-tri committed Jun 1, 2022
1 parent e9ec8ea commit cf3dd6e
Show file tree
Hide file tree
Showing 22 changed files with 140 additions and 78 deletions.
8 changes: 4 additions & 4 deletions multibody/parsing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ drake_cc_library(
"//geometry:proximity_properties",
"//math:geometric_transform",
"//multibody/plant",
"@sdformat",
"@sdformat_internal//:sdformat",
"@tinyxml2",
],
)
Expand All @@ -99,7 +99,7 @@ drake_cc_library(
visibility = ["//visibility:private"],
deps = [
"//common:diagnostic_policy",
"@sdformat",
"@sdformat_internal//:sdformat",
],
)

Expand All @@ -118,7 +118,7 @@ drake_cc_library(
"//geometry:geometry_roles",
"//geometry:shape_specification",
"//multibody/plant:coulomb_friction",
"@sdformat",
"@sdformat_internal//:sdformat",
],
)

Expand All @@ -136,7 +136,7 @@ drake_cc_library(
":detail_urdf_parser",
":scoped_names",
"//multibody/plant",
"@sdformat",
"@sdformat_internal//:sdformat",
],
)

Expand Down
6 changes: 3 additions & 3 deletions tools/workspace/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -87,7 +87,7 @@ _DRAKE_EXTERNAL_PACKAGE_INSTALLS = ["@%s//:install" % p for p in [
"petsc",
"pybind11",
"qhull",
"sdformat",
"sdformat_internal",
"spdlog",
"tinyobjloader",
"usockets",
Expand Down
22 changes: 16 additions & 6 deletions tools/workspace/default.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
35 changes: 35 additions & 0 deletions tools/workspace/gz_math_internal/repository.bzl
Original file line number Diff line number Diff line change
@@ -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)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
35 changes: 35 additions & 0 deletions tools/workspace/gz_utils_internal/repository.bzl
Original file line number Diff line number Diff line change
@@ -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)
18 changes: 0 additions & 18 deletions tools/workspace/ignition_math/repository.bzl

This file was deleted.

18 changes: 0 additions & 18 deletions tools/workspace/ignition_utils/repository.bzl

This file was deleted.

21 changes: 0 additions & 21 deletions tools/workspace/sdformat/repository.bzl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -15,7 +15,7 @@ drake_cc_binary(
deps = [
"//common:essential",
"@gflags",
"@sdformat//:ign_sdf_cmdline",
"@sdformat_internal//:ign_sdf_cmdline",
],
)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
Expand Down Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions tools/workspace/sdformat_internal/repository.bzl
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit cf3dd6e

Please sign in to comment.