Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Commit

Permalink
Add CleanCheckoutDirectory option for TeamCityAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Oct 16, 2019
1 parent d9181e5 commit 7567604
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
7 changes: 0 additions & 7 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ object Compile : BuildType({
name = "⚙️ Compile"
vcs {
root(VcsRoot)
cleanCheckout = true
}
steps {
powerShell {
Expand All @@ -83,7 +82,6 @@ object Pack : BuildType({
name = "📦 Pack"
vcs {
root(VcsRoot)
cleanCheckout = true
}
artifactRules = """
output/*.nupkg
Expand Down Expand Up @@ -124,7 +122,6 @@ object Test_P1T2 : BuildType({
name = "🚦 Test 🧩 1/2"
vcs {
root(VcsRoot)
cleanCheckout = true
}
steps {
powerShell {
Expand All @@ -144,7 +141,6 @@ object Test_P2T2 : BuildType({
name = "🚦 Test 🧩 2/2"
vcs {
root(VcsRoot)
cleanCheckout = true
}
steps {
powerShell {
Expand All @@ -165,7 +161,6 @@ object Test : BuildType({
type = Type.COMPOSITE
vcs {
root(VcsRoot)
cleanCheckout = true
showDependenciesChanges = true
}
triggers {
Expand Down Expand Up @@ -201,7 +196,6 @@ object Publish : BuildType({
name = "🚚 Publish"
vcs {
root(VcsRoot)
cleanCheckout = true
}
steps {
powerShell {
Expand Down Expand Up @@ -253,7 +247,6 @@ object Announce : BuildType({
name = "🗣 Announce"
vcs {
root(VcsRoot)
cleanCheckout = true
}
steps {
powerShell {
Expand Down
2 changes: 2 additions & 0 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
[TeamCity(
TeamCityAgentPlatform.Windows,
DefaultBranch = DevelopBranch,
// TODO: https://github.com/dotnet/cli/issues/11424
CleanCheckoutDirectory = false,
VcsTriggeredTargets = new[] { nameof(Pack), nameof(Test) },
NightlyTriggeredTargets = new[] { nameof(Pack), nameof(Test) },
ManuallyTriggeredTargets = new[] { nameof(Publish) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ public class TeamCityBuildTypeVcsRoot : TeamCityConfigurationEntity
{
public TeamCityVcsRoot Root { get; set; }
public bool ShowDependenciesChanges { get; set; }
public bool CleanCheckoutDirectory { get; set; }

public override void Write(CustomFileWriter writer)
{
using (writer.WriteBlock("vcs"))
{
writer.WriteLine($"root({Root.Id})");
writer.WriteLine("cleanCheckout = true");
if (CleanCheckoutDirectory)
writer.WriteLine("cleanCheckout = true");
if (ShowDependenciesChanges)
writer.WriteLine("showDependenciesChanges = true");
}
Expand Down
3 changes: 2 additions & 1 deletion source/Nuke.Common/CI/TeamCity/TeamCityAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public TeamCityAttribute(TeamCityAgentPlatform platform)
public TeamCityAgentPlatform Platform { get; }
public string Description { get; set; }
public string DefaultBranch { get; set; } = "develop";
public bool CleanCheckoutDirectory { get; set; } = true;

public string VcsTriggerBranchFilter { get; set; } = "";
public string VcsTriggerRules { get; set; } = "+:**";
Expand Down Expand Up @@ -169,7 +170,7 @@ from artifactDependency in ArtifactExtensions.ArtifactDependencies[executableTar
Partition = partition,
PartitionTarget = executableTarget.Name,
InvokedTargets = invokedTargets,
VcsRoot = new TeamCityBuildTypeVcsRoot { Root = vcsRoot },
VcsRoot = new TeamCityBuildTypeVcsRoot { Root = vcsRoot, CleanCheckoutDirectory = CleanCheckoutDirectory },
Dependencies = snapshotDependencies.Concat(artifactDependencies).ToArray()
};
}
Expand Down

0 comments on commit 7567604

Please sign in to comment.