Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Dec 21, 2022
1 parent 198c91c commit 3ec073d
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build/artifacts/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Artifacts;

public class BuildContext : BuildContextBase
{
public string MsBuildConfiguration { get; set; } = "Release";
public string MsBuildConfiguration { get; set; } = Constants.DefaultConfiguration;

public bool IsDockerOnLinux { get; set; }

Expand Down
1 change: 1 addition & 0 deletions build/artifacts/BuildLifetime.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Common.Lifetime;
using Common.Utilities;

namespace Artifacts;
Expand Down
2 changes: 1 addition & 1 deletion build/build/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Build;

public class BuildContext : BuildContextBase
{
public string MsBuildConfiguration { get; set; } = "Release";
public string MsBuildConfiguration { get; set; } = Constants.DefaultConfiguration;

public readonly Dictionary<PlatformFamily, string[]> NativeRuntimes = new()
{
Expand Down
3 changes: 2 additions & 1 deletion build/build/BuildLifetime.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Build.Utilities;
using Common.Lifetime;
using Common.Utilities;

namespace Build;
Expand All @@ -9,7 +10,7 @@ public override void Setup(BuildContext context, ISetupContext info)
{
base.Setup(context, info);

context.MsBuildConfiguration = context.Argument(Arguments.Configuration, "Release");
context.MsBuildConfiguration = context.Argument(Arguments.Configuration, Constants.DefaultConfiguration);
context.EnabledUnitTests = context.IsEnabled(EnvVars.EnabledUnitTests);

context.Credentials = Credentials.GetCredentials(context);
Expand Down
7 changes: 0 additions & 7 deletions build/build/Utilities/ContextExtensions.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using Cake.Incubator.LoggingExtensions;
using Common.Addins.GitVersion;
using Common.Utilities;

namespace Common.Utilities;
namespace Common.Lifetime;

public class BuildLifetimeBase<T> : FrostingLifetime<T> where T : BuildContextBase
{
Expand Down
3 changes: 3 additions & 0 deletions build/common/Utilities/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public class Constants
public const string NetVersion60 = $"net{Version60}";
public const string NetVersion70 = $"net{Version70}";

public const string DefaultBranch = "main";
public const string DefaultConfiguration = "Release";

public static readonly string[] VersionsToBuild = { Version60, Version70 };
public static readonly Architecture[] ArchToBuild = { Architecture.Amd64, Architecture.Arm64 };
public static readonly string[] DistrosToSkip = { Alpine313, Alpine314, Centos7, Ubuntu2204 };
Expand Down
5 changes: 4 additions & 1 deletion build/common/Utilities/ContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static bool IsOriginalRepo(this ICakeContext context)
public static bool IsMainBranch(this ICakeContext context)
{
var repositoryBranch = GetBranchName(context);
return !string.IsNullOrWhiteSpace(repositoryBranch) && StringComparer.OrdinalIgnoreCase.Equals("main", repositoryBranch);
return !string.IsNullOrWhiteSpace(repositoryBranch) && StringComparer.OrdinalIgnoreCase.Equals(Constants.DefaultBranch, repositoryBranch);
}

public static bool IsSupportBranch(this ICakeContext context)
Expand Down Expand Up @@ -163,4 +163,7 @@ public static string GetBranchName(this ICakeContext context)
private static void StartGroup(this IAzurePipelinesCommands _, ICakeContext context, string title) => context.Information("##[group]{0}", title);

private static void EndGroup(this IAzurePipelinesCommands _, ICakeContext context) => context.Information("##[endgroup]");

public static FilePath? GetGitVersionToolLocation(this ICakeContext context) =>
context.GetFiles($"src/GitVersion.App/bin/{Constants.DefaultConfiguration}/{Constants.NetVersion60}/gitversion.dll").SingleOrDefault();
}
1 change: 1 addition & 0 deletions build/docker/BuildLifetime.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Common.Lifetime;
using Common.Utilities;

namespace Docker;
Expand Down
1 change: 1 addition & 0 deletions build/docs/BuildLifetime.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Cake.Wyam;
using Common.Lifetime;
using Common.Utilities;
using Docs.Utilities;

Expand Down
1 change: 1 addition & 0 deletions build/publish/BuildLifetime.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Common.Lifetime;
using Common.Utilities;
using Publish.Utilities;

Expand Down
1 change: 1 addition & 0 deletions build/release/BuildLifetime.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Common.Lifetime;
using Common.Utilities;
using Release.Utilities;

Expand Down
2 changes: 1 addition & 1 deletion build/release/Tasks/PublishRelease.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override void Run(BuildContext context)
Milestone = milestone,
Name = milestone,
Prerelease = false,
TargetCommitish = "main"
TargetCommitish = Constants.DefaultBranch
});

context.GitReleaseManagerAddAssets(token, Constants.RepoOwner, Constants.Repository, milestone, assets);
Expand Down

0 comments on commit 3ec073d

Please sign in to comment.