diff --git a/src/Cake.Common/Build/AppVeyor/AppVeyorProvider.cs b/src/Cake.Common/Build/AppVeyor/AppVeyorProvider.cs
index a7a3c9974d..234cf03443 100644
--- a/src/Cake.Common/Build/AppVeyor/AppVeyorProvider.cs
+++ b/src/Cake.Common/Build/AppVeyor/AppVeyorProvider.cs
@@ -29,6 +29,32 @@ public sealed class AppVeyorProvider : IAppVeyorProvider
///
/// true if the current build is running on AppVeyor.; otherwise, false.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information("Running on AppVeyor");
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information("Running on AppVeyor");
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public bool IsRunningOnAppVeyor => !string.IsNullOrWhiteSpace(_environment.GetEnvironmentVariable("APPVEYOR"));
///
@@ -37,6 +63,60 @@ public sealed class AppVeyorProvider : IAppVeyorProvider
///
/// The AppVeyor environment.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Environment:
+ /// ApiUrl: {0}
+ /// Configuration: {1}
+ /// JobId: {2}
+ /// JobName: {3}
+ /// Platform: {4}
+ /// ScheduledBuild: {5}",
+ /// BuildSystem.AppVeyor.Environment.ApiUrl,
+ /// BuildSystem.AppVeyor.Environment.Configuration,
+ /// BuildSystem.AppVeyor.Environment.JobId,
+ /// BuildSystem.AppVeyor.Environment.JobName,
+ /// BuildSystem.AppVeyor.Environment.Platform,
+ /// BuildSystem.AppVeyor.Environment.ScheduledBuild
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Environment:
+ /// ApiUrl: {0}
+ /// Configuration: {1}
+ /// JobId: {2}
+ /// JobName: {3}
+ /// Platform: {4}
+ /// ScheduledBuild: {5}",
+ /// AppVeyor.Environment.ApiUrl,
+ /// AppVeyor.Environment.Configuration,
+ /// AppVeyor.Environment.JobId,
+ /// AppVeyor.Environment.JobName,
+ /// AppVeyor.Environment.Platform,
+ /// AppVeyor.Environment.ScheduledBuild
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public AppVeyorEnvironmentInfo Environment { get; }
///
@@ -114,8 +194,7 @@ public void UploadArtifact(FilePath path, AppVeyorUploadArtifactsSettings settin
arguments.AppendQuoted(settings.DeploymentName);
}
- // Start the process.
- _processRunner.Start("appveyor", new ProcessSettings { Arguments = arguments });
+ StartAppVeyor(arguments);
}
///
@@ -177,6 +256,32 @@ public void UploadTestResults(FilePath path, AppVeyorTestResultsType resultsType
/// Updates the build version.
///
/// The new build version.
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// BuildSystem.AppVeyor.UpdateBuildVersion("2.0.0.0");
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// AppVeyor.UpdateBuildVersion("2.0.0.0");
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public void UpdateBuildVersion(string version)
{
if (version == null)
@@ -199,8 +304,7 @@ public void UpdateBuildVersion(string version)
arguments.Append("-Version");
arguments.AppendQuoted(version);
- // Start the process.
- _processRunner.Start("appveyor", new ProcessSettings { Arguments = arguments });
+ StartAppVeyor(arguments);
}
///
@@ -209,6 +313,64 @@ public void UpdateBuildVersion(string version)
/// A short message to display
/// The category of the message
/// Additional message details
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// BuildSystem.AppVeyor.AddMessage(
+ /// "This is a error message.",
+ /// AppVeyorMessageCategoryType.Error,
+ /// "Error details."
+ /// );
+ ///
+ /// BuildSystem.AppVeyor.AddMessage(
+ /// "This is a information message.",
+ /// AppVeyorMessageCategoryType.Information,
+ /// "Information details."
+ /// );
+ ///
+ /// BuildSystem.AppVeyor.AddMessage(
+ /// "This is a warning message.",
+ /// AppVeyorMessageCategoryType.Warning,
+ /// "Warning details."
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// AppVeyor.AddMessage(
+ /// "This is a error message.",
+ /// AppVeyorMessageCategoryType.Error,
+ /// "Error details."
+ /// );
+ ///
+ /// AppVeyor.AddMessage(
+ /// "This is a information message.",
+ /// AppVeyorMessageCategoryType.Information,
+ /// "Information details."
+ /// );
+ ///
+ /// AppVeyor.AddMessage(
+ /// "This is a warning message.",
+ /// AppVeyorMessageCategoryType.Warning,
+ /// "Warning details."
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public void AddMessage(string message, AppVeyorMessageCategoryType category = AppVeyorMessageCategoryType.Information, string details = null)
{
if (message == null)
@@ -238,8 +400,18 @@ public void AddMessage(string message, AppVeyorMessageCategoryType category = Ap
arguments.AppendQuoted(details);
}
- // Start the process.
- _processRunner.Start("appveyor", new ProcessSettings { Arguments = arguments });
+ StartAppVeyor(arguments);
+ }
+
+ private void StartAppVeyor(ProcessArgumentBuilder arguments, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "")
+ {
+ var process = _processRunner.Start("appveyor", new ProcessSettings { Arguments = arguments });
+ process.WaitForExit();
+ var exitCode = process.GetExitCode();
+ if (exitCode != 0)
+ {
+ throw new CakeException($"{memberName} failed ({exitCode}).");
+ }
}
}
}
\ No newline at end of file
diff --git a/src/Cake.Common/Build/AppVeyor/Data/AppVeyorEnvironmentInfo.cs b/src/Cake.Common/Build/AppVeyor/Data/AppVeyorEnvironmentInfo.cs
index 74dabcc8dd..e9e59216bd 100644
--- a/src/Cake.Common/Build/AppVeyor/Data/AppVeyorEnvironmentInfo.cs
+++ b/src/Cake.Common/Build/AppVeyor/Data/AppVeyorEnvironmentInfo.cs
@@ -65,6 +65,49 @@ public sealed class AppVeyorEnvironmentInfo : AppVeyorInfo
///
/// The AppVeyor project information.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Project:
+ /// Id: {0}
+ /// Name: {1}
+ /// Slug: {2}",
+ /// BuildSystem.AppVeyor.Environment.Project.Id,
+ /// BuildSystem.AppVeyor.Environment.Project.Name,
+ /// BuildSystem.AppVeyor.Environment.Project.Slug
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// // via appveyor
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Project:
+ /// Id: {0}
+ /// Name: {1}
+ /// Slug: {2}",
+ /// AppVeyor.Environment.Project.Id,
+ /// AppVeyor.Environment.Project.Name,
+ /// AppVeyor.Environment.Project.Slug
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public AppVeyorProjectInfo Project { get; }
///
@@ -73,6 +116,52 @@ public sealed class AppVeyorEnvironmentInfo : AppVeyorInfo
///
/// The AppVeyor build information.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Build:
+ /// Folder: {0}
+ /// Id: {1}
+ /// Number: {2}
+ /// Version: {3}",
+ /// BuildSystem.AppVeyor.Environment.Build.Folder,
+ /// BuildSystem.AppVeyor.Environment.Build.Id,
+ /// BuildSystem.AppVeyor.Environment.Build.Number,
+ /// BuildSystem.AppVeyor.Environment.Build.Version
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Build:
+ /// Folder: {0}
+ /// Id: {1}
+ /// Number: {2}
+ /// Version: {3}",
+ /// AppVeyor.Environment.Build.Folder,
+ /// AppVeyor.Environment.Build.Id,
+ /// AppVeyor.Environment.Build.Number,
+ /// AppVeyor.Environment.Build.Version
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public AppVeyorBuildInfo Build { get; }
///
@@ -81,6 +170,48 @@ public sealed class AppVeyorEnvironmentInfo : AppVeyorInfo
///
/// The AppVeyor pull request information.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"PullRequest:
+ /// IsPullRequest: {0}
+ /// Number: {1}
+ /// Title: {2}",
+ /// BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest,
+ /// BuildSystem.AppVeyor.Environment.PullRequest.Number,
+ /// BuildSystem.AppVeyor.Environment.PullRequest.Title
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"PullRequest:
+ /// IsPullRequest: {0}
+ /// Number: {1}
+ /// Title: {2}",
+ /// AppVeyor.Environment.PullRequest.IsPullRequest,
+ /// AppVeyor.Environment.PullRequest.Number,
+ /// AppVeyor.Environment.PullRequest.Title
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public AppVeyorPullRequestInfo PullRequest { get; }
///
@@ -89,6 +220,52 @@ public sealed class AppVeyorEnvironmentInfo : AppVeyorInfo
///
/// The AppVeyor repository information.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Repository:
+ /// Branch: {0}
+ /// Name: {1}
+ /// Provider: {2}
+ /// Scm: {3}",
+ /// BuildSystem.AppVeyor.Environment.Repository.Branch,
+ /// BuildSystem.AppVeyor.Environment.Repository.Name,
+ /// BuildSystem.AppVeyor.Environment.Repository.Provider,
+ /// BuildSystem.AppVeyor.Environment.Repository.Scm
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Repository:
+ /// Branch: {0}
+ /// Name: {1}
+ /// Provider: {2}
+ /// Scm: {3}",
+ /// AppVeyor.Environment.Repository.Branch,
+ /// AppVeyor.Environment.Repository.Name,
+ /// AppVeyor.Environment.Repository.Provider,
+ /// AppVeyor.Environment.Repository.Scm
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public AppVeyorRepositoryInfo Repository { get; }
///
diff --git a/src/Cake.Common/Build/AppVeyor/Data/AppVeyorRepositoryInfo.cs b/src/Cake.Common/Build/AppVeyor/Data/AppVeyorRepositoryInfo.cs
index 220e489d32..f4fb9fe0af 100644
--- a/src/Cake.Common/Build/AppVeyor/Data/AppVeyorRepositoryInfo.cs
+++ b/src/Cake.Common/Build/AppVeyor/Data/AppVeyorRepositoryInfo.cs
@@ -23,6 +23,12 @@ public sealed class AppVeyorRepositoryInfo : AppVeyorInfo
/// -
/// kiln
///
+ /// -
+ /// vso
+ ///
+ /// -
+ /// gitlab
+ ///
///
///
///
@@ -68,6 +74,44 @@ public sealed class AppVeyorRepositoryInfo : AppVeyorInfo
///
/// The tag information for the build.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Repository:
+ /// IsTag: {0}
+ /// Name: {1}",
+ /// BuildSystem.AppVeyor.Environment.Repository.Tag.IsTag,
+ /// BuildSystem.AppVeyor.Environment.Repository.Tag.Name
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Repository:
+ /// IsTag: {0}
+ /// Name: {1}",
+ /// AppVeyor.Environment.Repository.Tag.IsTag,
+ /// AppVeyor.Environment.Repository.Tag.Name
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public AppVeyorTagInfo Tag { get; }
///
@@ -76,6 +120,60 @@ public sealed class AppVeyorRepositoryInfo : AppVeyorInfo
///
/// The commit information for the build.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Repository:
+ /// Author: {0}
+ /// Email: {1}
+ /// ExtendedMessage: {2}
+ /// Id: {3}
+ /// Message: {4}
+ /// Timestamp: {5}",
+ /// BuildSystem.AppVeyor.Environment.Repository.Commit.Author,
+ /// BuildSystem.AppVeyor.Environment.Repository.Commit.Email,
+ /// BuildSystem.AppVeyor.Environment.Repository.Commit.ExtendedMessage,
+ /// BuildSystem.AppVeyor.Environment.Repository.Commit.Id,
+ /// BuildSystem.AppVeyor.Environment.Repository.Commit.Message,
+ /// BuildSystem.AppVeyor.Environment.Repository.Commit.Timestamp
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Repository:
+ /// Author: {0}
+ /// Email: {1}
+ /// ExtendedMessage: {2}
+ /// Id: {3}
+ /// Message: {4}
+ /// Timestamp: {5}",
+ /// AppVeyor.Environment.Repository.Commit.Author,
+ /// AppVeyor.Environment.Repository.Commit.Email,
+ /// AppVeyor.Environment.Repository.Commit.ExtendedMessage,
+ /// AppVeyor.Environment.Repository.Commit.Id,
+ /// AppVeyor.Environment.Repository.Commit.Message,
+ /// AppVeyor.Environment.Repository.Commit.Timestamp
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
public AppVeyorCommitInfo Commit { get; }
///
diff --git a/src/Cake.Common/Build/AppVeyor/IAppVeyorProvider.cs b/src/Cake.Common/Build/AppVeyor/IAppVeyorProvider.cs
index 63f0e5d158..576c6a05ea 100644
--- a/src/Cake.Common/Build/AppVeyor/IAppVeyorProvider.cs
+++ b/src/Cake.Common/Build/AppVeyor/IAppVeyorProvider.cs
@@ -19,6 +19,32 @@ public interface IAppVeyorProvider
///
/// true if the current build is running on AppVeyor.; otherwise, false.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information("Running on AppVeyor");
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information("Running on AppVeyor");
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
bool IsRunningOnAppVeyor { get; }
///
@@ -27,6 +53,60 @@ public interface IAppVeyorProvider
///
/// The AppVeyor environment.
///
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Environment:
+ /// ApiUrl: {0}
+ /// Configuration: {1}
+ /// JobId: {2}
+ /// JobName: {3}
+ /// Platform: {4}
+ /// ScheduledBuild: {5}",
+ /// BuildSystem.AppVeyor.Environment.ApiUrl,
+ /// BuildSystem.AppVeyor.Environment.Configuration,
+ /// BuildSystem.AppVeyor.Environment.JobId,
+ /// BuildSystem.AppVeyor.Environment.JobName,
+ /// BuildSystem.AppVeyor.Environment.Platform,
+ /// BuildSystem.AppVeyor.Environment.ScheduledBuild
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// Information(
+ /// @"Environment:
+ /// ApiUrl: {0}
+ /// Configuration: {1}
+ /// JobId: {2}
+ /// JobName: {3}
+ /// Platform: {4}
+ /// ScheduledBuild: {5}",
+ /// AppVeyor.Environment.ApiUrl,
+ /// AppVeyor.Environment.Configuration,
+ /// AppVeyor.Environment.JobId,
+ /// AppVeyor.Environment.JobName,
+ /// AppVeyor.Environment.Platform,
+ /// AppVeyor.Environment.ScheduledBuild
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
AppVeyorEnvironmentInfo Environment { get; }
///
@@ -68,6 +148,64 @@ public interface IAppVeyorProvider
/// A short message to display
/// The category of the message
/// Additional message details
+ /// Via BuildSystem
+ ///
+ ///
+ /// if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// BuildSystem.AppVeyor.AddMessage(
+ /// "This is a error message.",
+ /// AppVeyorMessageCategoryType.Error,
+ /// "Error details."
+ /// );
+ ///
+ /// BuildSystem.AppVeyor.AddMessage(
+ /// "This is a information message.",
+ /// AppVeyorMessageCategoryType.Information,
+ /// "Information details."
+ /// );
+ ///
+ /// BuildSystem.AppVeyor.AddMessage(
+ /// "This is a warning message.",
+ /// AppVeyorMessageCategoryType.Warning,
+ /// "Warning details."
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
+ /// Via AppVeyor
+ ///
+ ///
+ /// if (AppVeyor.IsRunningOnAppVeyor)
+ /// {
+ /// AppVeyor.AddMessage(
+ /// "This is a error message.",
+ /// AppVeyorMessageCategoryType.Error,
+ /// "Error details."
+ /// );
+ ///
+ /// AppVeyor.AddMessage(
+ /// "This is a information message.",
+ /// AppVeyorMessageCategoryType.Information,
+ /// "Information details."
+ /// );
+ ///
+ /// AppVeyor.AddMessage(
+ /// "This is a warning message.",
+ /// AppVeyorMessageCategoryType.Warning,
+ /// "Warning details."
+ /// );
+ /// }
+ /// else
+ /// {
+ /// Information("Not running on AppVeyor");
+ /// }
+ ///
+ ///
void AddMessage(string message, AppVeyorMessageCategoryType category = AppVeyorMessageCategoryType.Information, string details = null);
}
}
\ No newline at end of file