| @@ -35,7 +35,7 public interface TaskEnvSpecMixin { | |||||
| 35 | * The configuration action is called immediately. To support lazy evaluation, |
|
35 | * The configuration action is called immediately. To support lazy evaluation, | |
| 36 | * properties may be assigned to providers. |
|
36 | * properties may be assigned to providers. | |
| 37 | */ |
|
37 | */ | |
| 38 |
default void env(Action<Map<String, |
|
38 | default void env(Action<Map<String, Object>> configure) { | |
| 39 | Properties.configureMap(getEnvironment(), configure, Object::toString); |
|
39 | Properties.configureMap(getEnvironment(), configure, Object::toString); | |
| 40 | } |
|
40 | } | |
| 41 |
|
41 | |||
| @@ -24,7 +24,7 public final class Closures { | |||||
| 24 |
|
24 | |||
| 25 | public static void apply(Closure<?> action, Object target) { |
|
25 | public static void apply(Closure<?> action, Object target) { | |
| 26 | var c = (Closure<?>)action.clone(); |
|
26 | var c = (Closure<?>)action.clone(); | |
| 27 |
c.setResolveStrategy( |
|
27 | c.setResolveStrategy(Closure.DELEGATE_FIRST); | |
| 28 | c.setDelegate(target); |
|
28 | c.setDelegate(target); | |
| 29 | c.call(target); |
|
29 | c.call(target); | |
| 30 |
|
30 | |||
| @@ -49,13 +49,13 public final class Properties { | |||||
| 49 | }); |
|
49 | }); | |
| 50 | } |
|
50 | } | |
| 51 |
|
51 | |||
| 52 |
public static <K> void configureMap(MapProperty<K, Object> prop, Action<Map<K, |
|
52 | public static <K> void configureMap(MapProperty<K, Object> prop, Action<Map<K, Object>> configure) { | |
| 53 | var map = new HashMap<K, Object>(); |
|
53 | var map = new HashMap<K, Object>(); | |
| 54 | configure.execute(map); |
|
54 | configure.execute(map); | |
| 55 | mergeMap(prop, map); |
|
55 | mergeMap(prop, map); | |
| 56 | } |
|
56 | } | |
| 57 |
|
57 | |||
| 58 |
public static <K, V> void configureMap(MapProperty<K, V> prop, Action<Map<K, |
|
58 | public static <K, V> void configureMap(MapProperty<K, V> prop, Action<Map<K, Object>> configure, Function<Object, V> mapper) { | |
| 59 | var map = new HashMap<K, Object>(); |
|
59 | var map = new HashMap<K, Object>(); | |
| 60 | configure.execute(map); |
|
60 | configure.execute(map); | |
| 61 | mergeMap(prop, map, mapper); |
|
61 | mergeMap(prop, map, mapper); | |
General Comments 0
You need to be logged in to leave comments.
Login now
