google / fruit Goto Github PK
View Code? Open in Web Editor NEWFruit, a dependency injection framework for C++
Home Page: https://github.com/google/fruit/wiki
License: Apache License 2.0
Fruit, a dependency injection framework for C++
Home Page: https://github.com/google/fruit/wiki
License: Apache License 2.0
Hi Marco,
we plan on using fruit and were wondering when there will be a new release, as master is ahead 331 of the last release v2.0.4: v2.0.4...master
Thanks
Manuel
Good time of day,
I have noticed that at the moment Windows is not supported by the library. Do you think Visual Studio 2015 has mature enough C++11 support to compile fruit? I would like to give fruit a go, but I must support Mac, Linux and Windows. If VS2015 is good enough, you shouldn't have too much trouble compiling for it, since you already use cmake.
Hello,
As I understood from closed issues is that VS 2015 Update 3 is supported with fruit, isn't it?
I was just download repository, generated debug 32 project and pressed build~
After this I received quite a lot of issues related to one file injector.defn.h:
Error C2061 syntax error: identifier 'RemoveAnnotations<`template-type-parameter-1'>' fixed_size_vector-exec fruit-master\include\fruit\impl\injector.defn.h 99
Could you help me to understand what I am doing wrong?
Thank you for your time!
Sorry for such a lame question but is it possible to build fruit for android and if so then how to do that?
Building against the 2.0.4 tag with pedantic causes the error:
fruit/include/fruit/impl/binding_data.defn.h:35:54: error: zero-size array ‘types’
static const TypeId types[] = {getTypeId<Ts>()...};
Easiest reproduction is building the hello_world example with -pedantic
on:
diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt
index 5a154ad..6c6d599 100644
--- a/examples/hello_world/CMakeLists.txt
+++ b/examples/hello_world/CMakeLists.txt
@@ -4,4 +4,5 @@ main.cpp
)
add_executable(hello ${HELLO_WORLD_SOURCES})
+target_compile_options(hello PRIVATE -pedantic)
target_link_libraries(hello fruit)
The cause seems to be using multiple .bind
statements when creating a component, like in examples/hello_world/main.cpp:46
This would be useful:
Some code was being tested for use in another project, and a weird (sort of) error occurred. When using assisted types in a constructor, it was found that for some reason (is it in the tutorial / wiki ?), the order for the function defintion is reversed. In this case, the function for 'registerFactory' is being automatically generated (whcih relies on the function defiintion in the return type). However, when the order of the arguments is reversed, it compiles correctly, and runs! Is there an explanation for this behaviour. It's presumed that when the return fucntion is generated (possibly without explicitly defining registerFactory), that the loop starts at the end and iterates backwards (or vice versa). Here is some sample code:
using Inject = LoggerImpl(fruit::Assisted<int>, fruit::Assisted<float>);
LoggerImpl( int argc , float argv) {
...do stuff with argc, argv
}
using LoggerFactory = function<unique_ptr(float,int)>;
fruit::Component getLoggerComponentA() {
return fruit::createComponent().bind<Logger, LoggerImpl>();
}
The error that occurs when its in the correctly (intuitively? / or normally) order is as follows:
n file included from fruit/include/fruit/fruit.h:25:0,
from fruit_test_main.cpp:9:
fruit/include/fruit/impl/injection_errors.h: In instantiation of 'struct fruit::impl::FunctorSignatureDoesNotMatchError<LoggerImpl(int, float), LoggerImpl(float, int)>':
fruit/include/fruit/impl/component.defn.h:58:55: required from 'fruit::Component::Component(fruit::PartialComponent<Bindings ...>) [with Bindings = {fruit::impl::Bind<Logger, LoggerImpl>}; Params = {std::function<std::unique_ptr<LoggerImpl, std::default_delete >(int, float)>}]'
Logger.hpp:101:62: required from here
fruit/include/fruit/impl/injection_errors.h:214:3: error: static assertion failed: Unexpected functor signature (it should be the same as ExpectedSignature minus any Assisted types).
static_assert(
^~~~~~~~~~~~~
In file included from fruit/include/fruit/component.h:498:0,
from fruit/include/fruit/fruit.h:28,
from fruit_test_main.cpp:9:
fruit/include/fruit/impl/component.defn.h: In instantiation of 'fruit::Component::Component(fruit::PartialComponent<Bindings ...>) [with Bindings = {fruit::impl::Bind<Logger, LoggerImpl>}; Params = {std::function<std::unique_ptr<LoggerImpl, std::default_delete >(int, float)>}]':
Logger.hpp:101:62: required from here
fruit/include/fruit/impl/component.defn.h:61:135: error: no type named 'Result' in 'fruit::impl::meta::OpForComponent<fruit::impl::Bind<Logger, LoggerImpl> >::ConvertTofruit::impl::meta::Comp<fruit::impl::meta::Vector<, fruit::impl::meta::Vector<fruit::impl::meta::Type<std::function<std::unique_ptr<LoggerImpl, std::default_delete >(int, float)> > >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<std::function<std::unique_ptr<LoggerImpl, std::default_delete >(int, float)> >, fruit::impl::meta::Vector<> > >, fruit::impl::meta::Vector<>, fruit::impl::meta::EmptyList> > {aka struct fruit::impl::meta::Error<fruit::impl::FunctorSignatureDoesNotMatchErrorTag, LoggerImpl(int, float), LoggerImpl(float, int)>}'
mpl::meta::Eval<fruit::impl::meta::CheckNoLoopInDeps(typename Op::Result)>>::type();
^~~~~~
fruit/include/fruit/impl/component.defn.h:64:7: error: no match for call to '(Op {aka fruit::impl::meta::Error<fruit::impl::FunctorSignatureDoesNotMatchErrorTag, LoggerImpl(int, float), LoggerImpl(float, int)>}) (fruit::impl::ComponentStorage&)'
Op()(storage);
(Note Logger.hpp and fruit_test_main.cpp are the two source files - the full directories have been removed, etc).
With the code:
using LoggerFactory = function<unique_ptr(int,float)>;
...
Injector injector(getLoggerComponentA());
LoggerFactory loggerFactory(injector);
unique_ptr logger = loggerFactory(argc,5.0f);
Please advise, thank you. This solutions seems (pretty) good, and it may be helpful, but this error caused issues!
Is it necessary to supply the registerFactory call with an explicitly defined functor/lambda, and is it necessary to reverse the argument order in that call as well?
Thanks again!
I'm using RelWithDebInfo
while including fruit
as a subdirectory (related issue: #44) and I noticed that I can't configure my project anymore.
The specific problem is those lines
Lines 11 to 13 in f5c96b3
fruit
.
Is there reason to restrict builds just to Debug
/Release
configurations? In case of including fruit
as part of a build system CMAKE_BUILD_TYPE
might be any of those mentioned in cmake-variables(7)
.
current implementation will give SelfLoopError with the following modified HelloWorld example
Component<GreeterImpl> getGreeterComponent() {
return fruit::createComponent()
.bind<StdoutWriter, StdoutWriter>()
.bind<GreeterImpl, GreeterImpl>();
}
E.g.
.install(getFooComponent, 1, 2)
Should be replaceable with, e.g.:
.override(getFooComponent, 1, 2)
.install(getFakeFooComponent, 3)
Any overrides within the component take precedence on the installs. However the order of installation counts: if the lazy component has already been expanded when encountering the override, Fruit will report an error and abort.
This is useful for tests, to avoid having Required<>
bindings everywhere.
If Fruit is compiled normally, without using -fvisibility=hidden
and then used in client code compiled with -fvisibility=hidden
switch, the resulting executable segfaults (this issue was reported by Christoph Duelli).
Ideally, Fruit should support client code that uses -fvisibility=hidden
.
Once -fvisibility=hidden
is supported, it might be worth also using it when compiling Fruit itself, potentially reducing the compiled size.
E.g. we could define a fruit::MultibindingProvider<T>
class that allows to get a vector of the multibindings for that type, and allow injecting that as a dependency.
This will have the caveat that injection dependency loops involving a MultibindingProvider
will only be detected at runtime.
To print the actual loop, maybe we can have an on-this-error-only, slow code path where we walk the injection graph at runtime, looking for in-progress injections, to find the loop; then we can print a more useful error message with the types involved in the loop. TBD if there's enough information available to determine the loop.
Hello there, sweet people.
I have a class that uses a factory/assisted injection. The class (here called ChoosePlaylistDialog) is a subclass of Qt's QFileDialog.
And so, here's the problematic binding:
using PlaylistChooserFactory = function<unique_ptr<PlaylistChooser>(QWidget *)>;
Component<PlaylistChooserFactory> getPlaylistChooserDialogComponent() {
return createComponent()
.bind<PlaylistChooser, ChoosePlaylistDialog>()
.install(getSupportRegistryComponent());
}
It barfs out this error (a partial capture):
In file included from /Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/ui/chooseplaylistsdialog.cpp:6:
In file included from /Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/fruit.h:28:
In file included from /Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/component.h:27:
/Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:732:29: error: call to implicitly-deleted copy constructor of 'ChoosePlaylistDialog'
NakedC* c = new NakedC(fun(args...));
^ ~~~~~~~~~~~~
/Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:90:13: note: in instantiation of member function 'fruit::impl::meta::AutoRegisterFactoryHelper::apply<fruit::impl::meta::Comp<fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<fruit::impl::meta::Type<SupportRegistry> >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<SupportRegistry>, fruit::impl::meta::Vector<> > >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<PlaylistChooser>, fruit::impl::meta::Type<ChoosePlaylistDialog> > >, fruit::impl::meta::EmptyList>, fruit::impl::meta::Vector<>, fruit::impl::meta::None, fruit::impl::meta::Bool<false>, fruit::impl::meta::Bool<false>, fruit::impl::meta::Type<std::__1::unique_ptr<ChoosePlaylistDialog, std::__1::default_delete<ChoosePlaylistDialog> > >, fruit::impl::meta::Type<std::__1::unique_ptr<ChoosePlaylistDialog, std::__1::default_delete<ChoosePlaylistDialog> > (QWidget *)>, fruit::impl::meta::Type<QWidget *> >::Op::operator()' requested here
Eval<Op2>()(storage);
^
/Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:89:13: note: in instantiation of member function 'fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::ComponentFunctorIdentity, fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::EnsureProvidedType, fruit::impl::meta::Vector<>, fruit::impl::meta::Type<std::__1::function<std::__1::unique_ptr<ChoosePlaylistDialog, std::__1::default_delete<ChoosePlaylistDialog> > (QWidget *)> > >::type>::type::apply<fruit::impl::meta::Comp<fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<fruit::impl::meta::Type<SupportRegistry> >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<SupportRegistry>, fruit::impl::meta::Vector<> > >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<PlaylistChooser>, fruit::impl::meta::Type<ChoosePlaylistDialog> > >, fruit::impl::meta::EmptyList> >::Op::operator()' requested here
Eval<Op1>()(storage);
^
/Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:89:13: note: in instantiation of member function 'fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::ComponentFunctorIdentity, fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::EnsureProvidedType, fruit::impl::meta::Vector<>, fruit::impl::meta::Type<std::__1::function<std::__1::unique_ptr<ChoosePlaylistDialog, std::__1::default_delete<ChoosePlaylistDialog> > (QWidget *)> > >::type>::type, fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::PreProcessRegisterProvider, fruit::impl::meta::Type<std::__1::function<std::__1::unique_ptr<PlaylistChooser, std::__1::default_delete<PlaylistChooser> > (QWidget *)> (std::__1::function<std::__1::unique_ptr<ChoosePlaylistDialog, std::__1::default_delete<ChoosePlaylistDialog> > (QWidget *)> &)>, fruit::impl::meta::Type<(lambda at /Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:687:27)> >::type>::type::apply<fruit::impl::meta::Comp<fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<fruit::impl::meta::Type<SupportRegistry> >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<SupportRegistry>, fruit::impl::meta::Vector<> > >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<PlaylistChooser>, fruit::impl::meta::Type<ChoosePlaylistDialog> > >, fruit::impl::meta::EmptyList> >::Op::operator()' requested here
/Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:698:11: note: in instantiation of member function 'fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::ComponentFunctorIdentity, fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::EnsureProvidedType, fruit::impl::meta::Vector<>, fruit::impl::meta::Type<std::__1::function<std::__1::unique_ptr<ChoosePlaylistDialog, std::__1::default_delete<ChoosePlaylistDialog> > (QWidget *)> > >::type>::type, fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::PreProcessRegisterProvider, fruit::impl::meta::Type<std::__1::function<std::__1::unique_ptr<PlaylistChooser, std::__1::default_delete<PlaylistChooser> > (QWidget *)> (std::__1::function<std::__1::unique_ptr<ChoosePlaylistDialog, std::__1::default_delete<ChoosePlaylistDialog> > (QWidget *)> &)>, fruit::impl::meta::Type<(lambda at /Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:687:27)> >::type>::type, fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::PostProcessRegisterProvider, fruit::impl::meta::Type<std::__1::function<std::__1::unique_ptr<PlaylistChooser, std::__1::default_delete<PlaylistChooser> > (QWidget *)> (std::__1::function<std::__1::unique_ptr<ChoosePlaylistDialog, std::__1::default_delete<ChoosePlaylistDialog> > (QWidget *)> &)>, fruit::impl::meta::Type<(lambda at /Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:687:27)> >::type>::type::apply<fruit::impl::meta::Comp<fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<fruit::impl::meta::Type<SupportRegistry> >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<SupportRegistry>, fruit::impl::meta::Vector<> > >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<PlaylistChooser>, fruit::impl::meta::Type<ChoosePlaylistDialog> > >, fruit::impl::meta::EmptyList> >::Op::operator()' requested here
Eval<RealOp>()(storage);
^
/Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:89:13: note: in instantiation of member function 'fruit::impl::meta::AutoRegisterFactoryHelper::apply<fruit::impl::meta::Comp<fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<fruit::impl::meta::Type<SupportRegistry> >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<SupportRegistry>, fruit::impl::meta::Vector<> > >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<PlaylistChooser>, fruit::impl::meta::Type<ChoosePlaylistDialog> > >, fruit::impl::meta::EmptyList>, fruit::impl::meta::Vector<>, fruit::impl::meta::Type<ChoosePlaylistDialog>, fruit::impl::meta::Bool<false>, fruit::impl::meta::Bool<true>, fruit::impl::meta::Type<std::__1::unique_ptr<PlaylistChooser, std::__1::default_delete<PlaylistChooser> > >, fruit::impl::meta::Type<std::__1::unique_ptr<PlaylistChooser, std::__1::default_delete<PlaylistChooser> > (QWidget *)>, fruit::impl::meta::Type<QWidget *> >::Op::operator()' requested here
Eval<Op1>()(storage);
^
/Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component_functors.defn.h:90:13: note: in instantiation of member function 'fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::EnsureProvidedType, fruit::impl::meta::Vector<>, fruit::impl::meta::Type<std::__1::function<std::__1::unique_ptr<PlaylistChooser, std::__1::default_delete<PlaylistChooser> > (QWidget *)> > >::type, fruit::impl::meta::ComponentFunctorIdentity>::type::apply<fruit::impl::meta::Comp<fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<fruit::impl::meta::Type<SupportRegistry> >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<SupportRegistry>, fruit::impl::meta::Vector<> > >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<PlaylistChooser>, fruit::impl::meta::Type<ChoosePlaylistDialog> > >, fruit::impl::meta::EmptyList> >::Op::operator()' requested here
Eval<Op2>()(storage);
^
/Users/mohmed/QtCreatorProjects/UltraSync/ultrasync/../../../Build/fruit/include/fruit/impl/component.defn.h:64:3: note: in instantiation of member function 'fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::Compose2ComponentFunctors::apply<fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::AddDeferredInterfaceBinding, fruit::impl::meta::Type<PlaylistChooser>, fruit::impl::meta::Type<ChoosePlaylistDialog> >::type, fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::InstallComponentHelper, fruit::impl::meta::Type<SupportRegistry> >::type>::type, fruit::impl::meta::ProcessDeferredBindings>::type, fruit::impl::meta::ComponentFunctor::apply<fruit::impl::meta::ConvertComponent, fruit::impl::meta::Comp<fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<fruit::impl::meta::Type<std::__1::function<std::__1::unique_ptr<PlaylistChooser, std::__1::default_delete<PlaylistChooser> > (QWidget *)> > >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<std::__1::function<std::__1::unique_ptr<PlaylistChooser, std::__1::default_delete<PlaylistChooser> > (QWidget *)> >, fruit::impl::meta::Vector<> > >, fruit::impl::meta::Vector<>, fruit::impl::meta::EmptyList> >::type>::type::apply<fruit::impl::meta::Comp<fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<>, fruit::impl::meta::Vector<>, fruit::impl::meta::EmptyList> >::Op::operator()' requested here
Op()(storage);
^
Why is it trying to copy the object while the factory should be returning a pointer, not an instance?
At least according to the factory so to speak.
Hi,
in the codebase I'm working with, I have a templated class I'm trying to get injected. Think something like this:
template<typename Model>
class DAO {
}
I'd like to be able to .bind()
this in one of my components, but it seems I can't find a way to do it. Is there someway to tell Fruit it's going to be injected with a template argument? Can I absolutely not do this? If so, any workaround available?
Thanks!
I have the following class structure:
class ILockable
{
public:
ILockable() {}
virtual ~ILockable() {}
virtual void Initialize(uint32_t timeoutMilliseconds) = 0;
virtual void Lock() = 0;
virtual void Unlock() = 0;
};
class TimedLock : public ILockable
{
public:
TimedLock() {}
~TimedLock();
void Initialize(uint32_t timeoutMilliseconds);
void Lock();
void Unlock();
private:
uint32_t _timeoutMilliseconds;
volatile bool _isLocked;
pthread_mutex_t _mtxIsLocked;
};
And I wanted to use Annotated Injection to create two separate locks. So I started by creating an annotated get*Component:
struct CustomLock {};
fruit::Component<fruit::Annotated<CustomLock, ILockable>> getCustomLockComponent() {
return fruit::createComponent()
.bind<fruit::Annotated<CustomLock, ILockable>, TimedLock>()
.registerConstructor<TimedLock()>();
}
However, if I try to use this in the shorthand conversion operator described in https://github.com/google/fruit/wiki/quick-reference#injector I get the following problem:
fruit::Injector<fruit::Annotated<CustomLock, ILockable>> myInjector(::getCustomLockComponent());
fruit::Annotated<CustomLock, ILockable*> myLock(myInjector);
myLock->Initialize(lockTimeoutMilliseconds);
make all
Building file: ../src/main.cpp
Invoking: GCC C++ Compiler 4 [arm-linux-gnueabi]
arm-linux-gnueabi-g++ -std=c++0x -I"fruit\include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/main.d" -MT"src/main.d" -o "src/main.o" "../src/main.cpp"
../src/main.cpp: In function 'int main(int, char**)':
../src/main.cpp:203:10: error: base operand of '->' has non-pointer type 'fruit::Annotated<CustomLock, ILockable*>'
myLock->Initialize(lockTimeoutMilliseconds);
^
In file included from fruit\include/fruit/injector.h:228:0,
from fruit\include/fruit/fruit.h:31,
from SensuredComponent.h:11,
from ../src/main.cpp:17:
fruit\include/fruit/impl/injector.defn.h: In instantiation of 'fruit::Injector<P>::operator T() [with T = fruit::Annotated<CustomLock, ILockable*>; P = {fruit::Annotated<CustomLock, ILockable>}]':
../src/main.cpp:201:64: required from here
fruit\include/fruit/impl/injector.defn.h:115:13: error: could not convert 'fruit::Injector<P>::get<fruit::Annotated<CustomLock, ILockable*> >()' from 'fruit::Injector<fruit::Annotated<CustomLock, ILockable> >::RemoveAnnotations<fruit::Annotated<CustomLock, ILockable*> > {aka ILockable*}' to 'fruit::Annotated<CustomLock, ILockable*>'
return get<T>();
^
fruit\include/fruit/impl/injector.defn.h: In member function 'fruit::Injector<P>::operator T() [with T = fruit::Annotated<CustomLock, ILockable*>; P = {fruit::Annotated<CustomLock, ILockable>}]':
fruit\include/fruit/impl/injector.defn.h:116:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
src/subdir.mk:18: recipe for target 'src/main.o' failed
make: *** [src/main.o] Error 1
And:
fruit::Injector<fruit::Annotated<CustomLock, ILockable>> myInjector(::getCustomLockComponent());
fruit::Annotated<CustomLock, ILockable> *myLock(myInjector);
myLock->Initialize(lockTimeoutMilliseconds);
make all
Building file: ../src/main.cpp
Invoking: GCC C++ Compiler 4 [arm-linux-gnueabi]
arm-linux-gnueabi-g++ -std=c++0x -I"fruit\include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/main.d" -MT"src/main.d" -o "src/main.o" "../src/main.cpp"
../src/main.cpp: In function 'int main(int, char**)':
../src/main.cpp:202:12: error: 'struct fruit::Annotated<CustomLock, ILockable>' has no member named 'Initialize'
myLock->Initialize(lockTimeoutMilliseconds);
^
make: *** [src/main.o] Error 1
src/subdir.mk:18: recipe for target 'src/main.o' failed
A workaround is using the get<>
directly:
fruit::Injector<fruit::Annotated<CustomLock, ILockable>> myInjector(::getCustomLockComponent());
ILockable *myLock = myInjector.get<fruit::Annotated<CustomLock, ILockable*>>();
myLock->Initialize(lockTimeoutMilliseconds);
I recently started tinkering with using Fruit to make my code more testable and decrease the dependencies between components. I'm currently using Google Mock for mocking components but I'm not sure how to combine Fruit with Google Mock. Here is a basic sample version of what I'm trying to do and hopefully someone will be able to point out what I'm missing or misunderstanding.
The basic idea for the example is that you have a Car
that is being modeled and it has several components but the main one for this example is the Engine
. The Engine
provides three methods: start
, stop
, and getNumberOfCylinders
. The Car
provides a variety of methods but the three main ones here are the start
, stop
, printDiagnostics
methods.
Please note that for the sake of brevity I've omitted some of the basics like includes, header guards, and namespaces.
class Engine {
public:
virtual void start(void) = 0;
virtual void stop(void) = 0;
virtual int getNumberOfCylinders(void) = 0;
};
fruit::Component<Engine> getV8EngineComponent(void);
using namespace fruit;
class V8Engine : public Engine {
public:
INJECT(V8Engine(void)) = default;
virtual void start(void) override {
// do engine type stuff
}
virtual void stop(void) override {
// do engine type stuff
}
virtual int getNumberOfCylinders(void) {
return 8;
}
};
Component<Engine> getV8EngineComponent(void) {
return createComponent().bind<Engine, V8Engine>();
}
class Car {
public:
// snip other methods
virtual void start(void) = 0;
virtual void stop(void) = 0;
virtual void printDiagnostics(void) = 0;
// snip more methods
};
fruit::Component<fruit::Required<Engine>, Car> getSaturnComponent(void);
using namespace fruit;
class Saturn : public Car {
private:
Engine *engine_;
public:
INJECT(Saturn(Engine *engine)) : engine_(engine) {
}
virtual void start(void) override {
// setup the dashboard lights
// make annoying dinging
engine->start();
}
virtual void stop(void) override {
engine->stop();
// make more dinging noises if the headlights are on
}
virtual void printDiagnostics(void) override {
// output some diagnostics
// print is some internal function for printing information to the diagnostics port
print("number of cylinders in engine: {}", engine->getNumberOfCylinders());
// output more diagnostics
}
};
Component<Required<Engine>, Car> getSaturnComponent(void) {
return createComponent().bind<Car, Saturn>();
}
class MockEngine : public Engine {
public:
MOCK_METHOD0(start, void(void));
MOCK_METHOD0(stop, void(void));
MOCK_METHOD0(getNumberOfCylinders, int(void));
};
using namespace fruit;
Component<Car> getTestCarComponent(Engine *engine) {
return createComponent()
.install(getSaturnComponent())
.bindInstance(engine);
}
TEST(Saturn, start) {
MockEngine engine;
EXPECT_CALL(engine, start()).Times(1);
Injector<Car> injector = getTestCarComponent((Engine *) &engine);
Car *car = injector.get<Car *>();
car->start();
// make other assertions and expectations
}
This fails to compile with No explicit binding was found for C, and C is an abstract class (so even if it has a C::Inject annotation it's ignored).
in the mock_engine class. Any pointers here?
Thanks for any assistance you can give,
James
Edited Benchmarks wiki: Update us
to μs
(microseconds to use Greek Mu for "micro-")!
Because thread_local isn't supported.
We should use pthread directly (which is supported).
Hi,
When I run make test
with the flag INSTRUMENT_WITH_SANITIZERS=ON
, 119 tests failed.
Because of that I cannot use any sanitizer on my project.
Can you solved it ?
info: I have OSX 10.11.4.
output:
Running tests...
Test project /tmp/fruit/build_folder
Start 2: binding_compression_undone-build
1/365 Test #2: binding_compression_undone-build .............................................. Passed 1.62 sec
Start 1: binding_compression_undone
2/365 Test #1: binding_compression_undone .................................................... Passed 0.15 sec
Start 3: binding_error_bound_to_itself
3/365 Test #3: binding_error_bound_to_itself .................................................***Failed 0.33 sec
Start 4: binding_error_not_base
4/365 Test #4: binding_error_not_base ........................................................***Failed 0.32 sec
Start 5: binding_error_not_base_with_annotations
5/365 Test #5: binding_error_not_base_with_annotations .......................................***Failed 0.31 sec
Start 6: bind_instance_error_already_bound
6/365 Test #6: bind_instance_error_already_bound .............................................***Failed 0.30 sec
Start 7: bind_instance_error_already_bound_with_annotation
7/365 Test #7: bind_instance_error_already_bound_with_annotation .............................***Failed 0.33 sec
Start 9: bind_instance_error_already_bound_with_different_annotation-build
8/365 Test #9: bind_instance_error_already_bound_with_different_annotation-build ............. Passed 1.31 sec
Start 8: bind_instance_error_already_bound_with_different_annotation
9/365 Test #8: bind_instance_error_already_bound_with_different_annotation ................... Passed 0.10 sec
Start 11: class_destruction-build
10/365 Test #11: class_destruction-build ....................................................... Passed 2.72 sec
Start 10: class_destruction
11/365 Test #10: class_destruction ............................................................. Passed 0.17 sec
Start 13: class_destruction_with_annotation-build
12/365 Test #13: class_destruction_with_annotation-build ....................................... Passed 2.64 sec
Start 12: class_destruction_with_annotation
13/365 Test #12: class_destruction_with_annotation ............................................. Passed 0.09 sec
Start 15: component_conversion-build
14/365 Test #15: component_conversion-build .................................................... Passed 1.49 sec
Start 14: component_conversion
15/365 Test #14: component_conversion .......................................................... Passed 0.09 sec
Start 17: component_conversion_with_annotation-build
16/365 Test #17: component_conversion_with_annotation-build .................................... Passed 1.53 sec
Start 16: component_conversion_with_annotation
17/365 Test #16: component_conversion_with_annotation .......................................... Passed 0.09 sec
Start 19: component_copy-build
18/365 Test #19: component_copy-build .......................................................... Passed 1.30 sec
Start 18: component_copy
19/365 Test #18: component_copy ................................................................ Passed 0.08 sec
Start 21: component_copy_with_annotations-build
20/365 Test #21: component_copy_with_annotations-build ......................................... Passed 1.32 sec
Start 20: component_copy_with_annotations
21/365 Test #20: component_copy_with_annotations ............................................... Passed 0.09 sec
Start 22: component_repeated_type
22/365 Test #22: component_repeated_type .......................................................***Failed 0.34 sec
Start 23: component_repeated_type_with_annotations
23/365 Test #23: component_repeated_type_with_annotations ......................................***Failed 0.32 sec
Start 25: component_repeated_type_with_different_annotations-build
24/365 Test #25: component_repeated_type_with_different_annotations-build ...................... Passed 0.84 sec
Start 24: component_repeated_type_with_different_annotations
25/365 Test #24: component_repeated_type_with_different_annotations ............................ Passed 0.08 sec
Start 26: component_type_required_and_provided
26/365 Test #26: component_type_required_and_provided ..........................................***Failed 0.41 sec
Start 27: component_type_required_and_provided_with_annotations
27/365 Test #27: component_type_required_and_provided_with_annotations .........................***Failed 0.41 sec
Start 29: component_type_required_and_provided_with_different_annotations-build
28/365 Test #29: component_type_required_and_provided_with_different_annotations-build ......... Passed 1.00 sec
Start 28: component_type_required_and_provided_with_different_annotations
29/365 Test #28: component_type_required_and_provided_with_different_annotations ............... Passed 0.09 sec
Start 30: dependency_loop
30/365 Test #30: dependency_loop ...............................................................***Failed 0.33 sec
Start 31: dependency_loop_with_annotations
31/365 Test #31: dependency_loop_with_annotations ..............................................***Failed 0.37 sec
Start 33: dependency_loop_with_different_annotations-build
32/365 Test #33: dependency_loop_with_different_annotations-build .............................. Passed 1.45 sec
Start 32: dependency_loop_with_different_annotations
33/365 Test #32: dependency_loop_with_different_annotations .................................... Passed 0.09 sec
Start 34: duplicated_types_normalized_component
34/365 Test #34: duplicated_types_normalized_component .........................................***Failed 0.34 sec
Start 35: duplicated_types_normalized_component_with_annotations
35/365 Test #35: duplicated_types_normalized_component_with_annotations ........................***Failed 0.32 sec
Start 37: duplicated_types_normalized_component_with_different_annotations-build
36/365 Test #37: duplicated_types_normalized_component_with_different_annotations-build ........ Passed 0.80 sec
Start 36: duplicated_types_normalized_component_with_different_annotations
37/365 Test #36: duplicated_types_normalized_component_with_different_annotations .............. Passed 0.10 sec
Start 39: eager_injection-build
38/365 Test #39: eager_injection-build ......................................................... Passed 1.91 sec
Start 38: eager_injection
39/365 Test #38: eager_injection ............................................................... Passed 0.10 sec
Start 41: empty_injector-build
40/365 Test #41: empty_injector-build .......................................................... Passed 1.07 sec
Start 40: empty_injector
41/365 Test #40: empty_injector ................................................................ Passed 0.09 sec
Start 43: explicit_provider_injection-build
42/365 Test #43: explicit_provider_injection-build ............................................. Passed 1.39 sec
Start 42: explicit_provider_injection
43/365 Test #42: explicit_provider_injection ................................................... Passed 0.10 sec
Start 45: explicit_provider_injection_with_annotation-build
44/365 Test #45: explicit_provider_injection_with_annotation-build ............................. Passed 1.33 sec
Start 44: explicit_provider_injection_with_annotation
45/365 Test #44: explicit_provider_injection_with_annotation ................................... Passed 0.09 sec
Start 47: factory_bindings-build
46/365 Test #47: factory_bindings-build ........................................................ Passed 1.71 sec
Start 46: factory_bindings
47/365 Test #46: factory_bindings .............................................................. Passed 0.08 sec
Start 48: factory_bindings_error_abstract_class
48/365 Test #48: factory_bindings_error_abstract_class .........................................***Failed 0.34 sec
Start 50: factory_bindings_nonmovable_ok-build
49/365 Test #50: factory_bindings_nonmovable_ok-build .......................................... Passed 1.60 sec
Start 49: factory_bindings_nonmovable_ok
50/365 Test #49: factory_bindings_nonmovable_ok ................................................ Passed 0.10 sec
Start 52: factory_bindings_with_annotation-build
51/365 Test #52: factory_bindings_with_annotation-build ........................................ Passed 1.66 sec
Start 51: factory_bindings_with_annotation
52/365 Test #51: factory_bindings_with_annotation .............................................. Passed 0.09 sec
Start 54: incompatible_double_injection-build
53/365 Test #54: incompatible_double_injection-build ........................................... Passed 1.43 sec
Start 53: incompatible_double_injection
54/365 Test #53: incompatible_double_injection .................................................***Failed 0.12 sec
Start 56: incompatible_double_injection_with_annotations-build
55/365 Test #56: incompatible_double_injection_with_annotations-build .......................... Passed 1.46 sec
Start 55: incompatible_double_injection_with_annotations
56/365 Test #55: incompatible_double_injection_with_annotations ................................***Failed 0.13 sec
Start 58: incompatible_double_injection_with_different_annotations-build
57/365 Test #58: incompatible_double_injection_with_different_annotations-build ................ Passed 1.58 sec
Start 57: incompatible_double_injection_with_different_annotations
58/365 Test #57: incompatible_double_injection_with_different_annotations ...................... Passed 0.09 sec
Start 59: injector_duplicated_type
59/365 Test #59: injector_duplicated_type ......................................................***Failed 0.32 sec
Start 60: injector_duplicated_type_with_annotation
60/365 Test #60: injector_duplicated_type_with_annotation ......................................***Failed 0.32 sec
Start 62: injector_duplicated_type_with_different_annotation-build
61/365 Test #62: injector_duplicated_type_with_different_annotation-build ...................... Passed 0.80 sec
Start 61: injector_duplicated_type_with_different_annotation
62/365 Test #61: injector_duplicated_type_with_different_annotation ............................ Passed 0.09 sec
Start 63: injector_non_class_type
63/365 Test #63: injector_non_class_type .......................................................***Failed 0.37 sec
Start 64: injector_non_class_type_with_annotation
64/365 Test #64: injector_non_class_type_with_annotation .......................................***Failed 0.36 sec
Start 65: injector_non_class_type_with_different_annotation
65/365 Test #65: injector_non_class_type_with_different_annotation .............................***Failed 0.31 sec
Start 66: injector_with_requirements
66/365 Test #66: injector_with_requirements ....................................................***Failed 0.30 sec
Start 67: injector_with_requirements_with_annotations
67/365 Test #67: injector_with_requirements_with_annotations ...................................***Failed 0.33 sec
Start 69: install_component_swap_optimization-build
68/365 Test #69: install_component_swap_optimization-build ..................................... Passed 1.88 sec
Start 68: install_component_swap_optimization
69/365 Test #68: install_component_swap_optimization ........................................... Passed 0.10 sec
Start 71: late_binding_duplicate_consistent-build
70/365 Test #71: late_binding_duplicate_consistent-build ....................................... Passed 1.52 sec
Start 70: late_binding_duplicate_consistent
71/365 Test #70: late_binding_duplicate_consistent ............................................. Passed 0.10 sec
Start 73: late_binding_duplicate_consistent_with_annotation-build
72/365 Test #73: late_binding_duplicate_consistent_with_annotation-build ....................... Passed 1.71 sec
Start 72: late_binding_duplicate_consistent_with_annotation
73/365 Test #72: late_binding_duplicate_consistent_with_annotation ............................. Passed 0.10 sec
Start 75: late_binding_duplicate_error-build
74/365 Test #75: late_binding_duplicate_error-build ............................................ Passed 1.46 sec
Start 74: late_binding_duplicate_error
75/365 Test #74: late_binding_duplicate_error ..................................................***Failed 0.12 sec
Start 77: late_binding_duplicate_error_with_annotations-build
76/365 Test #77: late_binding_duplicate_error_with_annotations-build ........................... Passed 1.66 sec
Start 76: late_binding_duplicate_error_with_annotations
77/365 Test #76: late_binding_duplicate_error_with_annotations .................................***Failed 0.13 sec
Start 79: late_binding_duplicate_error_with_different_annotations-build
78/365 Test #79: late_binding_duplicate_error_with_different_annotations-build ................. Passed 1.40 sec
Start 78: late_binding_duplicate_error_with_different_annotations
79/365 Test #78: late_binding_duplicate_error_with_different_annotations ....................... Passed 0.09 sec
Start 80: late_binding_error_abstract_class
80/365 Test #80: late_binding_error_abstract_class .............................................***Failed 0.35 sec
Start 82: late_binding_new-build
81/365 Test #82: late_binding_new-build ........................................................ Passed 1.44 sec
Start 81: late_binding_new
82/365 Test #81: late_binding_new .............................................................. Passed 0.14 sec
Start 84: late_binding_new_with_annotation-build
83/365 Test #84: late_binding_new_with_annotation-build ........................................ Passed 1.54 sec
Start 83: late_binding_new_with_annotation
84/365 Test #83: late_binding_new_with_annotation .............................................. Passed 0.08 sec
Start 86: late_multibinding-build
85/365 Test #86: late_multibinding-build ....................................................... Passed 1.42 sec
Start 85: late_multibinding
86/365 Test #85: late_multibinding ............................................................. Passed 0.08 sec
Start 87: late_multibinding_error_abstract_class
87/365 Test #87: late_multibinding_error_abstract_class ........................................***Failed 0.33 sec
Start 89: late_multibinding_with_annotation-build
88/365 Test #89: late_multibinding_with_annotation-build ....................................... Passed 1.46 sec
Start 88: late_multibinding_with_annotation
89/365 Test #88: late_multibinding_with_annotation ............................................. Passed 0.09 sec
Start 91: lazy_injection-build
90/365 Test #91: lazy_injection-build .......................................................... Passed 1.50 sec
Start 90: lazy_injection
91/365 Test #90: lazy_injection ................................................................ Passed 0.12 sec
Start 93: lazy_injection_with_annotations-build
92/365 Test #93: lazy_injection_with_annotations-build ......................................... Passed 1.59 sec
Start 92: lazy_injection_with_annotations
93/365 Test #92: lazy_injection_with_annotations ............................................... Passed 0.09 sec
Start 95: lazy_injection_with_annotations2-build
94/365 Test #95: lazy_injection_with_annotations2-build ........................................ Passed 1.53 sec
Start 94: lazy_injection_with_annotations2
95/365 Test #94: lazy_injection_with_annotations2 .............................................. Passed 0.09 sec
Start 96: malformed_inject_typedef
96/365 Test #96: malformed_inject_typedef ......................................................***Failed 0.47 sec
Start 97: multibinding_error_abstract_class2
97/365 Test #97: multibinding_error_abstract_class2 ............................................***Failed 0.37 sec
Start 98: multibinding_error_not_base
98/365 Test #98: multibinding_error_not_base ...................................................***Failed 0.32 sec
Start 99: multibinding_error_not_base_with_annotations
99/365 Test #99: multibinding_error_not_base_with_annotations ..................................***Failed 0.33 sec
Start 101: multibindings_bind_instance-build
100/365 Test #101: multibindings_bind_instance-build ............................................. Passed 1.40 sec
Start 100: multibindings_bind_instance
101/365 Test #100: multibindings_bind_instance ................................................... Passed 0.11 sec
Start 103: multibindings_bind_instances-build
102/365 Test #103: multibindings_bind_instances-build ............................................ Passed 1.63 sec
Start 102: multibindings_bind_instances
103/365 Test #102: multibindings_bind_instances .................................................. Passed 0.10 sec
Start 105: multibindings_bind_instances_with_annotation-build
104/365 Test #105: multibindings_bind_instances_with_annotation-build ............................ Passed 1.46 sec
Start 104: multibindings_bind_instances_with_annotation
105/365 Test #104: multibindings_bind_instances_with_annotation .................................. Passed 0.09 sec
Start 107: multibindings_bind_instance_with_annotation-build
106/365 Test #107: multibindings_bind_instance_with_annotation-build ............................. Passed 1.39 sec
Start 106: multibindings_bind_instance_with_annotation
107/365 Test #106: multibindings_bind_instance_with_annotation ................................... Passed 0.10 sec
Start 109: multibindings-build
108/365 Test #109: multibindings-build ........................................................... Passed 1.74 sec
Start 108: multibindings
109/365 Test #108: multibindings ................................................................. Passed 0.11 sec
Start 111: multibindings_get_none-build
110/365 Test #111: multibindings_get_none-build .................................................. Passed 1.14 sec
Start 110: multibindings_get_none
111/365 Test #110: multibindings_get_none ........................................................ Passed 0.08 sec
Start 113: multibindings_value_provider-build
112/365 Test #113: multibindings_value_provider-build ............................................ Passed 1.63 sec
Start 112: multibindings_value_provider
113/365 Test #112: multibindings_value_provider .................................................. Passed 0.10 sec
Start 115: multibindings_value_provider_with_annotation-build
114/365 Test #115: multibindings_value_provider_with_annotation-build ............................ Passed 2.09 sec
Start 114: multibindings_value_provider_with_annotation
115/365 Test #114: multibindings_value_provider_with_annotation .................................. Passed 0.11 sec
Start 116: multibindings_value_provider_with_annotation_malformed_signature
116/365 Test #116: multibindings_value_provider_with_annotation_malformed_signature ..............***Failed 0.34 sec
Start 118: multibindings_with_annotations-build
117/365 Test #118: multibindings_with_annotations-build .......................................... Passed 1.93 sec
Start 117: multibindings_with_annotations
118/365 Test #117: multibindings_with_annotations ................................................ Passed 0.08 sec
Start 119: no_binding_found
119/365 Test #119: no_binding_found ..............................................................***Failed 0.36 sec
Start 120: no_binding_found_with_annotation
120/365 Test #120: no_binding_found_with_annotation ..............................................***Failed 0.38 sec
Start 121: no_factory_binding_found
121/365 Test #121: no_factory_binding_found ......................................................***Failed 0.34 sec
Start 122: no_factory_binding_found_with_annotation
122/365 Test #122: no_factory_binding_found_with_annotation ......................................***Failed 0.35 sec
Start 123: nonclass_type_in_component
123/365 Test #123: nonclass_type_in_component ....................................................***Failed 0.34 sec
Start 124: nonclass_type_in_component_with_annotation
124/365 Test #124: nonclass_type_in_component_with_annotation ....................................***Failed 0.33 sec
Start 125: nonclass_type_in_injector
125/365 Test #125: nonclass_type_in_injector .....................................................***Failed 0.36 sec
Start 126: nonclass_type_in_injector_with_annotation
126/365 Test #126: nonclass_type_in_injector_with_annotation .....................................***Failed 0.31 sec
Start 127: no_repeated_types_in_component2
127/365 Test #127: no_repeated_types_in_component2 ...............................................***Failed 0.30 sec
Start 128: no_repeated_types_in_component2_with_annotations
128/365 Test #128: no_repeated_types_in_component2_with_annotations ..............................***Failed 0.30 sec
Start 129: no_repeated_types_in_component3
129/365 Test #129: no_repeated_types_in_component3 ...............................................***Failed 0.31 sec
Start 130: no_repeated_types_in_component3_with_annotation
130/365 Test #130: no_repeated_types_in_component3_with_annotation ...............................***Failed 0.30 sec
Start 132: no_repeated_types_in_component3_with_different_annotation-build
131/365 Test #132: no_repeated_types_in_component3_with_different_annotation-build ............... Passed 1.11 sec
Start 131: no_repeated_types_in_component3_with_different_annotation
132/365 Test #131: no_repeated_types_in_component3_with_different_annotation ..................... Passed 0.09 sec
Start 133: no_repeated_types_in_component
133/365 Test #133: no_repeated_types_in_component ................................................***Failed 0.33 sec
Start 134: no_repeated_types_in_component_with_annotations
134/365 Test #134: no_repeated_types_in_component_with_annotations ...............................***Failed 0.33 sec
Start 136: no_repeated_types_in_component_with_different_annotations-build
135/365 Test #136: no_repeated_types_in_component_with_different_annotations-build ............... Passed 1.43 sec
Start 135: no_repeated_types_in_component_with_different_annotations
136/365 Test #135: no_repeated_types_in_component_with_different_annotations ..................... Passed 0.11 sec
Start 137: normalized_component_and_component_with_requirements
137/365 Test #137: normalized_component_and_component_with_requirements ..........................***Failed 0.41 sec
Start 138: normalized_component_and_component_with_requirements_with_annotation
138/365 Test #138: normalized_component_and_component_with_requirements_with_annotation ..........***Failed 0.38 sec
Start 139: normalized_component_repeated_type
139/365 Test #139: normalized_component_repeated_type ............................................***Failed 0.35 sec
Start 140: normalized_component_repeated_type_with_annotation
140/365 Test #140: normalized_component_repeated_type_with_annotation ............................***Failed 0.34 sec
Start 142: normalized_component_repeated_type_with_different_annotation-build
141/365 Test #142: normalized_component_repeated_type_with_different_annotation-build ............ Passed 0.90 sec
Start 141: normalized_component_repeated_type_with_different_annotation
142/365 Test #141: normalized_component_repeated_type_with_different_annotation .................. Passed 0.09 sec
Start 144: normalized_component_successful-build
143/365 Test #144: normalized_component_successful-build ......................................... Passed 1.71 sec
Start 143: normalized_component_successful
144/365 Test #143: normalized_component_successful ............................................... Passed 0.10 sec
Start 146: normalized_component_successful_with_annotations-build
145/365 Test #146: normalized_component_successful_with_annotations-build ........................ Passed 1.52 sec
Start 145: normalized_component_successful_with_annotations
146/365 Test #145: normalized_component_successful_with_annotations .............................. Passed 0.08 sec
Start 147: normalized_component_type_in_injector_not_provided
147/365 Test #147: normalized_component_type_in_injector_not_provided ............................***Failed 0.31 sec
Start 148: normalized_component_type_in_injector_not_provided_with_annotation
148/365 Test #148: normalized_component_type_in_injector_not_provided_with_annotation ............***Failed 0.34 sec
Start 149: normalized_component_type_required_and_provided
149/365 Test #149: normalized_component_type_required_and_provided ...............................***Failed 0.34 sec
Start 150: normalized_component_type_required_and_provided_with_annotation
150/365 Test #150: normalized_component_type_required_and_provided_with_annotation ...............***Failed 0.34 sec
Start 152: provider_get_during_injection_ok-build
151/365 Test #152: provider_get_during_injection_ok-build ........................................ Passed 1.39 sec
Start 151: provider_get_during_injection_ok
152/365 Test #151: provider_get_during_injection_ok .............................................. Passed 0.08 sec
Start 153: provider_get_never_provided
153/365 Test #153: provider_get_never_provided ...................................................***Failed 0.34 sec
Start 154: provider_get_not_provided
154/365 Test #154: provider_get_not_provided .....................................................***Failed 0.34 sec
Start 156: provider_get_ok-build
155/365 Test #156: provider_get_ok-build ......................................................... Passed 1.27 sec
Start 155: provider_get_ok
156/365 Test #155: provider_get_ok ............................................................... Passed 0.10 sec
Start 158: provider_get_ok_with_annotation-build
157/365 Test #158: provider_get_ok_with_annotation-build ......................................... Passed 1.27 sec
Start 157: provider_get_ok_with_annotation
158/365 Test #157: provider_get_ok_with_annotation ............................................... Passed 0.09 sec
Start 159: provider_non_class_type
159/365 Test #159: provider_non_class_type .......................................................***Failed 0.34 sec
Start 160: provider_type_with_annotation
160/365 Test #160: provider_type_with_annotation .................................................***Failed 0.32 sec
Start 162: register_constructor-build
161/365 Test #162: register_constructor-build .................................................... Passed 2.74 sec
Start 161: register_constructor
162/365 Test #161: register_constructor .......................................................... Passed 0.10 sec
Start 163: register_constructor_autoinject_annotation_in_signature_return_type
163/365 Test #163: register_constructor_autoinject_annotation_in_signature_return_type ...........***Failed 0.36 sec
Start 164: register_constructor_error_abstract_class
164/365 Test #164: register_constructor_error_abstract_class .....................................***Failed 0.40 sec
Start 165: register_constructor_malformed_signature_autoinject
165/365 Test #165: register_constructor_malformed_signature_autoinject ...........................***Failed 0.42 sec
Start 166: register_constructor_malformed_signature
166/365 Test #166: register_constructor_malformed_signature ......................................***Failed 0.38 sec
Start 167: register_constructor_not_existing_autoinject
167/365 Test #167: register_constructor_not_existing_autoinject ..................................***Failed 0.45 sec
Start 168: register_constructor_not_existing_autoinject_with_annotation
168/365 Test #168: register_constructor_not_existing_autoinject_with_annotation ..................***Failed 0.43 sec
Start 169: register_constructor_not_existing
169/365 Test #169: register_constructor_not_existing .............................................***Failed 0.34 sec
Start 170: register_constructor_not_existing_with_annotation
170/365 Test #170: register_constructor_not_existing_with_annotation .............................***Failed 0.34 sec
Start 172: register_constructor_with_annotation-build
171/365 Test #172: register_constructor_with_annotation-build .................................... Passed 2.68 sec
Start 171: register_constructor_with_annotation
172/365 Test #171: register_constructor_with_annotation .......................................... Passed 0.09 sec
Start 174: register_factory_autoinject-build
173/365 Test #174: register_factory_autoinject-build ............................................. Passed 1.59 sec
Start 173: register_factory_autoinject
174/365 Test #173: register_factory_autoinject ................................................... Passed 0.11 sec
Start 176: register_factory_autoinject2-build
175/365 Test #176: register_factory_autoinject2-build ............................................ Passed 1.44 sec
Start 175: register_factory_autoinject2
176/365 Test #175: register_factory_autoinject2 .................................................. Passed 0.10 sec
Start 178: register_factory_autoinject3-build
177/365 Test #178: register_factory_autoinject3-build ............................................ Passed 1.61 sec
Start 177: register_factory_autoinject3
178/365 Test #177: register_factory_autoinject3 .................................................. Passed 0.11 sec
Start 180: register_factory_autoinject4-build
179/365 Test #180: register_factory_autoinject4-build ............................................ Passed 1.89 sec
Start 179: register_factory_autoinject4
180/365 Test #179: register_factory_autoinject4 .................................................. Passed 0.12 sec
Start 182: register_factory_autoinject5-build
181/365 Test #182: register_factory_autoinject5-build ............................................ Passed 1.74 sec
Start 181: register_factory_autoinject5
182/365 Test #181: register_factory_autoinject5 .................................................. Passed 0.13 sec
Start 184: register_factory_autoinject_from_provider-build
183/365 Test #184: register_factory_autoinject_from_provider-build ............................... Passed 1.98 sec
Start 183: register_factory_autoinject_from_provider
184/365 Test #183: register_factory_autoinject_from_provider ..................................... Passed 0.11 sec
Start 186: register_factory_autoinject_from_provider_with_annotation-build
185/365 Test #186: register_factory_autoinject_from_provider_with_annotation-build ............... Passed 1.68 sec
Start 185: register_factory_autoinject_from_provider_with_annotation
186/365 Test #185: register_factory_autoinject_from_provider_with_annotation ..................... Passed 0.11 sec
Start 188: register_factory_autoinject_with_binding-build
187/365 Test #188: register_factory_autoinject_with_binding-build ................................ Passed 1.78 sec
Start 187: register_factory_autoinject_with_binding
188/365 Test #187: register_factory_autoinject_with_binding ...................................... Passed 0.09 sec
Start 190: register_factory_autoinject_with_binding2-build
189/365 Test #190: register_factory_autoinject_with_binding2-build ............................... Passed 1.80 sec
Start 189: register_factory_autoinject_with_binding2
190/365 Test #189: register_factory_autoinject_with_binding2 ..................................... Passed 0.09 sec
Start 192: register_factory_autoinject_with_binding_with_annotation-build
191/365 Test #192: register_factory_autoinject_with_binding_with_annotation-build ................ Passed 1.75 sec
Start 191: register_factory_autoinject_with_binding_with_annotation
192/365 Test #191: register_factory_autoinject_with_binding_with_annotation ...................... Passed 0.10 sec
Start 194: register_factory-build
193/365 Test #194: register_factory-build ........................................................ Passed 1.87 sec
Start 193: register_factory
194/365 Test #193: register_factory .............................................................. Passed 0.08 sec
Start 195: register_factory_autoinject_annotation_in_signature_return_type
195/365 Test #195: register_factory_autoinject_annotation_in_signature_return_type ...............***Failed 0.33 sec
Start 196: register_factory_autoinject_error_abstract_class
196/365 Test #196: register_factory_autoinject_error_abstract_class ..............................***Failed 0.41 sec
Start 198: register_factory_dep_on_provider-build
197/365 Test #198: register_factory_dep_on_provider-build ........................................ Passed 2.09 sec
Start 197: register_factory_dep_on_provider
198/365 Test #197: register_factory_dep_on_provider .............................................. Passed 0.10 sec
Start 199: register_factory_error_abstract_class
199/365 Test #199: register_factory_error_abstract_class .........................................***Failed 0.34 sec
Start 200: register_factory_error_not_function
200/365 Test #200: register_factory_error_not_function ...........................................***Failed 0.35 sec
Start 201: register_factory_for_pointer
201/365 Test #201: register_factory_for_pointer ..................................................***Failed 0.48 sec
Start 202: register_factory_for_pointer_with_annotation
202/365 Test #202: register_factory_for_pointer_with_annotation ..................................***Failed 0.40 sec
Start 204: register_factory_for_unique_pointer-build
203/365 Test #204: register_factory_for_unique_pointer-build ..................................... Passed 1.74 sec
Start 203: register_factory_for_unique_pointer
204/365 Test #203: register_factory_for_unique_pointer ........................................... Passed 0.09 sec
Start 206: register_factory_for_unique_pointer_with_annotation-build
205/365 Test #206: register_factory_for_unique_pointer_with_annotation-build ..................... Passed 1.75 sec
Start 205: register_factory_for_unique_pointer_with_annotation
206/365 Test #205: register_factory_for_unique_pointer_with_annotation ........................... Passed 0.11 sec
Start 207: register_factory_inconsistent_signature
207/365 Test #207: register_factory_inconsistent_signature .......................................***Failed 0.37 sec
Start 208: register_factory_inconsistent_signature_with_annotations
208/365 Test #208: register_factory_inconsistent_signature_with_annotations ......................***Failed 0.31 sec
Start 210: register_factory_nonmovable_ok-build
209/365 Test #210: register_factory_nonmovable_ok-build .......................................... Passed 1.43 sec
Start 209: register_factory_nonmovable_ok
210/365 Test #209: register_factory_nonmovable_ok ................................................ Passed 0.10 sec
Start 211: register_factory_not_existing_constructor1
211/365 Test #211: register_factory_not_existing_constructor1 ....................................***Failed 0.36 sec
Start 212: register_factory_not_existing_constructor1_with_annotation
212/365 Test #212: register_factory_not_existing_constructor1_with_annotation ....................***Failed 0.45 sec
Start 213: register_factory_not_existing_constructor2
213/365 Test #213: register_factory_not_existing_constructor2 ....................................***Failed 0.41 sec
Start 214: register_factory_not_existing_constructor2_with_annotation
214/365 Test #214: register_factory_not_existing_constructor2_with_annotation ....................***Failed 0.37 sec
Start 216: register_factory_with_annotation-build
215/365 Test #216: register_factory_with_annotation-build ........................................ Passed 1.91 sec
Start 215: register_factory_with_annotation
216/365 Test #215: register_factory_with_annotation .............................................. Passed 0.09 sec
Start 218: register_factory_with_different_annotation-build
217/365 Test #218: register_factory_with_different_annotation-build .............................. Passed 1.88 sec
Start 217: register_factory_with_different_annotation
218/365 Test #217: register_factory_with_different_annotation .................................... Passed 0.09 sec
Start 219: register_factory_with_different_annotation_error
219/365 Test #219: register_factory_with_different_annotation_error ..............................***Failed 0.30 sec
Start 221: register_instance-build
220/365 Test #221: register_instance-build ....................................................... Passed 1.26 sec
Start 220: register_instance
221/365 Test #220: register_instance ............................................................. Passed 0.09 sec
Start 223: register_instance_abstract_class_ok-build
222/365 Test #223: register_instance_abstract_class_ok-build ..................................... Passed 1.19 sec
Start 222: register_instance_abstract_class_ok
223/365 Test #222: register_instance_abstract_class_ok ........................................... Passed 0.09 sec
Start 225: register_instance_error1-build
224/365 Test #225: register_instance_error1-build ................................................ Passed 1.34 sec
Start 224: register_instance_error1
225/365 Test #224: register_instance_error1 ......................................................***Failed 0.12 sec
Start 227: register_instance_error1_with_annotations-build
226/365 Test #227: register_instance_error1_with_annotations-build ............................... Passed 1.34 sec
Start 226: register_instance_error1_with_annotations
227/365 Test #226: register_instance_error1_with_annotations .....................................***Failed 0.12 sec
Start 229: register_instance_error2-build
228/365 Test #229: register_instance_error2-build ................................................ Passed 1.45 sec
Start 228: register_instance_error2
229/365 Test #228: register_instance_error2 ......................................................***Failed 0.12 sec
Start 231: register_instance_error2_with_annotation-build
230/365 Test #231: register_instance_error2_with_annotation-build ................................ Passed 1.53 sec
Start 230: register_instance_error2_with_annotation
231/365 Test #230: register_instance_error2_with_annotation ......................................***Failed 0.12 sec
Start 233: register_instance_error3-build
232/365 Test #233: register_instance_error3-build ................................................ Passed 1.52 sec
Start 232: register_instance_error3
233/365 Test #232: register_instance_error3 ......................................................***Failed 0.11 sec
Start 235: register_instance_error3_with_annotation-build
234/365 Test #235: register_instance_error3_with_annotation-build ................................ Passed 1.56 sec
Start 234: register_instance_error3_with_annotation
235/365 Test #234: register_instance_error3_with_annotation ......................................***Failed 0.17 sec
Start 237: register_instance_with_annotation-build
236/365 Test #237: register_instance_with_annotation-build ....................................... Passed 1.53 sec
Start 236: register_instance_with_annotation
237/365 Test #236: register_instance_with_annotation ............................................. Passed 0.11 sec
Start 239: register_multibinding_provider-build
238/365 Test #239: register_multibinding_provider-build .......................................... Passed 1.54 sec
Start 238: register_multibinding_provider
239/365 Test #238: register_multibinding_provider ................................................ Passed 0.11 sec
Start 240: register_multibinding_provider_error_not_function
240/365 Test #240: register_multibinding_provider_error_not_function .............................***Failed 0.52 sec
Start 241: register_multibinding_provider_error_not_function_with_annotation
241/365 Test #241: register_multibinding_provider_error_not_function_with_annotation .............***Failed 0.34 sec
Start 243: register_multibinding_provider_error_returned_nullptr-build
242/365 Test #243: register_multibinding_provider_error_returned_nullptr-build ................... Passed 1.31 sec
Start 242: register_multibinding_provider_error_returned_nullptr
243/365 Test #242: register_multibinding_provider_error_returned_nullptr .........................***Failed 0.12 sec
Start 245: register_multibinding_provider_error_returned_nullptr_with_annotation-build
244/365 Test #245: register_multibinding_provider_error_returned_nullptr_with_annotation-build ... Passed 1.26 sec
Start 244: register_multibinding_provider_error_returned_nullptr_with_annotation
245/365 Test #244: register_multibinding_provider_error_returned_nullptr_with_annotation .........***Failed 0.13 sec
Start 247: register_multibinding_provider_with_annotation-build
246/365 Test #247: register_multibinding_provider_with_annotation-build .......................... Passed 1.39 sec
Start 246: register_multibinding_provider_with_annotation
247/365 Test #246: register_multibinding_provider_with_annotation ................................ Passed 0.09 sec
Start 249: register_provider-build
248/365 Test #249: register_provider-build ....................................................... Passed 1.52 sec
Start 248: register_provider
249/365 Test #248: register_provider ............................................................. Passed 0.10 sec
Start 250: register_provider_error_not_function
250/365 Test #250: register_provider_error_not_function ..........................................***Failed 0.34 sec
Start 251: register_provider_error_not_function_with_annotation
251/365 Test #251: register_provider_error_not_function_with_annotation ..........................***Failed 0.42 sec
Start 253: register_provider_error_returned_nullptr-build
252/365 Test #253: register_provider_error_returned_nullptr-build ................................ Passed 1.18 sec
Start 252: register_provider_error_returned_nullptr
253/365 Test #252: register_provider_error_returned_nullptr ......................................***Failed 0.12 sec
Start 255: register_provider_with_annotation-build
254/365 Test #255: register_provider_with_annotation-build ....................................... Passed 1.51 sec
Start 254: register_provider_with_annotation
255/365 Test #254: register_provider_with_annotation ............................................. Passed 0.09 sec
Start 256: register_provider_with_annotations_malformed_signature
256/365 Test #256: register_provider_with_annotations_malformed_signature ........................***Failed 0.40 sec
Start 258: register_provider_with_binding_compression-build
257/365 Test #258: register_provider_with_binding_compression-build .............................. Passed 1.64 sec
Start 257: register_provider_with_binding_compression
258/365 Test #257: register_provider_with_binding_compression .................................... Passed 0.15 sec
Start 260: register_provider_with_binding_compression_with_annotation-build
259/365 Test #260: register_provider_with_binding_compression_with_annotation-build .............. Passed 1.67 sec
Start 259: register_provider_with_binding_compression_with_annotation
260/365 Test #259: register_provider_with_binding_compression_with_annotation .................... Passed 0.09 sec
Start 262: register_value_factory_autoinject2-build
261/365 Test #262: register_value_factory_autoinject2-build ...................................... Passed 1.49 sec
Start 261: register_value_factory_autoinject2
262/365 Test #261: register_value_factory_autoinject2 ............................................ Passed 0.10 sec
Start 264: register_value_factory_autoinject4-build
263/365 Test #264: register_value_factory_autoinject4-build ...................................... Passed 1.58 sec
Start 263: register_value_factory_autoinject4
264/365 Test #263: register_value_factory_autoinject4 ............................................ Passed 0.12 sec
Start 265: register_value_factory_autoinject_annotation_in_signature_return_type
265/365 Test #265: register_value_factory_autoinject_annotation_in_signature_return_type .........***Failed 0.33 sec
Start 267: register_value_factory_autoinject-build
266/365 Test #267: register_value_factory_autoinject-build ....................................... Passed 1.51 sec
Start 266: register_value_factory_autoinject
267/365 Test #266: register_value_factory_autoinject ............................................. Passed 0.10 sec
Start 269: register_value_factory_autoinject_from_provider-build
268/365 Test #269: register_value_factory_autoinject_from_provider-build ......................... Passed 1.40 sec
Start 268: register_value_factory_autoinject_from_provider
269/365 Test #268: register_value_factory_autoinject_from_provider ............................... Passed 0.09 sec
Start 271: register_value_factory_autoinject_from_provider_with_annotation-build
270/365 Test #271: register_value_factory_autoinject_from_provider_with_annotation-build ......... Passed 1.43 sec
Start 270: register_value_factory_autoinject_from_provider_with_annotation
271/365 Test #270: register_value_factory_autoinject_from_provider_with_annotation ............... Passed 0.09 sec
Start 273: register_value_factory_autoinject_with_binding2-build
272/365 Test #273: register_value_factory_autoinject_with_binding2-build ......................... Passed 1.86 sec
Start 272: register_value_factory_autoinject_with_binding2
273/365 Test #272: register_value_factory_autoinject_with_binding2 ............................... Passed 0.12 sec
Start 275: register_value_factory_autoinject_with_binding-build
274/365 Test #275: register_value_factory_autoinject_with_binding-build .......................... Passed 2.00 sec
Start 274: register_value_factory_autoinject_with_binding
275/365 Test #274: register_value_factory_autoinject_with_binding ................................ Passed 0.10 sec
Start 277: register_value_factory_autoinject_with_binding_with_annotation-build
276/365 Test #277: register_value_factory_autoinject_with_binding_with_annotation-build .......... Passed 2.28 sec
Start 276: register_value_factory_autoinject_with_binding_with_annotation
277/365 Test #276: register_value_factory_autoinject_with_binding_with_annotation ................ Passed 0.12 sec
Start 279: register_value_factory_dep_on_provider-build
278/365 Test #279: register_value_factory_dep_on_provider-build .................................. Passed 4.02 sec
Start 278: register_value_factory_dep_on_provider
279/365 Test #278: register_value_factory_dep_on_provider ........................................ Passed 0.12 sec
Start 280: register_value_factory_for_pointer
280/365 Test #280: register_value_factory_for_pointer ............................................***Failed 0.43 sec
Start 281: register_value_factory_for_pointer_with_annotation
281/365 Test #281: register_value_factory_for_pointer_with_annotation ............................***Failed 0.52 sec
Start 283: register_value_factory_for_unique_pointer-build
282/365 Test #283: register_value_factory_for_unique_pointer-build ............................... Passed 2.43 sec
Start 282: register_value_factory_for_unique_pointer
283/365 Test #282: register_value_factory_for_unique_pointer ..................................... Passed 0.10 sec
Start 285: register_value_factory_for_unique_pointer_with_annotation-build
284/365 Test #285: register_value_factory_for_unique_pointer_with_annotation-build ............... Passed 1.48 sec
Start 284: register_value_factory_for_unique_pointer_with_annotation
285/365 Test #284: register_value_factory_for_unique_pointer_with_annotation ..................... Passed 0.08 sec
Start 286: register_value_factory_inconsistent_signature
286/365 Test #286: register_value_factory_inconsistent_signature .................................***Failed 0.29 sec
Start 287: register_value_factory_not_existing_constructor2
287/365 Test #287: register_value_factory_not_existing_constructor2 ..............................***Failed 0.30 sec
Start 288: register_value_factory_not_existing_constructor2_with_annotation
288/365 Test #288: register_value_factory_not_existing_constructor2_with_annotation ..............***Failed 0.33 sec
Start 290: register_value_factory_with_annotation-build
289/365 Test #290: register_value_factory_with_annotation-build .................................. Passed 1.60 sec
Start 289: register_value_factory_with_annotation
290/365 Test #289: register_value_factory_with_annotation ........................................ Passed 0.10 sec
Start 292: semistatic_map_hash_selection-build
291/365 Test #292: semistatic_map_hash_selection-build ........................................... Passed 1.51 sec
Start 291: semistatic_map_hash_selection
292/365 Test #291: semistatic_map_hash_selection ................................................. Passed 0.14 sec
Start 294: test1-build
293/365 Test #294: test1-build ................................................................... Passed 3.71 sec
Start 293: test1
294/365 Test #293: test1 ......................................................................... Passed 0.09 sec
Start 296: type_alignment-build
295/365 Test #296: type_alignment-build .......................................................... Passed 1.75 sec
Start 295: type_alignment
296/365 Test #295: type_alignment ................................................................ Passed 0.14 sec
Start 298: type_alignment_with_annotation-build
297/365 Test #298: type_alignment_with_annotation-build .......................................... Passed 2.25 sec
Start 297: type_alignment_with_annotation
298/365 Test #297: type_alignment_with_annotation ................................................ Passed 0.12 sec
Start 299: type_already_bound2
299/365 Test #299: type_already_bound2 ...........................................................***Failed 0.45 sec
Start 300: type_already_bound2_with_annotation
300/365 Test #300: type_already_bound2_with_annotation ...........................................***Failed 0.36 sec
Start 302: type_already_bound2_with_different_annotation-build
301/365 Test #302: type_already_bound2_with_different_annotation-build ........................... Passed 1.51 sec
Start 301: type_already_bound2_with_different_annotation
302/365 Test #301: type_already_bound2_with_different_annotation ................................. Passed 0.10 sec
Start 303: type_already_bound3
303/365 Test #303: type_already_bound3 ...........................................................***Failed 0.33 sec
Start 304: type_already_bound3_with_annotation
304/365 Test #304: type_already_bound3_with_annotation ...........................................***Failed 0.41 sec
Start 306: type_already_bound3_with_different_annotation-build
305/365 Test #306: type_already_bound3_with_different_annotation-build ........................... Passed 1.58 sec
Start 305: type_already_bound3_with_different_annotation
306/365 Test #305: type_already_bound3_with_different_annotation ................................. Passed 0.08 sec
Start 307: type_already_bound
307/365 Test #307: type_already_bound ............................................................***Failed 0.34 sec
Start 308: type_already_bound_different_kind_of_binding
308/365 Test #308: type_already_bound_different_kind_of_binding ..................................***Failed 0.37 sec
Start 309: type_already_bound_different_kind_of_binding2
309/365 Test #309: type_already_bound_different_kind_of_binding2 .................................***Failed 0.35 sec
Start 310: type_already_bound_during_component_merge
310/365 Test #310: type_already_bound_during_component_merge .....................................***Failed 0.35 sec
Start 311: type_already_bound_during_component_merge_with_annotations
311/365 Test #311: type_already_bound_during_component_merge_with_annotations ....................***Failed 0.47 sec
Start 313: type_already_bound_during_component_merge_with_different_annotation-build
312/365 Test #313: type_already_bound_during_component_merge_with_different_annotation-build ..... Passed 1.54 sec
Start 312: type_already_bound_during_component_merge_with_different_annotation
313/365 Test #312: type_already_bound_during_component_merge_with_different_annotation ........... Passed 0.11 sec
Start 314: type_already_bound_with_annotation
314/365 Test #314: type_already_bound_with_annotation ............................................***Failed 0.34 sec
Start 316: type_already_bound_with_different_annotation-build
315/365 Test #316: type_already_bound_with_different_annotation-build ............................ Passed 1.23 sec
Start 315: type_already_bound_with_different_annotation
316/365 Test #315: type_already_bound_with_different_annotation .................................. Passed 0.10 sec
Start 317: type_not_provided
317/365 Test #317: type_not_provided .............................................................***Failed 0.33 sec
Start 318: type_not_provided_with_annotation
318/365 Test #318: type_not_provided_with_annotation .............................................***Failed 0.34 sec
Start 320: unsafe_get-build
319/365 Test #320: unsafe_get-build .............................................................. Passed 1.78 sec
Start 319: unsafe_get
320/365 Test #319: unsafe_get .................................................................... Passed 0.10 sec
Start 322: unsafe_get_with_annotations-build
321/365 Test #322: unsafe_get_with_annotations-build ............................................. Passed 1.85 sec
Start 321: unsafe_get_with_annotations
322/365 Test #321: unsafe_get_with_annotations ................................................... Passed 0.08 sec
Start 323: unsatisfied_requirements_in_normalized_component
323/365 Test #323: unsatisfied_requirements_in_normalized_component ..............................***Failed 0.32 sec
Start 324: unsatisfied_requirements_in_normalized_component_with_annotation
324/365 Test #324: unsatisfied_requirements_in_normalized_component_with_annotation ..............***Failed 0.51 sec
Start 325: wrong_class_in_inject_typedef
325/365 Test #325: wrong_class_in_inject_typedef .................................................***Failed 0.47 sec
Start 326: wrong_class_in_inject_typedef_with_annotation
326/365 Test #326: wrong_class_in_inject_typedef_with_annotation .................................***Failed 0.34 sec
Start 327: multibinding_error_abstract_class_clang
327/365 Test #327: multibinding_error_abstract_class_clang .......................................***Failed 0.37 sec
Start 328: check-all-tests-listed-root
328/365 Test #328: check-all-tests-listed-root ................................................... Passed 1.16 sec
Start 330: semistatic_map-build
329/365 Test #330: semistatic_map-build .......................................................... Passed 2.19 sec
Start 329: semistatic_map
330/365 Test #329: semistatic_map ................................................................ Passed 0.14 sec
Start 332: semistatic_graph-build
331/365 Test #332: semistatic_graph-build ........................................................ Passed 3.84 sec
Start 331: semistatic_graph
332/365 Test #331: semistatic_graph .............................................................. Passed 0.09 sec
Start 334: hybrid_vector-build
333/365 Test #334: hybrid_vector-build ........................................................... Passed 1.11 sec
Start 333: hybrid_vector
334/365 Test #333: hybrid_vector ................................................................. Passed 0.08 sec
Start 336: fixed_size_vector-build
335/365 Test #336: fixed_size_vector-build ....................................................... Passed 0.72 sec
Start 335: fixed_size_vector
336/365 Test #335: fixed_size_vector ............................................................. Passed 0.09 sec
Start 338: fixed_size_allocator-build
337/365 Test #338: fixed_size_allocator-build .................................................... Passed 1.43 sec
Start 337: fixed_size_allocator
338/365 Test #337: fixed_size_allocator .......................................................... Passed 0.08 sec
Start 339: check-all-tests-listed-data-structures
339/365 Test #339: check-all-tests-listed-data-structures ........................................ Passed 0.02 sec
Start 341: basics-build
340/365 Test #341: basics-build .................................................................. Passed 0.41 sec
Start 340: basics
341/365 Test #340: basics ........................................................................ Passed 0.08 sec
Start 343: algos-build
342/365 Test #343: algos-build ...................................................................***Failed 0.29 sec
Start 342: algos
343/365 Test #342: algos .........................................................................***Failed 0.00 sec
Start 345: list-build
344/365 Test #345: list-build .................................................................... Passed 0.36 sec
Start 344: list
345/365 Test #344: list .......................................................................... Passed 0.09 sec
Start 347: vector-build
346/365 Test #347: vector-build .................................................................. Passed 0.35 sec
Start 346: vector
347/365 Test #346: vector ........................................................................ Passed 0.08 sec
Start 349: set-build
348/365 Test #349: set-build ..................................................................... Passed 0.44 sec
Start 348: set
349/365 Test #348: set ........................................................................... Passed 0.09 sec
Start 351: map-build
350/365 Test #351: map-build ..................................................................... Passed 0.38 sec
Start 350: map
351/365 Test #350: map ........................................................................... Passed 0.10 sec
Start 353: graph-build
352/365 Test #353: graph-build ................................................................... Passed 0.38 sec
Start 352: graph
353/365 Test #352: graph ......................................................................... Passed 0.09 sec
Start 355: proof_trees-build
354/365 Test #355: proof_trees-build ............................................................. Passed 0.49 sec
Start 354: proof_trees
355/365 Test #354: proof_trees ................................................................... Passed 0.11 sec
Start 357: component-build
356/365 Test #357: component-build ............................................................... Passed 0.47 sec
Start 356: component
357/365 Test #356: component ..................................................................... Passed 0.11 sec
Start 359: metaprogramming-build
358/365 Test #359: metaprogramming-build ......................................................... Passed 0.43 sec
Start 358: metaprogramming
359/365 Test #358: metaprogramming ............................................................... Passed 0.10 sec
Start 360: check-all-tests-listed-metaprogramming
360/365 Test #360: check-all-tests-listed-metaprogramming ........................................ Passed 0.06 sec
Start 362: lambda_invoker-build
361/365 Test #362: lambda_invoker-build .......................................................... Passed 0.69 sec
Start 361: lambda_invoker
362/365 Test #361: lambda_invoker ................................................................ Passed 0.09 sec
Start 364: type_info-build
363/365 Test #364: type_info-build ............................................................... Passed 0.72 sec
Start 363: type_info
364/365 Test #363: type_info .....................................................................***Exception: Other 0.06 sec
Start 365: check-all-tests-listed-util
365/365 Test #365: check-all-tests-listed-util ................................................... Passed 0.02 sec
67% tests passed, 119 tests failed out of 365
Total Test time (real) = 248.63 sec
The following tests FAILED:
3 - binding_error_bound_to_itself (Failed)
4 - binding_error_not_base (Failed)
5 - binding_error_not_base_with_annotations (Failed)
6 - bind_instance_error_already_bound (Failed)
7 - bind_instance_error_already_bound_with_annotation (Failed)
22 - component_repeated_type (Failed)
23 - component_repeated_type_with_annotations (Failed)
26 - component_type_required_and_provided (Failed)
27 - component_type_required_and_provided_with_annotations (Failed)
30 - dependency_loop (Failed)
31 - dependency_loop_with_annotations (Failed)
34 - duplicated_types_normalized_component (Failed)
35 - duplicated_types_normalized_component_with_annotations (Failed)
48 - factory_bindings_error_abstract_class (Failed)
53 - incompatible_double_injection (Failed)
55 - incompatible_double_injection_with_annotations (Failed)
59 - injector_duplicated_type (Failed)
60 - injector_duplicated_type_with_annotation (Failed)
63 - injector_non_class_type (Failed)
64 - injector_non_class_type_with_annotation (Failed)
65 - injector_non_class_type_with_different_annotation (Failed)
66 - injector_with_requirements (Failed)
67 - injector_with_requirements_with_annotations (Failed)
74 - late_binding_duplicate_error (Failed)
76 - late_binding_duplicate_error_with_annotations (Failed)
80 - late_binding_error_abstract_class (Failed)
87 - late_multibinding_error_abstract_class (Failed)
96 - malformed_inject_typedef (Failed)
97 - multibinding_error_abstract_class2 (Failed)
98 - multibinding_error_not_base (Failed)
99 - multibinding_error_not_base_with_annotations (Failed)
116 - multibindings_value_provider_with_annotation_malformed_signature (Failed)
119 - no_binding_found (Failed)
120 - no_binding_found_with_annotation (Failed)
121 - no_factory_binding_found (Failed)
122 - no_factory_binding_found_with_annotation (Failed)
123 - nonclass_type_in_component (Failed)
124 - nonclass_type_in_component_with_annotation (Failed)
125 - nonclass_type_in_injector (Failed)
126 - nonclass_type_in_injector_with_annotation (Failed)
127 - no_repeated_types_in_component2 (Failed)
128 - no_repeated_types_in_component2_with_annotations (Failed)
129 - no_repeated_types_in_component3 (Failed)
130 - no_repeated_types_in_component3_with_annotation (Failed)
133 - no_repeated_types_in_component (Failed)
134 - no_repeated_types_in_component_with_annotations (Failed)
137 - normalized_component_and_component_with_requirements (Failed)
138 - normalized_component_and_component_with_requirements_with_annotation (Failed)
139 - normalized_component_repeated_type (Failed)
140 - normalized_component_repeated_type_with_annotation (Failed)
147 - normalized_component_type_in_injector_not_provided (Failed)
148 - normalized_component_type_in_injector_not_provided_with_annotation (Failed)
149 - normalized_component_type_required_and_provided (Failed)
150 - normalized_component_type_required_and_provided_with_annotation (Failed)
153 - provider_get_never_provided (Failed)
154 - provider_get_not_provided (Failed)
159 - provider_non_class_type (Failed)
160 - provider_type_with_annotation (Failed)
163 - register_constructor_autoinject_annotation_in_signature_return_type (Failed)
164 - register_constructor_error_abstract_class (Failed)
165 - register_constructor_malformed_signature_autoinject (Failed)
166 - register_constructor_malformed_signature (Failed)
167 - register_constructor_not_existing_autoinject (Failed)
168 - register_constructor_not_existing_autoinject_with_annotation (Failed)
169 - register_constructor_not_existing (Failed)
170 - register_constructor_not_existing_with_annotation (Failed)
195 - register_factory_autoinject_annotation_in_signature_return_type (Failed)
196 - register_factory_autoinject_error_abstract_class (Failed)
199 - register_factory_error_abstract_class (Failed)
200 - register_factory_error_not_function (Failed)
201 - register_factory_for_pointer (Failed)
202 - register_factory_for_pointer_with_annotation (Failed)
207 - register_factory_inconsistent_signature (Failed)
208 - register_factory_inconsistent_signature_with_annotations (Failed)
211 - register_factory_not_existing_constructor1 (Failed)
212 - register_factory_not_existing_constructor1_with_annotation (Failed)
213 - register_factory_not_existing_constructor2 (Failed)
214 - register_factory_not_existing_constructor2_with_annotation (Failed)
219 - register_factory_with_different_annotation_error (Failed)
224 - register_instance_error1 (Failed)
226 - register_instance_error1_with_annotations (Failed)
228 - register_instance_error2 (Failed)
230 - register_instance_error2_with_annotation (Failed)
232 - register_instance_error3 (Failed)
234 - register_instance_error3_with_annotation (Failed)
240 - register_multibinding_provider_error_not_function (Failed)
241 - register_multibinding_provider_error_not_function_with_annotation (Failed)
242 - register_multibinding_provider_error_returned_nullptr (Failed)
244 - register_multibinding_provider_error_returned_nullptr_with_annotation (Failed)
250 - register_provider_error_not_function (Failed)
251 - register_provider_error_not_function_with_annotation (Failed)
252 - register_provider_error_returned_nullptr (Failed)
256 - register_provider_with_annotations_malformed_signature (Failed)
265 - register_value_factory_autoinject_annotation_in_signature_return_type (Failed)
280 - register_value_factory_for_pointer (Failed)
281 - register_value_factory_for_pointer_with_annotation (Failed)
286 - register_value_factory_inconsistent_signature (Failed)
287 - register_value_factory_not_existing_constructor2 (Failed)
288 - register_value_factory_not_existing_constructor2_with_annotation (Failed)
299 - type_already_bound2 (Failed)
300 - type_already_bound2_with_annotation (Failed)
303 - type_already_bound3 (Failed)
304 - type_already_bound3_with_annotation (Failed)
307 - type_already_bound (Failed)
308 - type_already_bound_different_kind_of_binding (Failed)
309 - type_already_bound_different_kind_of_binding2 (Failed)
310 - type_already_bound_during_component_merge (Failed)
311 - type_already_bound_during_component_merge_with_annotations (Failed)
314 - type_already_bound_with_annotation (Failed)
317 - type_not_provided (Failed)
318 - type_not_provided_with_annotation (Failed)
323 - unsatisfied_requirements_in_normalized_component (Failed)
324 - unsatisfied_requirements_in_normalized_component_with_annotation (Failed)
325 - wrong_class_in_inject_typedef (Failed)
326 - wrong_class_in_inject_typedef_with_annotation (Failed)
327 - multibinding_error_abstract_class_clang (Failed)
342 - algos (Failed)
343 - algos-build (Failed)
363 - type_info (OTHER_FAULT)
Errors while running CTest
make: *** [test] Error 8
Hi,
I have a segfault when a tried to use fruit::Provider
.
I have many differents writer and i need to choose one at runtime.
In the following code I have only one Writer,
but it's enough to cause the segfault.
Did i do something wrong ?
output:
Writer::write test1
[1] 90298 segmentation fault ./toto
code :
#include <fruit/fruit.h>
#include <iostream>
class Writer
{
public:
virtual void write(std::string a) const = 0;
};
class WriterImpl : public Writer
{
public:
INJECT(WriterImpl()) = default;
void write(std::string a) const override { std::cout << "Writer::write " << a << std::endl; }
};
class Greeter
{
public:
virtual void greet() const = 0;
};
class GreeterImpl : public Greeter
{
public:
INJECT(GreeterImpl(fruit::Provider<Writer> writerProvider))
: _writer(writerProvider.get())
{
_writer->write("test1");
}
void greet() const override
{
std::cout << "Greeter::greet" << std::endl;
_writer->write("test2");
}
private:
Writer *_writer;
};
int main()
{
fruit::Injector<Greeter> injector(fruit::createComponent()
.bind<Writer, WriterImpl>()
.bind<Greeter, GreeterImpl>()
);
Greeter *greeter(injector);
greeter->greet();
return 0;
}
This can only be done once there are 16.10 packages for LLVM (at http://apt.llvm.org/yakkety/ ).
Hi,
I'm a bit confused on how to actually use multibindings.
In the example in the quick reference you access the multibindings via the injector
object. But how would you inject that list of listeners into some other class. Do I need to make the injector
object globally accessible to do access the list of bound objects from within the class itself?
Hi,
At times we have sub-classes of our components. Is it possible to "pull" the installs from another component? Example:
struct InterfaceParent {};
struct ImplParent : InterfaceParent {};
fruit::Component<InterfaceParent> getParent() {
return fruit::createComponent()
.install(...)
.install(...)
.install(...)
.bind<InterfaceParent, ImplParent>();
}
struct InterfaceChild : InterfaceParent {};
struct ImplChild : InterfaceChild {};
fruit::Component<InterfaceChild> getChild() {
return fruit::createComponent()
.useInstallsFrom(getParent()) // ??? is it possible to do something like this?
.bind<InterfaceChild, ImplChild>();
}
It would be nice if there was an option to build fruit as a static library, currently the SHARED argument in the add_library() call in src/CMakeLists.txt seems to prevent overriding this behavior on the cmake command line.
This will replace the currently-tested Clang 3.9.
Hi,
I took the sample code provided by official website and was built with gcc 5.3.0 on Ubuntu 14.04.
The following is the backtrace:
#0 __GI___libc_free (mem=0xb) at malloc.c:2929
#1 0x0000000000405f60 in __gnu_cxx::new_allocatorstd::__detail::_Hash_node_base::deallocate(std::__detail::_Hash_node_base*, unsigned long) ()
#2 0x0000000000405914 in std::allocator_traitsstd::allocator<std::__detail::_Hash_node_base* >::deallocate(std::allocatorstd::__detail::_Hash_node_base*&, std::__detail::_Hash_node_base**, unsigned long) ()
#3 0x0000000000405e75 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<fruit::impl::TypeId const, fruit::impl::InjectorStorage::BindingCompressionInfo>, true> > >::_M_deallocate_buckets(std::__detail::_Hash_node_base**, unsigned long) ()
#4 0x00000000004057ca in std::_Hashtable<fruit::impl::TypeId, std::pair<fruit::impl::TypeId const, fruit::impl::InjectorStorage::BindingCompressionInfo>, std::allocator<std::pair<fruit::impl::TypeId const, fruit::impl::InjectorStorage::BindingCompressionInfo> >, std::__detail::_Select1st, std::equal_tofruit::impl::TypeId, std::hashfruit::impl::TypeId, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_deallocate_buckets(std::__detail::_Hash_node_base**, unsigned long) ()
#5 0x00000000004051b6 in std::_Hashtable<fruit::impl::TypeId, std::pair<fruit::impl::TypeId const, fruit::impl::InjectorStorage::BindingCompressionInfo>, std::allocator<std::pair<fruit::impl::TypeId const, fruit::impl::InjectorStorage::BindingCompressionInfo> >, std::__detail::_Select1st, std::equal_tofruit::impl::TypeId, std::hashfruit::impl::TypeId, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_deallocate_buckets() ()
#6 0x0000000000404d6e in std::_Hashtable<fruit::impl::TypeId, std::pair<fruit::impl::TypeId const, fruit::impl::InjectorStorage::BindingCompressionInfo>, std::allocator<std::pair<fruit::impl::TypeId const, fruit::impl::InjectorStorage::BindingCompressionInfo> >, std::__detail::_Select1st, std::equal_tofruit::impl::TypeId, std::hashfruit::impl::TypeId, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable() ()
#7 0x00000000004046b0 in std::unordered_map<fruit::impl::TypeId, fruit::impl::InjectorStorage::BindingCompressionInfo, std::hashfruit::impl::TypeId, std::equal_tofruit::impl::TypeId, std::allocator<std::pair<fruit::impl::TypeId const, fruit::impl::InjectorStorage::BindingCompressionInfo> > >::~unordered_map() ()
#8 0x00000000004046d2 in fruit::impl::NormalizedComponentStorage::~NormalizedComponentStorage() ()
#9 0x0000000000404714 in std::default_deletefruit::impl::NormalizedComponentStorage::operator()(fruit::impl::NormalizedComponentStorage*) const ()
#10 0x0000000000403d35 in std::unique_ptr<fruit::impl::NormalizedComponentStorage, std::default_deletefruit::impl::NormalizedComponentStorage >::~unique_ptr() ()
#11 0x00000000004034b8 in fruit::impl::InjectorStorage::~InjectorStorage() ()
#12 0x00000000004034de in std::default_deletefruit::impl::InjectorStorage::operator()(fruit::impl::InjectorStorage*) const ()
#13 0x0000000000402af1 in std::unique_ptr<fruit::impl::InjectorStorage, std::default_deletefruit::impl::InjectorStorage >::~unique_ptr() ()
#14 0x00000000004023c0 in fruit::Injector::~Injector() ()
#15 0x0000000000401a7c in main ()**
For example, this doesn't compile and it should.
#include <fruit/fruit.h>
struct X {
virtual void foo() = 0;
};
using XFactory = std::function<std::unique_ptr<X>()>;
struct Y {
INJECT(Y(XFactory)) {}
};
fruit::Component<fruit::Required<XFactory>, Y> getYComponent() {
return fruit::createComponent();
}
Hello, I've got a cmake issue on Windows 10 x64, VS 2015 u1:
fruit\cmake_build>cmake .. -G "Visual Studio 14 2015 Win64"
I'm attaching cmake_build.zip, but for brevity here is the error that stops cmake:
C:\Users\josh\projects\Fruitfly\dep\fruit\cmake_build\CMakeFiles\CMakeTmp\src.cxx(2): fatal error C1083: Cannot open include file: 'cxxabi.h': No such file or directory [C:\Users\josh\projects\Fruitfly\dep\fruit\cmake_build\CMakeFiles\CMakeTmp\cmTC_fcf0e.vcxproj]
Done Building Project "C:\Users\josh\projects\Fruitfly\dep\fruit\cmake_build\CMakeFiles\CMakeTmp\cmTC_fcf0e.vcxproj" (default targets) -- FAILED.
It looks like a libstdc++
header; is there a Windows corollary? If not, is there any plan to support Windows in the future?
Things to fix:
dh_prep
instead of dh_clean -k
Using a brand new MAC OS environment, there is a compilation error:
/works/cpp/fruit/src/demangle_type_name.cpp:32:5: error: use of undeclared identifier 'free'
free(demangled_name);
that can be fixed by adding:
#include <cstdlib>
in the same file.
For example:
This logic should be aware of the auto-injection for factories too, for example if there is a bind<X, XImpl>
and a fruit::Annotated<Annotation1, std::factory<std::unique_ptr<X>()>>
is missing, it's likely that the user forgot the annotation in the binding and we should point this out to help fix the issue.
I'm trying to use Fruit with FakeIt in a unit test. Needless to say, I'm stuck.
I have quite a normal setup here for the code under test:
// component required by the main component
Component<RequiredComponent> getRequiredComponent() {
return createComponent()
.bind<RequiredComponent, RequiredComponentImpl>();
}
// component required in testing
class DependentComponent {
INJECT(DependentComponent(RequiredComponent * reqComp, ASSISTED(double) arg)) = default;
}
using DependentFactory = function<unique_ptr<DependentComponent>(double)>;
Component<Required<RequiredComponent>, DependentFactory> getDependentComponent() {
return createComponent().install(getRequiredComponent());
}
The compiler is happy and so I am. Now to the test:
Mock<RequiredComponent> mockRequired;
When(Method(mockRequired, someMethod)).Return(fakeData);
// now what ??
How to get the mock object, returned by mockRequired.get()
and install it in the factory?
Using the __PRETTY_FUNCTION__
-in-a-template-function trick to have a compile-time ID of a type.
This would allow to use "throw ..." instead of simulating exception handling in the metafunction implementation.
After checking that the current compiler supports it of course.
GCC and Clang do.
This could slightly improve performance.
Make installs all headers into "/usr/include/fruit/include/fruit" instead of simply "/usr/include/fruit" that creates need of very strange includes: #include <fruit/include/fruit/fruit.h>
.
Fruit: 1.0.2 built on release
OS: Gentoo on 3.19 linux kernel
GCC: 4.8.2
Make: 4.1
CMake: 3.1.0
I love fruit and the flexibility that it offers to me. Unfortunately I am stuck with my design approach using the decorator pattern unfortunately. In a nutshell I have a producer and a caching producer that implement the same interface.
For maximum flexibility, I want to inject the producer into caching producer. However, that seems to cause problems with fruit (cyclic depdencies?). to put in code what I mean:
struct Producer {...};
struct ProducerImpl : Producer {
INJECT(ProducerImpl()) = default;
};
struct CachingProducerImpl : Producer {
INJECT(CachingProducerImpl(
std::shared_ptr<Producer> producer
)) {...}
};
TL;DR Can I somehow make the decorator pattern work with fruit?
Only make/ctest is supported ATM.
In some use cases of bindInstance
, people might want to bind constants. To support this use case, the following changes are needed:
const C
, const C&
and const C*
to be const C
(instead of C
)const C
and C
(with tests)const C
binding is required, a C
binding can satisfy this requirement (also add tests for this)bindInstance(const C&)
bindInstance(const C&)
(the reference must outlive the injector) and add a deleted bindInstance(C&&)
overload to make sure temporaries are rejected.This should save a little space and compile time, impact on runtime TBD.
I'm trying to evaluate if i can use fruit for something production. Either I'm using fruit::Assisted wrongly or there's a bug somewhere with registerFactory or Assisted.
When the constructor of a class has multiple Assisted arguments. Compilation fails with an error like this:
fruit::impl::NoBindingFoundError<std::function<std::unique_ptr<di::TransientMultiplier>(std::basic_string<char>, int)> >’:
To reproduce the error, create a simple class like this:
class Transient
{
public:
virtual const int getId() const = 0;
virtual const std::string getName() const = 0;
};
And create a dependent class like this:
class TransientMultiplier
{
private:
const Transient& transient;
std::string suffix;
int index;
public:
TransientMultiplier(const Transient& transient, const std::string suffix,
const int index)
:transient(transient), suffix(suffix), index(index)
{
}
virtual const std::string getSuffixed()
{
std::ostringstream ss;
ss << transient.getName() << suffix << index;
return ss.str();
}
};
TransientMultiplier needs an injected Transient& in its constructor. suffix and index are value types that are supposed to be passed at runtime so they are marked as Assisted
typedef std::function<std::unique_ptr<TransientMultiplier>(std::tuple<const std::string, const int>)> TransientMultiplierFactory;
fruit::Component<fruit::Required<Transient>, TransientMultiplierFactory> getTransientMultiplierFactoryComponent()
{
using fruit::Assisted;
return fruit::createComponent()
.registerFactory
<std::unique_ptr<TransientMultiplier>(Transient* t,
Assisted<const std::string>, Assisted<const int>)>
(
[](Transient* transient, const std::string suffix, const int index)
{
return std::unique_ptr<TransientMultiplier>(
new TransientMultiplier(*transient, suffix, index));
}
);
}
This looks okay to me. But it does not compile, with a NoBindingFoundError that looks very confusing.
In file included from /usr/include/fruit/fruit.h:25:0,
from ../di/Transient.cpp:2:
/usr/include/fruit/impl/injection_errors.h: In instantiation of ‘struct fruit::impl::NoBindingFoundError<std::function<std::unique_ptr<di::TransientMultiplier>(std::basic_string<char>, int)> >’:
/usr/include/fruit/impl/component.defn.h:58:3: required from ‘fruit::Component<Types>::Component(fruit::PartialComponent<Bindings ...>) [with Bindings = {fruit::impl::RegisterFactory<std::unique_ptr<di::TransientMultiplier, std::default_delete<di::TransientMultiplier> >(di::Transient*, fruit::Assisted<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, fruit::Assisted<const int>), di::getTransientMultiplierFactoryComponent()::__lambda16>}; Params = {fruit::Required<di::Transient>, std::function<std::unique_ptr<di::TransientMultiplier, std::default_delete<di::TransientMultiplier> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)>}]’
../di/Transient.cpp:126:9: required from here
/usr/include/fruit/impl/injection_errors.h:33:3: error: static assertion failed: No explicit binding nor C::Inject definition was found for T.
static_assert(
^
In file included from /usr/include/fruit/component.h:498:0,
from /usr/include/fruit/fruit.h:28,
from ../di/Transient.cpp:2:
/usr/include/fruit/impl/component.defn.h: In instantiation of ‘fruit::Component<Types>::Component(fruit::PartialComponent<Bindings ...>) [with Bindings = {fruit::impl::RegisterFactory<std::unique_ptr<di::TransientMultiplier, std::default_delete<di::TransientMultiplier> >(di::Transient*, fruit::Assisted<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, fruit::Assisted<const int>), di::getTransientMultiplierFactoryComponent()::__lambda16>}; Params = {fruit::Required<di::Transient>, std::function<std::unique_ptr<di::TransientMultiplier, std::default_delete<di::TransientMultiplier> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)>}]’:
../di/Transient.cpp:126:9: required from here
/usr/include/fruit/impl/component.defn.h:61:3: error: no type named ‘Result’ in ‘fruit::impl::meta::OpForComponent<fruit::impl::RegisterFactory<std::unique_ptr<di::TransientMultiplier, std::default_delete<di::TransientMultiplier> >(di::Transient*, fruit::Assisted<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, fruit::Assisted<const int>), di::getTransientMultiplierFactoryComponent()::__lambda16> >::ConvertTo<fruit::impl::meta::Comp<fruit::impl::meta::Vector<fruit::impl::meta::Type<di::Transient> >, fruit::impl::meta::Vector<fruit::impl::meta::Type<std::function<std::unique_ptr<di::TransientMultiplier, std::default_delete<di::TransientMultiplier> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)> > >, fruit::impl::meta::Vector<fruit::impl::meta::Pair<fruit::impl::meta::Type<std::function<std::unique_ptr<di::TransientMultiplier, std::default_delete<di::TransientMultiplier> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)> >, fruit::impl::meta::Vector<fruit::impl::meta::Type<di::Transient> > > >, fruit::impl::meta::Vector<>, fruit::impl::meta::EmptyList> > {aka struct fruit::impl::meta::Error<fruit::impl::NoBindingFoundErrorTag, std::function<std::unique_ptr<di::TransientMultiplier, std::default_delete<di::TransientMultiplier> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)> >}’
(void)typename fruit::impl::meta::CheckIfError<fruit::impl::meta::Eval<fruit::impl::meta::CheckNoLoopInDeps(typename Op::Result)>>::type();
^
In file included from /usr/include/fruit/component.h:498:0,
from /usr/include/fruit/fruit.h:28,
from ../di/Transient.cpp:2:
/usr/include/fruit/impl/component.defn.h:64:15: error: no match for call to ‘(Op {aka fruit::impl::meta::Error<fruit::impl::NoBindingFoundErrorTag, std::function<std::unique_ptr<di::TransientMultiplier, std::default_delete<di::TransientMultiplier> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)> >}) (fruit::impl::ComponentStorage&)’
Op()(storage);
^
I can go around the problem by putting suffix and index in a std::tuple<string, int>. But that's very inconvenient. So can we not put multiple fruit::Assisted arguments in the same constructor of a class that's going to be binded via registerFactory?
I'm using libfruit Version: 2.0.0-0 on Ubuntu 14.04 installed from this deb:
deb http://download.opensuse.org/repositories/home:/poletti_marco/xUbuntu_14.04/ /
/usr/local/include/fruit/impl/storage/component_storage.defn.h:88: undefined reference to fruit::impl::GreedyAllocatorStorage::clear()' main.o: In function
fruit::impl::GreedyAllocatorStorage::~GreedyAllocatorStorage()':
...
main.o: In function fruit::Injector<Greeter>::Injector(fruit::Component<Greeter>)': /usr/local/include/fruit/impl/injector.defn.h:30: undefined reference to
fruit::impl::InjectorStorage::InjectorStorage(fruit::impl::ComponentStorage&&, std::vector<fruit::impl::TypeId, std::allocatorfruit::impl::TypeId > const&)'
main.o: In function std::default_delete<fruit::impl::InjectorStorage>::operator()(fruit::impl::InjectorStorage*) const': /usr/include/c++/5/bits/unique_ptr.h:76: undefined reference to
fruit::impl::InjectorStorage::~InjectorStorage()'
main.o: In function fruit::impl::SemistaticGraph<fruit::impl::TypeId, fruit::impl::NormalizedBindingData>::at(fruit::impl::TypeId)': /usr/local/include/fruit/impl/data_structures/semistatic_graph.defn.h:131: undefined reference to
fruit::impl::SemistaticMap<fruit::impl::TypeId, fruit::impl::SemistaticGraphInternalNodeId>::at(fruit::impl::TypeId) const'
collect2: error: ld returned 1 exit status
make: *** [fruit] Error 1
I'm adding fruit
project as a subdirectory in my project with add_subdirectory(fruit EXCLUDE_FROM_ALL)
and from now on all library targets are building as shared as well.
This is related to #7, and #8 especially this change in main CMakeLists.txt
:
option(BUILD_SHARED_LIBS "Build shared library" ON)
As according to cmake-variables(7)
this variable is global and will propagate to all library targets defined after including fruit
. My best guess is that mentioned change was just to add some kind of compatiblity (previously the library was SHARED
). Manual says that the typical usage of this variable is through an option
.
I'd suggest removing mentioned change, as according to cmake-variables(7)
. If there is a need for shared library in CI you can always specify -DBUILD_SHARED_LIBS=ON
to produce .so
, but by default it would be a static one.
If there isn't any side effects that I didn't think of I'll be happy to prepare a pull request.
At HEAD, the per-request time is significantly higher under Clang 4.0 compared to GCC 6.2.0:
Fruit per-request time | 100 classes | 1000 classes |
---|---|---|
Clang 4.0.0 | 18 us | 300 us |
GCC 6.2.0 | 2.1-2.2 us | 110 us |
This should be investigated, to determine if it is:
And it should be fixed, to bring back Clang performance in the 2-3us per 100 injected classes range (similar to GCC).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.