Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ign ➡️ gz] Internal functions #247

Merged
merged 8 commits into from
May 9, 2022
Merged

[ign ➡️ gz] Internal functions #247

merged 8 commits into from
May 9, 2022

Conversation

chapulina
Copy link
Contributor

Summary

Migrate functions that are internal to gz-cmake to use gz instead of ign. I considered private functions:

  • Functions that have documentation saying that they're private
  • Functions that are prefixed by _, even if their docs don't say they're private - I'm relying on convention here.
  • A few other functions that I didn't see being used by other libraries. I updated the docs to mention they're private.

It is possible that downstream projects are relying on these functions and will be broken, but that's unlikely. I'd like to reduce our API surface by making as many functions private as possible. This way we can focus our tick-tock efforts into functions that we know are used by downstream projects.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

@chapulina chapulina added the ign to gz Renaming Ignition to Gazebo. label May 3, 2022
@methylDragon
Copy link
Contributor

I'm wondering if it'll make sense to also make function/macro-local variables explicitly private, both:

  • because in the case of macros, they'll bubble up to the parent scope
  • clarity when editing the function/macro body

:O

@chapulina
Copy link
Contributor Author

make function/macro-local variables explicitly private

I tried to do that using the _ prefix, but that's just convention. Is there a way to enforce a private scope at the CMake level?

Base automatically changed from chapulina/3/parse_vars to main May 4, 2022 15:54
Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>
@methylDragon
Copy link
Contributor

methylDragon commented May 4, 2022

make function/macro-local variables explicitly private

I tried to do that using the _ prefix, but that's just convention. Is there a way to enforce a private scope at the CMake level?

Because CMake macros do inline text substitution, not really.. unless you define a function inside the macro (with the macro arg as part of the function name) and use that function. But at that point you might as well use a function 😬

Converting macros to functions naively can have follow on consequences though, because macro variables are parent scoped, but function variables are not, which, for this library at least, is probably a lot of work, and not too much of a priority imho. The _ convention is fine then 🤔

@chapulina
Copy link
Contributor Author

chapulina commented May 9, 2022

The _ convention is fine then

I'll take this to mean that you're not requesting any changes from this PR, @methylDragon . Let me know if you find any issues with it.

Copy link
Contributor

@methylDragon methylDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _ convention is fine then

I'll take this to mean that you're not requesting any changes from this PR, @methylDragon . Let me know if you find any issues with it.

Ah yes!

I think we're good to go? 🤞

Edit: The entire stack up to gazebo7 has built successfully with this version of CMake (:

@chapulina chapulina merged commit 38d3921 into main May 9, 2022
@chapulina chapulina deleted the chapulina/3/_ign branch May 9, 2022 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ign to gz Renaming Ignition to Gazebo.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants