Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/0.6.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Nov 1, 2018
2 parents d01edb0 + be45e2f commit 985602c
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 26 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TFS / VSTS support for Cake Issues Addin
# TFS / Azure DevOps support for Cake Issues Addin

This addin for the Cake Build Automation System allows you to write issues found using any code
analyzer or linter to Team Foundation Server or Visual Studio Team Services pull requests using
analyzer or linter to Team Foundation Server or Azure DevOps pull requests using
the [Cake Issues addin](https://github.com/cake-contrib/Cake.Issues).

For more information about this add-in see the [Cake.Issues website](https://cake-contrib.github.io/Cake.Issues.Website)
Expand Down Expand Up @@ -38,4 +38,4 @@ Come join in the conversation about this addin in our Gitter Chat Room

## Contributing

Contributions are welcome. See [Contribution Guidelines](CONTRIBUTING.md).
Contributions are welcome. See [Contribution Guidelines](CONTRIBUTING.md).
14 changes: 7 additions & 7 deletions nuspec/nuget/Cake.Issues.PullRequests.Tfs.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
<version>0.0.0</version>
<authors>BBT Software AG and contributors</authors>
<owners>bbtsoftware, pascalberger, cake-contrib</owners>
<summary>TFS and VSTS support for the Cake.Issues addin for Cake Build Automation System</summary>
<summary>TFS and Azure DevOps support for the Cake.Issues addin for Cake Build Automation System</summary>
<description>
The Team Foundation Server / Visual Studio Team Services support for the Cake.Issues addin for Cake allows you to
write found issues as comments Team Foundation Server or Visual Studio Team Services pull requests.
The Team Foundation Server / Azure DevOps support for the Cake.Issues addin for Cake allows you to
write found issues as comments Team Foundation Server or Azure DevOps pull requests.

This addin provides the aliases for writing to Team Foundation Server or Visual Studio Team Services pull requests.
This addin provides the aliases for writing to Team Foundation Server or Azure DevOps pull requests.
It also requires the core Cake.Issues and Cake.Issues.PullRequests addins and one or more issue providers.

See the Project Site for an overview of the whole ecosystem of addins for working with issues in Cake scripts.
</description>
<licenseUrl>https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs/blob/develop/LICENSE</licenseUrl>
<projectUrl>http://cake-contrib.github.io/Cake.Issues.Website</projectUrl>
<iconUrl>https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png</iconUrl>
<iconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics@a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<repository type="git" url="https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs"/>
<copyright>Copyright © BBT Software AG and contributors</copyright>
<tags>Cake Script Cake-Issues Cake-PullRequestSystem Issues PullRequest TFS VSTS</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs/releases/tag/0.6.2</releaseNotes>
<tags>Cake Script Cake-Issues Cake-PullRequestSystem Issues PullRequest TFS Azure-DevOps</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs/releases/tag/0.6.3</releaseNotes>
</metadata>
<files>
<file src="Cake.Issues.PullRequests.Tfs.dll" target="lib\net461" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ public void Should_Throw_If_RepositoryUrl_For_PullRequestId_Is_Null()
// Then
result.IsArgumentNullException("repositoryUrl");
}

[Fact]
public void Should_Throw_If_Credentials_For_PullRequestId_Are_Null()
{
// Given / When
var result = Record.Exception(() => new TfsPullRequestSystemSettings(new Uri("http://example.com"), 42, null));

// Then
result.IsArgumentNullException("credentials");
}

[Fact]
public void Should_Throw_If_Credentials_For_SourceBranch_Are_Null()
{
// Given / When
var result = Record.Exception(() => new TfsPullRequestSystemSettings(new Uri("http://example.com"), "feature/foo", null));

// Then
result.IsArgumentNullException("credentials");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<PackageReference Include="Cake.Issues" Version="0.6.0" />
<PackageReference Include="Cake.Issues.PullRequests" Version="0.6.0" />
<PackageReference Include="Cake.Tfs">
<Version>0.2.1</Version>
<Version>0.2.2</Version>
</PackageReference>
<PackageReference Include="Costura.Fody">
<Version>3.1.0</Version>
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Issues.PullRequests.Tfs/ITfsPullRequestSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.TeamFoundation.SourceControl.WebApi;

/// <summary>
/// Interface for writing issues to Team Foundation Server or Visual Studio Team Services pull requests.
/// Interface for writing issues to Team Foundation Server or Azure DevOps pull requests.
/// </summary>
internal interface ITfsPullRequestSystem : IPullRequestSystem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Cake.Issues.PullRequests.Tfs")]
[assembly: AssemblyDescription("TFS and VSTS support for the Cake.Issues addin for Cake Build Automation System")]
[assembly: AssemblyDescription("TFS and Azure DevOps support for the Cake.Issues addin for Cake Build Automation System")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("BBT Software AG")]
[assembly: AssemblyProduct("Cake.Issues")]
Expand Down
4 changes: 2 additions & 2 deletions src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using Microsoft.VisualStudio.Services.WebApi;

/// <summary>
/// Class for writing issues to Team Foundation Server or Visual Studio Team Services pull requests.
/// Class for writing issues to Team Foundation Server or Azure DevOps pull requests.
/// </summary>
internal sealed class TfsPullRequestSystem : BasePullRequestSystem, ITfsPullRequestSystem
{
Expand Down Expand Up @@ -277,7 +277,7 @@ private bool AddThreadProperties(
}
}

// A VSTS UI extension will recognize this and format the comments differently.
// An Azure DevOps UI extension will recognize this and format the comments differently.
properties.Add("CodeAnalysisThreadType", "CodeAnalysisIssue");

thread.Properties = properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public static partial class TfsPullRequestSystemAliases
{
/// <summary>
/// Gets an object for writing issues to Team Foundation Server or Visual Studio Team Services pull request
/// Gets an object for writing issues to Team Foundation Server or Azure DevOps pull request
/// in a specific repository and for a specific source branch.
/// </summary>
/// <param name="context">The context.</param>
Expand All @@ -21,8 +21,8 @@ public static partial class TfsPullRequestSystemAliases
/// URLs using SSH scheme are converted to HTTPS.</param>
/// <param name="sourceBranch">Branch for which the pull request is made.</param>
/// <param name="credentials">Credentials to use to authenticate against Team Foundation Server or
/// Visual Studio Team Services.</param>
/// <returns>Object for writing issues to Team Foundation Server or Visual Studio Team Services pull request.</returns>
/// Azure DevOps.</param>
/// <returns>Object for writing issues to Team Foundation Server or Azure DevOps pull request.</returns>
/// <example>
/// <para>Report code analysis issues reported as MsBuild warnings to a TFS pull request:</para>
/// <code>
Expand Down Expand Up @@ -56,7 +56,7 @@ public static IPullRequestSystem TfsPullRequests(
}

/// <summary>
/// Gets an object for writing issues to Team Foundation Server or Visual Studio Team Services pull request
/// Gets an object for writing issues to Team Foundation Server or Azure DevOps pull request
/// in a specific repository and with a specific ID.
/// </summary>
/// <param name="context">The context.</param>
Expand All @@ -66,8 +66,8 @@ public static IPullRequestSystem TfsPullRequests(
/// URLs using SSH scheme are converted to HTTPS.</param>
/// <param name="pullRequestId">ID of the pull request.</param>
/// <param name="credentials">Credentials to use to authenticate against Team Foundation Server or
/// Visual Studio Team Services.</param>
/// <returns>Object for writing issues to Team Foundation Server or Visual Studio Team Services pull request.</returns>
/// Azure DevOps.</param>
/// <returns>Object for writing issues to Team Foundation Server or Azure DevOps pull request.</returns>
/// <example>
/// <para>Report code analysis issues reported as MsBuild warnings to a TFS pull request:</para>
/// <code>
Expand Down Expand Up @@ -99,13 +99,76 @@ public static IPullRequestSystem TfsPullRequests(
return context.TfsPullRequests(new TfsPullRequestSystemSettings(repositoryUrl, pullRequestId, credentials));
}

/// <summary>
/// Gets an object for writing issues to Team Foundation Server or Azure DevOps pull request
/// where all required data is taken from the environment variables set by the Azure Pipelines / TFS build.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="credentials">Credentials to use to authenticate against Team Foundation Server or
/// Azure DevOps.</param>
/// <returns>Object for writing issues to Team Foundation Server or Azure DevOps pull request.</returns>
/// <example>
/// <para>Report code analysis issues reported as MsBuild warnings to a TFS pull request:</para>
/// <code>
/// <![CDATA[
/// ReportIssuesToPullRequest(
/// MsBuildCodeAnalysis(
/// @"c:\build\msbuild.log",
/// MsBuildXmlFileLoggerFormat),
/// TfsPullRequests(
/// TfsAuthenticationNtlm()),
/// @"c:\repo");
/// ]]>
/// </code>
/// </example>
[CakeMethodAlias]
[CakeAliasCategory(PullRequestsAliasConstants.PullRequestSystemCakeAliasCategory)]
public static IPullRequestSystem TfsPullRequests(
this ICakeContext context,
ITfsCredentials credentials)
{
context.NotNull(nameof(context));
credentials.NotNull(nameof(credentials));

return context.TfsPullRequests(new TfsPullRequestSystemSettings(credentials));
}

/// <summary>
/// Gets an object for writing issues to Team Foundation Server or Azure DevOps pull request
/// where all required data (including authentication token) is taken from the environment variables set by the Azure Pipelines / TFS build.
/// </summary>
/// <param name="context">The context.</param>
/// <returns>Object for writing issues to Team Foundation Server or Azure DevOps pull request.</returns>
/// <example>
/// <para>Report code analysis issues reported as MsBuild warnings to a TFS pull request:</para>
/// <code>
/// <![CDATA[
/// ReportIssuesToPullRequest(
/// MsBuildCodeAnalysis(
/// @"c:\build\msbuild.log",
/// MsBuildXmlFileLoggerFormat),
/// TfsPullRequests(),
/// @"c:\repo");
/// ]]>
/// </code>
/// </example>
[CakeMethodAlias]
[CakeAliasCategory(PullRequestsAliasConstants.PullRequestSystemCakeAliasCategory)]
public static IPullRequestSystem TfsPullRequests(
this ICakeContext context)
{
context.NotNull(nameof(context));

return context.TfsPullRequests(new TfsPullRequestSystemSettings());
}

/// <summary>
/// Gets an object for writing issues to Team Foundation Server or Visual Studio Team Services pull request
/// using the specified settings.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="settings">Settings for accessing the pull request system.</param>
/// <returns>Object for writing issues to Team Foundation Server or Visual Studio Team Services pull request.</returns>
/// <returns>Object for writing issues to Team Foundation Server or Azure DevOps pull request.</returns>
/// <example>
/// <para>Report code analysis issues reported as MsBuild warnings to a TFS pull request:</para>
/// <code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/// <summary>
/// Contains functionality related to writing code analysis issues to Team Foundation Server or
/// Visual Studio Team Services pull requests.
/// Azure DevOps pull requests.
/// </summary>
[CakeAliasCategory(IssuesAliasConstants.MainCakeAliasCategory)]
public static partial class TfsPullRequestSystemAliases
Expand Down
25 changes: 23 additions & 2 deletions src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class TfsPullRequestSystemSettings : TfsPullRequestSettings
/// URLs using SSH scheme are converted to HTTPS.</param>
/// <param name="sourceBranch">Branch for which the pull request is made.</param>
/// <param name="credentials">Credentials to use to authenticate against Team Foundation Server or
/// Visual Studio Team Services.</param>
/// Azure DevOps.</param>
public TfsPullRequestSystemSettings(Uri repositoryUrl, string sourceBranch, ITfsCredentials credentials)
: base(repositoryUrl, sourceBranch, credentials)
{
Expand All @@ -33,7 +33,7 @@ public TfsPullRequestSystemSettings(Uri repositoryUrl, string sourceBranch, ITfs
/// URLs using SSH scheme are converted to HTTPS.</param>
/// <param name="pullRequestId">ID of the pull request.</param>
/// <param name="credentials">Credentials to use to authenticate against Team Foundation Server or
/// Visual Studio Team Services.</param>
/// Azure DevOps.</param>
public TfsPullRequestSystemSettings(Uri repositoryUrl, int pullRequestId, ITfsCredentials credentials)
: base(repositoryUrl, pullRequestId, credentials)
{
Expand All @@ -49,6 +49,27 @@ public TfsPullRequestSystemSettings(TfsPullRequestSettings settings)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="TfsPullRequestSystemSettings"/> class
/// based on the environment variables set by the Azure Pipelines / TFS build.
/// </summary>
/// <param name="credentials">Credentials to use to authenticate against Team Foundation Server or
/// Azure DevOps.</param>
public TfsPullRequestSystemSettings(ITfsCredentials credentials)
: base(credentials)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="TfsPullRequestSystemSettings"/> class
/// based on the environment variables set by the Azure Pipelines / TFS build
/// using the build authentication token.
/// </summary>
public TfsPullRequestSystemSettings()
: base(UsingTfsBuildOAuthToken())
{
}

/// <summary>
/// Gets or sets a value indicating whether pull request system should check if commit Id
/// is still up to date before posting comments.
Expand Down
2 changes: 1 addition & 1 deletion tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.29.0" />
<package id="Cake" version="0.30.0" />
</packages>

0 comments on commit 985602c

Please sign in to comment.