Skip to content

Commit

Permalink
Set sdformat version to 12.4.0 and update patches
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey committed Apr 7, 2022
1 parent 2d33166 commit 0776e27
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 28 deletions.
2 changes: 2 additions & 0 deletions tools/workspace/sdformat/package.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions tools/workspace/sdformat/patches/deprecation_unit_testing.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 */);
Expand Down
48 changes: 27 additions & 21 deletions tools/workspace/sdformat/patches/no_global_config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
Expand All @@ -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");

5 changes: 3 additions & 2 deletions tools/workspace/sdformat/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0776e27

Please sign in to comment.