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

Refactor Fable #227

Merged
merged 64 commits into from
Apr 22, 2024
Merged

Refactor Fable #227

merged 64 commits into from
Apr 22, 2024

Conversation

cassava
Copy link
Contributor

@cassava cassava commented Mar 28, 2024

This has so many changes I know I'm going to have a lot of work ahead of me writing what has all changed.

I have tried to put each change in its own commit for easier review.
Each commit has been compiled and tested individually.

cassava added 8 commits March 28, 2024 16:41
This follows the pattern set by other libraries, such as Boost
and nlohmann/json.
This makes it clearer that it should be included after everything else,
and if someone sorts the schema commits by accident, this will preserve
that.
BREAKING CHANGE: This commit renames a public header file and
requires that rename your #include statements:

    - #include <fable/json/with_eigen.hpp>
    + #include <fable/utility/eigen.hpp>
BREAKING CHANGE: This commit renames a public header file and
requires that rename your #include statements:

    - #include <fable/json/with_std.hpp>
    + #include <fable/utility/memory.hpp>
….hpp

BREAKING CHANGE: This commit renames a public header file and
requires that you rename your #include statements:

    - #include <fable/json/with_boost.hpp>
    + #include <fable/utility/boost_optional.hpp>
@cassava cassava added this to the 0.23.0 milestone Mar 28, 2024
@cassava cassava self-assigned this Mar 28, 2024
@cassava cassava requested a review from tobifalk as a code owner March 28, 2024 15:42
@cassava cassava force-pushed the ben/fable-refactor branch 3 times, most recently from 4bdc61e to d0f9ed5 Compare March 28, 2024 22:00
@cassava cassava force-pushed the ben/fable-refactor branch 2 times, most recently from e49b853 to 3b5cd7a Compare April 9, 2024 12:11
@clsim clsim self-requested a review April 9, 2024 14:21
@cassava cassava force-pushed the ben/fable-refactor branch from f39aff2 to 6bfee25 Compare April 9, 2024 14:29
docs/news/release-0.23.0.md Outdated Show resolved Hide resolved
docs/news/release-0.23.0.md Show resolved Hide resolved
engine/src/stack.hpp Show resolved Hide resolved
fable/include/fable/conf.hpp Outdated Show resolved Hide resolved
fable/include/fable/fable_fwd.hpp Show resolved Hide resolved
fable/src/fable/utility/chrono.cpp Outdated Show resolved Hide resolved
fable/src/fable/utility/chrono.cpp Show resolved Hide resolved
fable/src/fable/utility/chrono.cpp Show resolved Hide resolved
fable/src/fable/utility/path.cpp Outdated Show resolved Hide resolved
models/include/cloe/component/actuator.hpp Show resolved Hide resolved
@cassava cassava added the breaking change Pull requests that are potentially backwards incompatible label Apr 17, 2024
cassava added 10 commits April 19, 2024 12:52
Add serialization to and deserialization from strings
in a manner as exact as possible.
BREAKING CHANGE: If you want to use boost::optional, you now need to
include `fable/schema/boost_optional.hpp`.
…esystem::path

BREAKING CHANGE: If you want to use boost::filesystem::path, you now need to
include `fable/schema/boost_path.hpp`.
This is orthogonal with the standard library (std::vector) and allows us to add
the Array type, which corresponds to the std::array type.

BREAKING CHANGE: If you used fable::schema::Array directly you need
to rename it to fable::schema::Vector.

This is especially important as a future commit will introduce
a separate Array schema type.
BREAKING CHANGE: Packages that relied on fable to provide Boost as
a transitive dependency need to add it to their project themselves:

For example, with CMake:

```cmake
find_package(Boost COMPONENTS headers filesystem REQUIRED)
target_link_libraries(${yourTarget} PUBLIC Boost::headers Boost::filesystem)
```

And with Conan:

```python
\# class ConanFile:
  def requirements(self):
    self.requires("boost/1.78")
```
This has a few advantages:

1. Users know where types come from, which aids them
   in finding documentation and further information.
   It encourages them to use other facilities from the
   library.
   The fable types are not an implementation detail.

2. It allows selective header inclusion and use of forward
   declarations to cut down compile times.
cassava added 25 commits April 19, 2024 12:53
This was also a clang-tidy finding.
It appears the bug has been resolved for some time.
(The nature of the bug prevented compilation, so if it compiles, it should work.)
Also improve the name from f to deserialize_fn.
- Use /* unused */ for unused parameters
- Use clearer argument names
- Add NOLINT comments where behavior is as-intended
- Arrange methods consistently
- Format code consistently
This simplifies the code as well as providing a more efficient
implementation for string instantiation.
This requires you to include fable/utility/sol.hpp and
provide the sol2 library yourself.
SOL_ALL_SAFETIES_ON sets SOL_SAFE_NUMERICS, so setting the latter is
redundant.

In the nlohmann to_json conversion from Lua tables, we ensure that
one of those two values is set.
This happened when incorrectly casting from signed to unsigned.
Tests have been added to test these edge cases.
It turned out to not be a problem with Environment as a problem
with the test and/or documentation.

Resolves issue #222.
During writing tests for the documentation, some bugs related
to the use of JSON pointer in error messages were found and are
corrected in this commit.
@cassava cassava requested a review from clonker April 19, 2024 10:54
@cassava cassava force-pushed the ben/fable-refactor branch from 6a83592 to 1338e39 Compare April 22, 2024 08:17
@cassava cassava merged commit 0fcb758 into master Apr 22, 2024
8 checks passed
@cassava cassava deleted the ben/fable-refactor branch April 22, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Pull requests that are potentially backwards incompatible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants