Skip to content

Commit

Permalink
Merge branch 'hotfix/0.10.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Oct 4, 2018
2 parents 39dbc4d + e42b66b commit f9a2faf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [vNext]

## [0.10.2] / 2018-10-04
- Fixed `RequirementService` to also support shorthand for properties

## [0.10.1] / 2018-10-02
- Fixed wizard to pass definitions for project file template
- Fixed wizard to create source and tests directory if selected
Expand Down Expand Up @@ -161,7 +164,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added CLT tasks for Git
- Fixed background color in console output

[vNext]: https://github.com/nuke-build/nuke/compare/0.10.1...HEAD
[vNext]: https://github.com/nuke-build/nuke/compare/0.10.2...HEAD
[0.10.2]: https://github.com/nuke-build/nuke/compare/0.10.1...0.10.2
[0.10.1]: https://github.com/nuke-build/nuke/compare/0.10.0...0.10.1
[0.10.0]: https://github.com/nuke-build/nuke/compare/0.9.1...0.10.0
[0.9.1]: https://github.com/nuke-build/nuke/compare/0.9.0...0.9.1
Expand Down
19 changes: 16 additions & 3 deletions source/Nuke.Common/Execution/RequirementService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
Expand All @@ -26,10 +27,22 @@ public static void ValidateRequirements(IReadOnlyCollection<TargetDefinition> ex
var memberExpression = requirement.Body is MemberExpression
? (MemberExpression) requirement.Body
: (MemberExpression) ((UnaryExpression) requirement.Body).Operand;
var field = (FieldInfo) memberExpression.Member;

ControlFlow.Assert(field.GetValue(build) != null,
$"Target '{target.Name}' requires that field '{field.Name}' must be not null.");
switch (memberExpression.Member)
{
case FieldInfo field:
ControlFlow.Assert(
field.GetValue(build) != null,
$"Target '{target.Name}' requires that field '{field.Name}' must be not null.");
break;
case PropertyInfo property:
ControlFlow.Assert(
property.GetValue(build) != null,
$"Target '{target.Name}' requires that property '{property.Name}' must be not null.");
break;
default:
throw new Exception($"Member type {memberExpression.Member} not supported.");
}
}
}
}
Expand Down

0 comments on commit f9a2faf

Please sign in to comment.