From 4ac095c25b4540da67fd4daad310d85f7bd6632b Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Mon, 26 Dec 2016 15:29:57 +0100 Subject: [PATCH] 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. --- .travis.yml | 2 -- CHANGES.md | 1 - README.md | 2 +- source/poodinis/autowire.d | 1 - source/poodinis/container.d | 1 - source/poodinis/context.d | 1 - source/poodinis/factory.d | 1 - source/poodinis/polyfill.d | 66 ++----------------------------------- 8 files changed, 4 insertions(+), 71 deletions(-) diff --git a/.travis.yml b/.travis.yml index fed7644..3b28dc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ d: - dmd-2.070.2 - dmd-2.069.2 - dmd-2.068.2 - - dmd-2.067.1 - - dmd-2.066.1 - ldc - ldc-1.1.0-beta6 - ldc-0.17.2 diff --git a/CHANGES.md b/CHANGES.md index 9913922..ead54af 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,6 @@ Poodinis Changelog ================== **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 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 @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. diff --git a/README.md b/README.md index e5fea0b..66774a7 100644 --- a/README.md +++ b/README.md @@ -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. -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 Can be built with DUB 1.1.1 or higher diff --git a/source/poodinis/autowire.d b/source/poodinis/autowire.d index cfc2708..6f544e8 100644 --- a/source/poodinis/autowire.d +++ b/source/poodinis/autowire.d @@ -21,7 +21,6 @@ import poodinis.container; import poodinis.registration; import poodinis.factory; import poodinis.valueinjection; -import poodinis.polyfill; import std.exception; import std.stdio; diff --git a/source/poodinis/container.d b/source/poodinis/container.d index e663f31..df7f5aa 100644 --- a/source/poodinis/container.d +++ b/source/poodinis/container.d @@ -18,7 +18,6 @@ import poodinis.autowire; import poodinis.context; import poodinis.factory; import poodinis.valueinjection; -import poodinis.polyfill; import std.string; import std.algorithm; diff --git a/source/poodinis/context.d b/source/poodinis/context.d index 5ccfb0c..6ab848c 100644 --- a/source/poodinis/context.d +++ b/source/poodinis/context.d @@ -16,7 +16,6 @@ module poodinis.context; import poodinis.container; import poodinis.registration; import poodinis.factory; -import poodinis.polyfill; import poodinis.autowire; import std.traits; diff --git a/source/poodinis/factory.d b/source/poodinis/factory.d index 9d2f9a3..a3dd8c0 100644 --- a/source/poodinis/factory.d +++ b/source/poodinis/factory.d @@ -18,7 +18,6 @@ import std.exception; import std.traits; import std.string; import std.stdio; -import poodinis.polyfill; alias CreatesSingleton = Flag!"CreatesSingleton"; alias InstanceFactoryMethod = Object delegate(); diff --git a/source/poodinis/polyfill.d b/source/poodinis/polyfill.d index b174c07..0bc454e 100644 --- a/source/poodinis/polyfill.d +++ b/source/poodinis/polyfill.d @@ -4,29 +4,20 @@ * * Should not implement functionalitiy which is gone from the latest Phobos. * - * Implementations copied/re-implemented from std.traits, std.meta (std.typetuple) - * and std.exception + * Implementations copied/re-implemented from 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), * 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) - * 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) */ module poodinis.polyfill; import std.exception; -import std.traits; static if (!__traits(compiles, 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"); - } -}