Skip to content

Commit 33808da

Browse files
committed
Docker: fixed VSSDK component. Postpublish:
1 parent 26bcceb commit 33808da

File tree

4 files changed

+21
-29
lines changed

4 files changed

+21
-29
lines changed

src/PostSharp.Engineering.BuildTools/Build/Bumping/BumpCommand.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ private static bool Execute( BuildContext context, BumpSettings settings )
3333

3434
var developmentBranch = product.DependencyDefinition.Branch;
3535

36-
if ( context.Branch != developmentBranch )
36+
if ( context.Branch != developmentBranch && !settings.Force )
3737
{
38-
console.WriteError(
39-
$"The version bump can only be executed on the development branch ('{developmentBranch}'). The current branch is '{context.Branch}'." );
38+
console.WriteError( $"The version bump can only be executed on the development branch ('{developmentBranch}'), unless --force is used." );
4039

4140
return false;
4241
}
@@ -108,7 +107,7 @@ private static bool Execute( BuildContext context, BumpSettings settings )
108107

109108
return true;
110109
}
111-
110+
112111
// Doing a dry run of AutoUpdatedVersionsFile both gets the versions of all dependencies and gets the current version.
113112
// Do not write the AutoUpdatedVersions.props file yet - we will do it after we set our own version.
114113
if ( !AutoUpdatedVersionsFile.TryWrite( context, true, out var hasChangesInDependencies, out _, out _, out var currentVersion ) )

src/PostSharp.Engineering.BuildTools/Build/Helpers/GitIntegrationHelper.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,12 @@ internal static class GitIntegrationHelper
1818
{
1919
public static bool TryAddTagToLastCommit( BuildContext context, PublishSettings settings )
2020
{
21-
if ( !MainVersionFile.TryRead( context, out var mainVersionFileInfo ) )
21+
if ( !AutoUpdatedVersionsFile.TryRead( context, out var releasedVersion, out _ ) )
2222
{
2323
return false;
2424
}
2525

26-
if ( !ArtifactManifestFile.TryRead(
27-
context,
28-
settings.BuildConfiguration,
29-
out var preparedVersionInfo ) )
30-
{
31-
return false;
32-
}
33-
34-
var versionTag = $"release/{preparedVersionInfo.PackageVersion}";
26+
var versionTag = $"release/{releasedVersion}";
3527

3628
ToolInvocationHelper.InvokeTool(
3729
context.Console,

src/PostSharp.Engineering.BuildTools/Build/Publishing/PostPublishCommand.cs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,30 @@ internal class PostPublishCommand : BaseCommand<PublishSettings>
1515
{
1616
protected override bool ExecuteCore( BuildContext context, PublishSettings settings ) => Execute( context, settings );
1717

18-
public static bool Execute( BuildContext context, PublishSettings settings )
18+
private static bool Execute( BuildContext context, PublishSettings settings )
1919
{
2020
context.Console.WriteHeading( "Finishing publishing." );
2121

22-
if ( !GitHelper.TryConfigureCredentials( context ) )
23-
{
24-
return false;
25-
}
22+
var product = context.Product;
23+
var releaseBranch = product.DependencyDefinition.ReleaseBranch;
2624

27-
if ( !MasterGenerator.TryWriteFiles( context, settings ) )
25+
if ( releaseBranch == null )
2826
{
27+
context.Console.WriteError( $"The release branch is not set for '{product.ProductName}' product." );
28+
2929
return false;
3030
}
3131

32-
var product = context.Product;
33-
var sourceBranch = product.DependencyDefinition.ReleaseBranch;
34-
35-
if ( sourceBranch == null )
32+
if ( context.Branch != releaseBranch )
3633
{
37-
context.Console.WriteError( $"Post-publishing failed. The release branch is not set for '{product.ProductName}' product." );
34+
context.Console.WriteError(
35+
$"Post-publishing can only be executed on the release branch ('{releaseBranch}'). The current branch is '{context.Branch}'." );
3836

3937
return false;
4038
}
4139

42-
if ( context.Branch != sourceBranch )
40+
if ( !GitHelper.TryConfigureCredentials( context ) )
4341
{
44-
context.Console.WriteError(
45-
$"Post-publishing can only be executed on the release branch ('{sourceBranch}'). The current branch is '{context.Branch}'." );
46-
4742
return false;
4843
}
4944

src/PostSharp.Engineering.BuildTools/Docker/VisualStudioBuildToolsComponent.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ public override void WriteDockerfile( TextWriter writer )
4949
Remove-Item C:\\vs_buildtools.exe;
5050
""" );
5151

52+
// Define VSSDKINSTALLDIR
53+
if ( this._vsComponents.Contains( "Microsoft.VisualStudio.Component.VSSDKBuildTools" ) )
54+
{
55+
writer.WriteLine( "ENV VSSDKINSTALL=C:\\BuildTools\\VSSDK" );
56+
}
57+
5258
// We must always create "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages" or MSBuild might complain.
5359
writer.WriteLine(
5460
"""

0 commit comments

Comments
 (0)