Skip to content

Commit eb66781

Browse files
committed
Fixed restore before test.
1 parent 2f85d32 commit eb66781

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/PostSharp.Engineering.BuildTools/Build/BuildCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public static bool Execute( BuildContext context, BuildSettings settings )
148148
{
149149
context.Console.WriteHeading( $"Building {solution.Name} ({settings.BuildConfiguration} configuration)" );
150150

151-
if ( !settings.NoDependencies )
151+
if ( !settings.NoRestore )
152152
{
153153
if ( !solution.Restore( context, settings ) )
154154
{

src/PostSharp.Engineering.BuildTools/Build/BuildSettings.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ protected override void AppendSettings( StringBuilder stringBuilder )
4343
{
4444
stringBuilder.Append( "--no-dependencies " );
4545
}
46+
47+
if ( this.NoRestore )
48+
{
49+
stringBuilder.Append( "--no-restore " );
50+
}
4651

4752
if ( this.IncludeTests )
4853
{
@@ -111,6 +116,10 @@ protected override void AppendSettings( StringBuilder stringBuilder )
111116
[Description( "Executes only the current command, but not the previous command" )]
112117
[CommandOption( "--no-dependencies" )]
113118
public bool NoDependencies { get; set; }
119+
120+
[Description( "Does not restore package before executing the command" )]
121+
[CommandOption( "--no-restore" )]
122+
public bool NoRestore { get; set; }
114123

115124
[Description( "Determines whether test-only assemblies should be included in the operation" )]
116125
[CommandOption( "--include-tests" )]

src/PostSharp.Engineering.BuildTools/Build/Testing/TestCommand.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ public static bool Execute( BuildContext context, BuildSettings settings )
7474
}
7575

7676
context.Console.WriteHeading( $"Testing {solution.Name}" );
77+
78+
if ( !settings.NoRestore )
79+
{
80+
if ( !solution.Restore( context, settings ) )
81+
{
82+
return false;
83+
}
84+
}
7785

7886
if ( !solution.Execute( context, solutionSettings, solution.TestMethod ?? BuildMethod.Test ) )
7987
{

0 commit comments

Comments
 (0)