2016-02-20 01:00:41 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
|
|
|
{
|
|
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
|
|
|
public class BuildPlatformsAttribute : TargetConditionAttribute
|
|
|
|
{
|
|
|
|
private IEnumerable<BuildPlatform> _buildPlatforms;
|
|
|
|
|
|
|
|
public BuildPlatformsAttribute(params BuildPlatform[] platforms)
|
|
|
|
{
|
|
|
|
if (platforms == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException("platforms");
|
|
|
|
}
|
|
|
|
|
|
|
|
_buildPlatforms = platforms;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool EvaluateCondition()
|
|
|
|
{
|
|
|
|
foreach (var platform in _buildPlatforms)
|
|
|
|
{
|
2016-03-07 20:20:50 +00:00
|
|
|
if (CurrentPlatform.IsPlatform(platform))
|
2016-02-20 01:00:41 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|