mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Revert minimal D compatibility to 2.068.2
Now that GDC has been officially upgraded to 2.068.2 we can drop baseline support to that version.
This commit is contained in:
parent
9938c0de26
commit
4ac095c25b
|
@ -6,8 +6,6 @@ d:
|
||||||
- dmd-2.070.2
|
- dmd-2.070.2
|
||||||
- dmd-2.069.2
|
- dmd-2.069.2
|
||||||
- dmd-2.068.2
|
- dmd-2.068.2
|
||||||
- dmd-2.067.1
|
|
||||||
- dmd-2.066.1
|
|
||||||
- ldc
|
- ldc
|
||||||
- ldc-1.1.0-beta6
|
- ldc-1.1.0-beta6
|
||||||
- ldc-0.17.2
|
- ldc-0.17.2
|
||||||
|
|
|
@ -2,7 +2,6 @@ Poodinis Changelog
|
||||||
==================
|
==================
|
||||||
**Version NEXT**
|
**Version NEXT**
|
||||||
* ADD value injection. Members with UDA @Value will be attempted to be injected with a value-type. See tutorial and examples for more info.
|
* ADD value injection. Members with UDA @Value will be attempted to be injected with a value-type. See tutorial and examples for more info.
|
||||||
* ADD Phobos 2.072.1 forwards-compatibility for D/Phobos 2.066.1. This means you can use Poodinis with D/Phobos 2.066.1 compatible compilers such as GDC.
|
|
||||||
* ADD @PostConstruct UDA for marking methods which should be called after a dependency is resolved and autowired.
|
* ADD @PostConstruct UDA for marking methods which should be called after a dependency is resolved and autowired.
|
||||||
* ADD @PreDestroy UDA for marking methods which should be called when the container loses a dependency's registration. It is called when
|
* ADD @PreDestroy UDA for marking methods which should be called when the container loses a dependency's registration. It is called when
|
||||||
removeRegistration or clearAllRegistrations is called. It is also called when the container is destroyed.
|
removeRegistration or clearAllRegistrations is called. It is also called when the container is destroyed.
|
||||||
|
|
|
@ -8,7 +8,7 @@ Master: [![Build Status](https://api.travis-ci.org/mbierlee/poodinis.png?branch=
|
||||||
|
|
||||||
Poodinis is a dependency injection framework for the D programming language. It is inspired by the [Spring Framework] and [Hypodermic] IoC container for C++. Poodinis supports registering and resolving classes either by concrete type or interface. Automatic injection of dependencies is supported through the use of UDAs or constructors.
|
Poodinis is a dependency injection framework for the D programming language. It is inspired by the [Spring Framework] and [Hypodermic] IoC container for C++. Poodinis supports registering and resolving classes either by concrete type or interface. Automatic injection of dependencies is supported through the use of UDAs or constructors.
|
||||||
|
|
||||||
Requires at least a D 2.066.1 compatible compiler
|
Requires at least a D 2.068.2 compatible compiler
|
||||||
Uses the Phobos standard library
|
Uses the Phobos standard library
|
||||||
Can be built with DUB 1.1.1 or higher
|
Can be built with DUB 1.1.1 or higher
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import poodinis.container;
|
||||||
import poodinis.registration;
|
import poodinis.registration;
|
||||||
import poodinis.factory;
|
import poodinis.factory;
|
||||||
import poodinis.valueinjection;
|
import poodinis.valueinjection;
|
||||||
import poodinis.polyfill;
|
|
||||||
|
|
||||||
import std.exception;
|
import std.exception;
|
||||||
import std.stdio;
|
import std.stdio;
|
||||||
|
|
|
@ -18,7 +18,6 @@ import poodinis.autowire;
|
||||||
import poodinis.context;
|
import poodinis.context;
|
||||||
import poodinis.factory;
|
import poodinis.factory;
|
||||||
import poodinis.valueinjection;
|
import poodinis.valueinjection;
|
||||||
import poodinis.polyfill;
|
|
||||||
|
|
||||||
import std.string;
|
import std.string;
|
||||||
import std.algorithm;
|
import std.algorithm;
|
||||||
|
|
|
@ -16,7 +16,6 @@ module poodinis.context;
|
||||||
import poodinis.container;
|
import poodinis.container;
|
||||||
import poodinis.registration;
|
import poodinis.registration;
|
||||||
import poodinis.factory;
|
import poodinis.factory;
|
||||||
import poodinis.polyfill;
|
|
||||||
import poodinis.autowire;
|
import poodinis.autowire;
|
||||||
|
|
||||||
import std.traits;
|
import std.traits;
|
||||||
|
|
|
@ -18,7 +18,6 @@ import std.exception;
|
||||||
import std.traits;
|
import std.traits;
|
||||||
import std.string;
|
import std.string;
|
||||||
import std.stdio;
|
import std.stdio;
|
||||||
import poodinis.polyfill;
|
|
||||||
|
|
||||||
alias CreatesSingleton = Flag!"CreatesSingleton";
|
alias CreatesSingleton = Flag!"CreatesSingleton";
|
||||||
alias InstanceFactoryMethod = Object delegate();
|
alias InstanceFactoryMethod = Object delegate();
|
||||||
|
|
|
@ -4,29 +4,20 @@
|
||||||
*
|
*
|
||||||
* Should not implement functionalitiy which is gone from the latest Phobos.
|
* Should not implement functionalitiy which is gone from the latest Phobos.
|
||||||
*
|
*
|
||||||
* Implementations copied/re-implemented from std.traits, std.meta (std.typetuple)
|
* Implementations copied/re-implemented from std.exception
|
||||||
* and std.exception
|
|
||||||
*
|
*
|
||||||
* The baseline compatibility is D/Phobos 2.066.1
|
* The baseline compatibility is D/Phobos 2.068.2
|
||||||
*
|
*
|
||||||
* Authors: $(HTTP erdani.org, Andrei Alexandrescu),
|
* Authors: $(HTTP erdani.org, Andrei Alexandrescu),
|
||||||
* Jonathan M Davis,
|
* Jonathan M Davis,
|
||||||
* $(HTTP digitalmars.com, Walter Bright),
|
|
||||||
* Tomasz Stachowiak ($(D isExpressions)),
|
|
||||||
* Shin Fujishiro,
|
|
||||||
* $(HTTP octarineparrot.com, Robert Clipsham),
|
|
||||||
* $(HTTP klickverbot.at, David Nadlinger),
|
|
||||||
* Kenji Hara,
|
|
||||||
* Shoichi Kato,
|
|
||||||
* Mike Bierlee (m.bierlee@lostmoment.com)
|
* Mike Bierlee (m.bierlee@lostmoment.com)
|
||||||
* Copyright: Copyright Digital Mars 2005 - 2015, Copyright Andrei Alexandrescu 2008-, Jonathan M Davis 2011-., 2014-2016 Mike Bierlee
|
* Copyright: Copyright Andrei Alexandrescu 2008-, Jonathan M Davis 2011-., 2014-2016 Mike Bierlee
|
||||||
* License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
* License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module poodinis.polyfill;
|
module poodinis.polyfill;
|
||||||
|
|
||||||
import std.exception;
|
import std.exception;
|
||||||
import std.traits;
|
|
||||||
|
|
||||||
static if (!__traits(compiles, basicExceptionCtors)) {
|
static if (!__traits(compiles, basicExceptionCtors)) {
|
||||||
mixin template basicExceptionCtors()
|
mixin template basicExceptionCtors()
|
||||||
|
@ -42,54 +33,3 @@ static if (!__traits(compiles, basicExceptionCtors)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static if (!__traits(compiles, enforce!Exception(true, "Message"))) {
|
|
||||||
T enforce(E: Exception, T)(T value, string message) {
|
|
||||||
if (value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new E(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static if (!__traits(compiles, FieldNameTuple)) {
|
|
||||||
private enum NameOf(alias T) = T.stringof;
|
|
||||||
|
|
||||||
template FieldNameTuple(T)
|
|
||||||
{
|
|
||||||
import std.typetuple : staticMap;
|
|
||||||
static if (is(T == struct) || is(T == union))
|
|
||||||
alias FieldNameTuple = staticMap!(NameOf, T.tupleof[0 .. $ - isNested!T]);
|
|
||||||
else static if (is(T == class))
|
|
||||||
alias FieldNameTuple = staticMap!(NameOf, T.tupleof);
|
|
||||||
else
|
|
||||||
alias FieldNameTuple = TypeTuple!"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static if (!__traits(compiles, hasUDA)) {
|
|
||||||
template hasUDA(alias symbol, alias attribute)
|
|
||||||
{
|
|
||||||
public static bool hasUda() {
|
|
||||||
foreach(uda; __traits(getAttributes, symbol)) {
|
|
||||||
if (is(uda == attribute)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
enum hasUDA = hasUda();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static if (!__traits(compiles, Parameters)) {
|
|
||||||
template Parameters(func...)
|
|
||||||
if (func.length == 1 && isCallable!func)
|
|
||||||
{
|
|
||||||
static if (is(FunctionTypeOf!func P == function))
|
|
||||||
alias Parameters = P;
|
|
||||||
else
|
|
||||||
static assert(0, "argument has no parameters");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue