Skip to content

Commit e887898

Browse files
authored
Merge pull request #297 from pascalberger/feature/gh-273
(GH-273) Change type of AzureDevOpsArtifactResource.Type to AzurePipelinesArtifactType
2 parents abde065 + 1083899 commit e887898

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/Cake.AzureDevOps/Cake.AzureDevOps.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
</PropertyGroup>
3838

3939
<ItemGroup>
40+
<PackageReference Include="Cake.Common" Version="1.0.0" />
4041
<PackageReference Include="Cake.Core" Version="1.0.0" PrivateAssets="All" />
4142
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">
4243
<PrivateAssets>all</PrivateAssets>

src/Cake.AzureDevOps/Pipelines/ArtifactResourceExtensions.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
namespace Cake.AzureDevOps.Pipelines
22
{
3+
using System;
4+
using Cake.Common.Build.AzurePipelines.Data;
35
using Microsoft.TeamFoundation.Build.WebApi;
46

57
/// <summary>
@@ -16,12 +18,17 @@ public static AzureDevOpsArtifactResource ToAzureDevOpsArtifactResource(this Art
1618
{
1719
artifactResource.NotNull(nameof(artifactResource));
1820

21+
if (!Enum.TryParse(artifactResource.Type, out AzurePipelinesArtifactType type))
22+
{
23+
throw new Exception($"Unexpected value for artifact type '{artifactResource.Type}'");
24+
}
25+
1926
return
2027
new AzureDevOpsArtifactResource
2128
{
2229
Data = artifactResource.Data,
2330
DownloadUrl = artifactResource.DownloadUrl,
24-
Type = artifactResource.Type,
31+
Type = type,
2532
Url = artifactResource.Url,
2633
Properties = artifactResource.Properties,
2734
};

src/Cake.AzureDevOps/Pipelines/AzureDevOpsArtifactResource.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace Cake.AzureDevOps.Pipelines
22
{
33
using System.Collections.Generic;
4+
using Cake.Common.Build.AzurePipelines.Data;
45

56
/// <summary>
67
/// Represents a resource associated with a <see cref="AzureDevOpsBuildArtifact" />.
@@ -20,7 +21,7 @@ public class AzureDevOpsArtifactResource
2021
/// <summary>
2122
/// Gets the type of the resource.
2223
/// </summary>
23-
public string Type { get; internal set; }
24+
public AzurePipelinesArtifactType Type { get; internal set; }
2425

2526
/// <summary>
2627
/// Gets the full http link to the resource.

0 commit comments

Comments
 (0)