Skip to content

Releases: google/fruit

Fruit 3.7.1

21 Jan 23:38
Compare
Choose a tag to compare

Bug fixes

  • T& and T&& (for any type T) are now valid types for factory assisted parameters. Thanks to @tiolan for contributing this fix.
  • Fruit is now again compatible with Visual Studio 2022. Fruit 3.7.0 used to be compatible, but then a bug was introduced in a later release of VS 2022 that caused Fruit to no longer build until this fix.

Installation

As usual, see the installation instructions here for how to compile from source and for links to pre-built binary packages for various Linux distributions.

Fruit 3.7.0

03 Dec 23:53
Compare
Choose a tag to compare

New features

  • Arguments passed to factories are longer required to be assignable types, as long as they're movable (e.g. std::unique_ptr<T> can now be used as a factory parameter).
  • Improved the bazel configuration for Fruit. Now it detects compiler features automatically (as Fruit already did when built with CMake) instead of using a hardcoded configuration. This allows using Fruit with bazel in different environments (e.g. on Windows where MSVC needs a different config).

Bug fixes

  • Fix or silence new clang-tidy warnings to make Fruit compile without warnings with '-W -Wextra' with recent versions of Clang (up to Clang 15)
  • Fruit is now compatible with Windows headers that define max() as a macro (#127)

Documentation

  • Added documentation on how to depend on Fruit for projects using bazel.

Internal changes

  • Fruit now uses Github actions for continuous integration, instead of Travis CI and Appveyor.
  • Updated the CI configuration to test with the latest versions of compilers and operating systems (up to GCC 12, Clang 15, MSVC 2022, Ubuntu 22.10, Windows Server 2022, MacOS 12).

Installation

As usual, see the installation instructions here for how to compile from source and for links to pre-built binary packages for various Linux distributions.

Fruit 3.6.0

12 Jul 17:26
Compare
Choose a tag to compare

Potentially backwards-incompatible changes

  • MSVC 2015 is no longer supported (only MSVC 2017 or 2019 are). If you need to use Fruit with MSVC 2015, you should keep using a version of Fruit up to 3.5.0. If this is not possible, please open an issue explaining your needs.

New features

(none)

Bug fixes

  • Building Fruit with Bazel now also works in systems where the boost libraries are not installed.
  • Fruit now reports a user-friendly compile error when the signature passed to registerConstructor has an assisted parameter (it returned a compile error before too, but the error message didn't explain what was wrong).
  • Various improvements to the FindFruit.cmake script contributed by rizsotto@ (Thanks!).

Documentation

The Benchmarks page of the wiki has been updated with a more complete and up-to-date set of benchmark results.

Installation

As usual, see the installation instructions here for how to compile from source and for links to pre-built binary packages for various Linux distributions.

Fruit 3.5.0

06 Apr 01:26
Compare
Choose a tag to compare

Potentially backwards-incompatible changes

  • Fruit now requires CMake 3.2 (this used to be 2.8). CMake 3.2 was released 5 years ago, most systems should have it (or a newer version) by now.

New features

  • Fruit now provides a cmake-modules/FindFruit.cmake that can be useful to projects that use both Fruit and CMake
  • The detection of Boost has been improved, Fruit is now able to automatically detect the Boost location in most cases. If you have some scripts to build Fruit and you’re passing -DBOOST_DIR there, you should be able to remove it now (but you can still keep it if you want)
  • Improvements to the conan package configuration, notably:
    • Now Fruit can be built without Boost
    • The Conan config now uses the released source from Github instead of using git
    • (and many others)

Bug fixes

  • Fixed a compilation warning that started appearing with Clang 8
  • Fruit now defaults to C++11 mode with MSVC too (in addition to GCC and Clang)
  • Fix some compilation errors that appeared only with MSVC 2019 and only in C++17 mode.
  • Support the latest version of Bazel
  • Fixed a file name collision that caused errors when unpacking the Fruit sources on Windows (there were 2 files with names differing only by case)
  • All Clang Tidy warnings in Fruit have been fixed, allowing projects using Fruit to enable Clang tidy in all included headers too

Credits

Some of these changes were contributed by Fruit users:

  • tt4g@ and ph1ll@ improved the Conan packaging configuration
  • jjalvarezl@ contributed the FindFruit.cmake module.

Thanks!

Installation

As usual, see the installation instructions here for how to compile from source and for links to pre-built binary packages for various Linux distributions.

Fruit 3.4.0

12 Sep 20:00
Compare
Choose a tag to compare

New features

  • Pre-built deb and RPM packages now suggest the installation of the Fruit -dev/-devel packages, so that people don't need to explicitly install that package too.
  • Improved performance for Injector construction (if not using NormalizedComponent) and for NormalizedComponent construction. This improvement can be quite significant in some cases.

Installation

As usual, see the installation instructions here for how to compile from source and for links to pre-built binary packages for various Linux distributions.

Fruit 3.3.0

24 Jul 20:32
Compare
Choose a tag to compare

New features

  • Add a PartialComponent::installComponentFunctions() method that allows to install a variable number of components (typically by expanding a template parameter pack). Reference documentation

Bugfixes

  • Fix a compile error on Windows with old versions of GCC.
  • All Fruit configuration macros now use #if instead of #ifdef.
  • Workaround a MSVC 2017 bug that caused a compiler crash with the previous version of Fruit.

Documentation

Installation

As usual, see the installation instructions here for how to compile from source and for links to pre-built binary packages for various Linux distributions.

Fruit 3.1.1

13 Jan 16:57
Compare
Choose a tag to compare

This is a bugfix release to workaround a regression in MSVC 2017 15.5, that crashes when compiling Fruit 3.1.0 (while MSVC 2017 <=15.4 works).

Non-MSVC users won't see any changes with this release, so they don't necessarily need to upgrade (but it doesn't hurt either).

Fruit 3.1.0

19 Nov 16:42
Compare
Choose a tag to compare

This is the first minor release in the 3.x branch.

New functionality

  • Visual Studio 2015 is now officially supported (in addition to Visual Studio 2017), thanks to a contribution by @MrElusive.
  • Fruit now reports a compile time error when a class must have a virtual destructor but doesn't have one, instead of resulting in undefined behavior at runtime when that class is destroyed during the injector destruction. Specifically, the following cases now result in a compile-time error:
    • registerProvider() called with a lambda that returns a pointer to an abstract class with no virtual destructor
    • registerMultibindingProvider() called with a lambda that returns a pointer to an abstract class with no virtual destructor
    • registerFactory() called with a lambda that returns a std::unique_ptr<T>, with T an abstract class with no virtual destructor
    • bind<I, C>() used to bind a std::function<std::unique_ptr<I>(Args...)> to a std::function<std::unique_ptr<C>(Args...)> and I doesn't have a virtual destructor

Bug fixes

  • Update the Fruit test suite to work with recent versions of Bazel (e.g. 0.7.0)
  • Fix a bug in Fruit that might have caused undefined behavior when using a STL implementation that doesn't implement std::allocator::deallocate using malloc(). This bug did not affect GCC's STL, nor Clang's libc++ nor MSVC's STL implementation, but it could have affected non-standard STL implementations.
  • No longer trigger compiler warnings with recent versions of Clang.

Installation

See the installation instructions here for how to compile from source and for links to pre-built binary packages for various Linux distributions.

Fruit 3.0.0

06 Aug 16:58
Compare
Choose a tag to compare

This is the third major release of Fruit.

This release introduces backwards-incompatible changes (see below). If you have a significant amount of code to port from Fruit 2.0.x, consider first porting to Fruit 2.1.0. See the 2.1.0 release notes for more information and a suggested migration process.

Backwards-incompatible changes

  • PartialComponent::install(), Injector's constructors and NormalizedComponent's constructor now take a Component-returning function and the arguments that it should be called with, instead of taking the resulting Component.
  • Installed components are now de-duplicated, i.e. calling install(getFooComponent) twice in Fruit 3.x only ends up calling getFooComponent() once and only adds that component's bindings once (as opposed to calling install(getFooComponent()) in Fruit 2.x). This can lead to different behavior if getFooComponent has side-effects or if it binds multibindings. See the reference documentation for more details (e.g. what happens if the component function has arguments).
  • Component objects are no longer copy-constructible (but they are still move-able).
  • GCC <5.0.0 is no longer supported.
  • Injector's unsafeGet() method has been removed.
  • When building Fruit from source:
    • You must now explicitly specify CMAKE_BUILD_TYPE (e.g. -DCMAKE_BUILD_TYPE=Release).
    • You must now have boost's hashmap/hashset libraries installed. You can opt-out (and switch back to the STL implementation) by calling CMake with the -DFRUIT_USES_BOOST=False flag; this removes this dependency but it reduces injection performance. In any case, once Fruit is built you don't need to have boost's hashmap/hashset libraries installed in order to compile code using Fruit.
    • If you're running Fruit tests as part of the build, you must now run them via py.test instead of CTest (e.g. you can run them with cd $PATH_TO_FRUIT/tests; py.test-3 -n auto). See CONTRIBUTING.md for more information.

Significant changes

  • Fruit is now supported on Windows, using the MSVC compiler or MinGW's GCC.
  • Fruit now supports binding const& values in PartialComponent::bindInstance (before it only supported binding non-const references)
  • Component installation loops (e.g. a getFooComponent that installs getBarComponent that installs getFooComponent) are now caught and reported as run-time errors, while these bugs would have caused a stack overflow with Fruit 2.x.
  • Significant improvements in performance and executable size (for more details see the Benchmarks page of the wiki)

Other user-visible changes

  • The INJECT macro now has a saner behavior when mistakenly used in a non-public section of the class (before this would have silently made the constructor and everything that followed public until the next public/private/protected specifier). A side-effect of this is that the FruitAssistedTypedef and FruitAnnotatedTypedef typedefs defined by the INJECT macro are now public (instead of private). These are just implementation details of the INJECT macro, they should not be used outside Fruit.
  • Report more readable Fruit-related compile-time errors, including:
    • When a pointer is passed to bindInstance()
    • "Binding not found" errors for abstract classes.
    • When fruit::Required<> is passed multiple times to a fruit::[Normalized]Component<> or when it's not passed as the first template argument.
  • Fix a bug where a clashing binding was ignored instead of causing a compile error.
  • When compiling Fruit with Bazel, the workspace root should now be $FRUIT_SOURCES_DIR/extras/bazel_root instead of $FRUIT_SOURCES_DIR. It's now easier to use Fruit from other projects compiled with Bazel.

Significant internal changes

  • Fruit's end-to-end tests have been ported to python (from a mix of C++ and bash), allowing multiple testcases to be defined in a single test file, and making it possible and easy to share setup/checks between tests, and to have parameterized tests. This helped increase Fruit's test coverage. Fruit 3.0.0 has >350 tests (that become >1200 after expanding parameterized tests).

Installation

See the installation instructions here for how to compile from source and for links to pre-built binary packages for various Linux distributions.

Fruit 2.1.0

06 Aug 16:56
Compare
Choose a tag to compare

This release has the sole purpose of aiding the migration from Fruit 2.0.x to Fruit 3.x.

Changes compared to 2.0.4

  • Mark as deprecated all constructors/methods that are no longer available in Fruit 3.x.
  • Introduce a PartialComponent::install() method and constructors for Injector and NormalizedComponent with the same signature as the ones in Fruit 3.x.

Note that none of the bug-fixes or the other improvements in Fruit 3.x are provided with this release.
This release is only meant to be using temporarily, while migrating code to the Fruit 3.x syntax.

Suggested migration process

  • Switch from Fruit 2.0.x to 2.1.0. This will cause deprecation warnings for all uses of Fruit 2.0.x APIs that no longer exist in 3.x. Depending on the compiler flags used in your build, you might need to temporarily disable some diagnostics (e.g. if you're using GCC/Clang's -Werror, these deprecation warnings will be considered errors and your code will no longer build).
  • Incrementally port your code to remove uses of deprecated methods, replacing them with the corresponding non-deprecated variant. After each change you can re-run your tests to make sure nothing breaks.
  • Re-enable any disabled diagnostics (e.g. -Werror).
  • Switch from Fruit 2.1.0 to 3.x. Note that even if you're not using any deprecated methods, this is not guaranteed to be a backwards-compatible change, notably due to the de-duplication of install() calls performed in Fruit 3.x (which is not performed in 2.1.0). However in practice this should not require many changes (if any). Just make sure you re-run your tests under Fruit 3.x.
  • Enjoy the 3.x performance improvements and new features.