Skip to content

Commit f775535

Browse files
committed
generate-scripts command restores dependencies if required.
1 parent ef19196 commit f775535

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/PostSharp.Engineering.BuildTools/ContinuousIntegration/GenerateScriptsCommand.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
using JetBrains.Annotations;
44
using PostSharp.Engineering.BuildTools.Build;
55
using PostSharp.Engineering.BuildTools.ContinuousIntegration.TeamCity.Generation;
6+
using PostSharp.Engineering.BuildTools.Dependencies;
67
using PostSharp.Engineering.BuildTools.Dependencies.Model;
78
using PostSharp.Engineering.BuildTools.Docker;
89
using PostSharp.Engineering.BuildTools.Utilities;
10+
using System.IO;
911

1012
namespace PostSharp.Engineering.BuildTools.ContinuousIntegration;
1113

@@ -57,6 +59,15 @@ public static bool Execute( BuildContext context, CommonCommandSettings settings
5759
return false;
5860
}
5961

62+
if ( !File.Exists( dependenciesOverrideFile.FilePath ) )
63+
{
64+
// The dependencies must be initialized for the first time.
65+
if ( new ResetDependenciesCommand().Execute( context.CommandContext, new ResetDependenciesCommandSettings { All = true } ) != 0 )
66+
{
67+
return false;
68+
}
69+
}
70+
6071
if ( !dependenciesOverrideFile.TryWrite( context ) )
6172
{
6273
return false;

src/PostSharp.Engineering.BuildTools/Dependencies/ResetDependenciesCommandSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public class ResetDependenciesCommandSettings : ConfigureDependenciesCommandSett
1414
{
1515
[Description( "The list of dependencies (given by name by or position in the dependency list) to configure" )]
1616
[CommandArgument( 1, "[dependencies]" )]
17-
public string[] Dependencies { get; protected set; } = [];
17+
public string[] Dependencies { get; init; } = [];
1818

1919
[Description( "Specifies that all dependencies must be configured" )]
2020
[CommandOption( "--all" )]
21-
public bool All { get; protected set; }
21+
public bool All { get; init; }
2222

2323
public override string[] GetDependencies() => this.Dependencies;
2424

0 commit comments

Comments
 (0)