Skip to content

Commit d2c74af

Browse files
committed
Fixed BusinessSystems dependencies. Docker: added support for Node.js.
1 parent 2fa7363 commit d2c74af

File tree

4 files changed

+70
-1
lines changed

4 files changed

+70
-1
lines changed

src/PostSharp.Engineering.BuildTools/Dependencies/Definitions/BusinessSystemsDependencies.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ public BusinessSystemsDependencyDefinition( string dependencyName, bool isGitHub
2020
null,
2121
isGitHub ? new GitHubRepository( dependencyName, "postsharp" ) : new AzureDevOpsRepository( Family.Name, dependencyName ),
2222
TeamCityHelper.CreateConfiguration( TeamCityHelper.GetProjectId( dependencyName, "Websites And Business Systems" ) ),
23-
false ) { }
23+
false )
24+
{
25+
this.Dependencies = [DevelopmentDependencies.PostSharpEngineering];
26+
}
2427
}
2528

2629
public static ProductFamily Family { get; } = new( "Business%20Systems", "1.0", DevelopmentDependencies.Family );
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.
2+
3+
using System.IO;
4+
5+
namespace PostSharp.Engineering.BuildTools.Docker;
6+
7+
public class ChocolateyComponent : ContainerComponent
8+
{
9+
public override string Name => "Install Chocolatey";
10+
11+
public override ContainerComponentKind Kind => ContainerComponentKind.Chocolatey;
12+
13+
public override void WriteDockerfile( TextWriter writer )
14+
{
15+
writer.WriteLine(
16+
"""
17+
RUN powershell -c "irm https://community.chocolatey.org/install.ps1|iex" `
18+
$pathsToAdd = @('C:\ProgramData\chocolatey\bin'); `
19+
$newPath = [Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + ($pathsToAdd -join ';'); `
20+
[Environment]::SetEnvironmentVariable('PATH', $newPath, 'Machine'); `
21+
& C:\ProgramData\chocolatey\bin\choco.exe feature enable -n allowGlobalConfirmation
22+
""" );
23+
}
24+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ public enum ContainerComponentKind
1313
DotNet,
1414
DotNetDump,
1515
VsBuildTools,
16+
Chocolatey,
17+
NodeJs,
1618
Epilogue
1719
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using System.Linq;
7+
8+
namespace PostSharp.Engineering.BuildTools.Docker;
9+
10+
public class NodeJsComponent : ContainerComponent
11+
{
12+
private readonly string _version;
13+
14+
public NodeJsComponent( string version )
15+
{
16+
this._version = version;
17+
}
18+
19+
public override string Name => "Install Node.js";
20+
21+
public override ContainerComponentKind Kind => ContainerComponentKind.NodeJs;
22+
23+
public override void WriteDockerfile( TextWriter writer )
24+
{
25+
writer.WriteLine(
26+
$"""
27+
RUN choco install nodejs --version="{this._version}"
28+
""" );
29+
}
30+
31+
public override void AddRequirements( IReadOnlyList<ContainerComponent> components, Action<ContainerComponent> add )
32+
{
33+
base.AddRequirements( components, add );
34+
35+
if ( !components.OfType<ChocolateyComponent>().Any() )
36+
{
37+
add( new ChocolateyComponent() );
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)