From 0776e27121709a2cedf56ad5634dddb0ee139730 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 7 Apr 2022 11:47:00 -0500 Subject: [PATCH] Set sdformat version to 12.4.0 and update patches Signed-off-by: Addisu Z. Taddese --- tools/workspace/sdformat/package.BUILD.bazel | 2 + .../patches/deprecation_unit_testing.patch | 10 ++-- .../sdformat/patches/no_global_config.patch | 48 +++++++++++-------- tools/workspace/sdformat/repository.bzl | 5 +- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/tools/workspace/sdformat/package.BUILD.bazel b/tools/workspace/sdformat/package.BUILD.bazel index 435fc2a7f434..d27e2a0491ea 100644 --- a/tools/workspace/sdformat/package.BUILD.bazel +++ b/tools/workspace/sdformat/package.BUILD.bazel @@ -116,6 +116,7 @@ SDFORMAT_MOST_PUBLIC_HDRS = [ "include/sdf/Model.hh", "include/sdf/NavSat.hh", "include/sdf/Noise.hh", + "include/sdf/OutputConfig.hh", "include/sdf/Param.hh", "include/sdf/ParserConfig.hh", "include/sdf/ParticleEmitter.hh", @@ -216,6 +217,7 @@ cc_library( "src/Model.cc", "src/NavSat.cc", "src/Noise.cc", + "src/OutputConfig.cc", "src/Param.cc", "src/ParamPassing.cc", "src/ParamPassing.hh", diff --git a/tools/workspace/sdformat/patches/deprecation_unit_testing.patch b/tools/workspace/sdformat/patches/deprecation_unit_testing.patch index 7dff8db22b2e..3ae5046ade93 100644 --- a/tools/workspace/sdformat/patches/deprecation_unit_testing.patch +++ b/tools/workspace/sdformat/patches/deprecation_unit_testing.patch @@ -5,14 +5,14 @@ rely on any _actually_ deprecated elements, because they will disappear in a future upstream release. Therefore, we inject a Drake-specific element definition that will always be available. ---- src/parser.cc.orig 2021-09-30 15:33:35.000000000 -0700 -+++ src/parser.cc 2022-03-17 12:29:01.296905847 -0700 -@@ -359,7 +359,12 @@ +--- src/parser.cc.orig 2022-04-07 11:39:06.881088965 -0500 ++++ src/parser.cc 2022-04-07 11:38:32.744818095 -0500 +@@ -379,7 +379,12 @@ std::string xmldata = SDF::EmbeddedSpec("root.sdf", false); auto xmlDoc = makeSdfDoc(); xmlDoc.Parse(xmldata.c_str()); -- return initDoc(&xmlDoc, _sdf); -+ bool result = initDoc(&xmlDoc, _sdf); +- return initDoc(&xmlDoc, _config, _sdf); ++ bool result = initDoc(&xmlDoc, _config, _sdf); + ElementPtr drake_testing_element(new Element); + drake_testing_element->SetName("_drake_deprecation_unit_test_element"); + drake_testing_element->SetRequired("-1" /* deprecated */); diff --git a/tools/workspace/sdformat/patches/no_global_config.patch b/tools/workspace/sdformat/patches/no_global_config.patch index 84d0262d86bb..c621ce7cce0a 100644 --- a/tools/workspace/sdformat/patches/no_global_config.patch +++ b/tools/workspace/sdformat/patches/no_global_config.patch @@ -3,9 +3,11 @@ Change the global singleton into a bomb. Use the default config when parsing the built-in root.sdf, and in the ign_sdf command-line tool. ---- src/ParserConfig.cc.orig 2021-09-30 15:33:35.000000000 -0700 -+++ src/ParserConfig.cc 2022-03-14 22:49:17.262811731 -0700 -@@ -57,8 +57,7 @@ +diff --git src/ParserConfig.cc src/ParserConfig.cc +index f0253eef..0db1110a 100644 +--- src/ParserConfig.cc ++++ src/ParserConfig.cc +@@ -57,8 +57,7 @@ ParserConfig::ParserConfig() ///////////////////////////////////////////////// ParserConfig &ParserConfig::GlobalConfig() { @@ -15,21 +17,11 @@ in the ign_sdf command-line tool. } ///////////////////////////////////////////////// - ---- src/parser.cc.orig 2021-09-30 15:33:35.000000000 -0700 -+++ src/parser.cc 2022-03-14 23:16:20.973451521 -0700 -@@ -597,7 +597,7 @@ - - ElementPtr element(new Element); - -- initFile(filename, element); -+ initFile(filename, ParserConfig{}, element); - - // override description for include elements - tinyxml2::XMLElement *description = child->FirstChildElement("description"); ---- src/ign.cc.orig 2021-09-30 15:33:35.000000000 -0700 -+++ src/ign.cc 2022-03-15 00:13:58.609410856 -0700 -@@ -36,7 +36,7 @@ +diff --git src/ign.cc src/ign.cc +index e046d6fc..fe3ce959 100644 +--- src/ign.cc ++++ src/ign.cc +@@ -36,7 +36,7 @@ extern "C" SDFORMAT_VISIBLE int cmdCheck(const char *_path) int result = 0; sdf::Root root; @@ -38,7 +30,7 @@ in the ign_sdf command-line tool. if (!errors.empty()) { for (auto &error : errors) -@@ -85,8 +85,12 @@ +@@ -85,8 +85,12 @@ extern "C" SDFORMAT_VISIBLE int cmdCheck(const char *_path) return -1; } @@ -52,7 +44,7 @@ in the ign_sdf command-line tool. std::cerr << "Error: SDF parsing the xml failed.\n"; return -1; } -@@ -147,8 +152,13 @@ +@@ -147,8 +151,13 @@ extern "C" SDFORMAT_VISIBLE int cmdPrint(const char *_path) return -1; } @@ -67,7 +59,7 @@ in the ign_sdf command-line tool. std::cerr << "Error: SDF parsing the xml failed.\n"; return -1; } -@@ -170,7 +180,7 @@ +@@ -170,7 +179,7 @@ extern "C" SDFORMAT_VISIBLE int cmdGraph( } sdf::Root root; @@ -76,3 +68,17 @@ in the ign_sdf command-line tool. if (!errors.empty()) { std::cerr << errors << std::endl; +diff --git src/parser.cc src/parser.cc +index 5f29f93d..11c07f9a 100644 +--- src/parser.cc ++++ src/parser.cc +@@ -597,7 +597,7 @@ bool initXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf) + + ElementPtr element(new Element); + +- initFile(filename, element); ++ initFile(filename, ParserConfig{}, element); + + // override description for include elements + tinyxml2::XMLElement *description = child->FirstChildElement("description"); + diff --git a/tools/workspace/sdformat/repository.bzl b/tools/workspace/sdformat/repository.bzl index 627293c1a449..fec0d6020f68 100644 --- a/tools/workspace/sdformat/repository.bzl +++ b/tools/workspace/sdformat/repository.bzl @@ -8,11 +8,12 @@ def sdformat_repository( github_archive( name = name, repository = "ignitionrobotics/sdformat", - commit = "sdf12", + commit = "sdformat12_12.4.0", build_file = "@drake//tools/workspace/sdformat:package.BUILD.bazel", - sha256 = "af34d335c19b3dab62708d988e28d19bb041cff881c66627b8816a14be8b722f", # noqa + sha256 = "1feaa2c8867f3dbb3ddc9de34218a27cda0b881432057744b9ef12d4f26604b4", # 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_urdf.patch", ], mirrors = mirrors,