Skip to content

Commit f9a2faf

Browse files
committed
Merge branch 'hotfix/0.10.2'
2 parents 39dbc4d + e42b66b commit f9a2faf

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [vNext]
88

9+
## [0.10.2] / 2018-10-04
10+
- Fixed `RequirementService` to also support shorthand for properties
11+
912
## [0.10.1] / 2018-10-02
1013
- Fixed wizard to pass definitions for project file template
1114
- Fixed wizard to create source and tests directory if selected
@@ -161,7 +164,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
161164
- Added CLT tasks for Git
162165
- Fixed background color in console output
163166

164-
[vNext]: https://github.com/nuke-build/nuke/compare/0.10.1...HEAD
167+
[vNext]: https://github.com/nuke-build/nuke/compare/0.10.2...HEAD
168+
[0.10.2]: https://github.com/nuke-build/nuke/compare/0.10.1...0.10.2
165169
[0.10.1]: https://github.com/nuke-build/nuke/compare/0.10.0...0.10.1
166170
[0.10.0]: https://github.com/nuke-build/nuke/compare/0.9.1...0.10.0
167171
[0.9.1]: https://github.com/nuke-build/nuke/compare/0.9.0...0.9.1

source/Nuke.Common/Execution/RequirementService.cs

+16-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using System.Collections.Generic;
7+
using System.Configuration;
78
using System.Linq;
89
using System.Linq.Expressions;
910
using System.Reflection;
@@ -26,10 +27,22 @@ public static void ValidateRequirements(IReadOnlyCollection<TargetDefinition> ex
2627
var memberExpression = requirement.Body is MemberExpression
2728
? (MemberExpression) requirement.Body
2829
: (MemberExpression) ((UnaryExpression) requirement.Body).Operand;
29-
var field = (FieldInfo) memberExpression.Member;
3030

31-
ControlFlow.Assert(field.GetValue(build) != null,
32-
$"Target '{target.Name}' requires that field '{field.Name}' must be not null.");
31+
switch (memberExpression.Member)
32+
{
33+
case FieldInfo field:
34+
ControlFlow.Assert(
35+
field.GetValue(build) != null,
36+
$"Target '{target.Name}' requires that field '{field.Name}' must be not null.");
37+
break;
38+
case PropertyInfo property:
39+
ControlFlow.Assert(
40+
property.GetValue(build) != null,
41+
$"Target '{target.Name}' requires that property '{property.Name}' must be not null.");
42+
break;
43+
default:
44+
throw new Exception($"Member type {memberExpression.Member} not supported.");
45+
}
3346
}
3447
}
3548
}

0 commit comments

Comments
 (0)