Skip to content

Commit 2fa7363

Browse files
committed
Custom TC configs: add build parameter. Linked Metalama 2026.0 to PostSharp 2025.1.
1 parent 4937a34 commit 2fa7363

File tree

4 files changed

+31
-21
lines changed

4 files changed

+31
-21
lines changed

src/PostSharp.Engineering.BuildTools/ContinuousIntegration/Model/PowershellAdditionalCiBuildConfiguration.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ internal override TeamCityBuildConfiguration TeamCityBuildConfiguration( Product
3939
$"Execute {this.Script}",
4040
this.Script,
4141
this.Arguments,
42-
product.DockerSpec )
42+
product.DockerSpec,
43+
true )
4344
],
4445
IsSshAgentRequired = productProperties.IsRepoRemoteSsh,
4546
SourceDependencies = this.SourceDependenciesRequirements switch

src/PostSharp.Engineering.BuildTools/ContinuousIntegration/TeamCity/BuildSteps/EngineeringCommandBuildStep.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ namespace PostSharp.Engineering.BuildTools.ContinuousIntegration.TeamCity.BuildS
99

1010
internal class EngineeringCommandBuildStep : PowerShellBuildStep
1111
{
12-
private static string GetCustomArgumentsParameterName( string id ) => $"{id}.Arguments";
13-
1412
private static string GetTimeoutParameterName( string id ) => $"{id}.Timeout";
1513

1614
public EngineeringCommandBuildStep(
@@ -24,19 +22,10 @@ public EngineeringCommandBuildStep(
2422
id,
2523
name,
2624
"Build.ps1",
27-
GetScriptArguments( id, command, arguments, areCustomArgumentsAllowed, timeout ),
28-
dockerSpec )
25+
GetScriptArguments( id, command, arguments, timeout ),
26+
dockerSpec,
27+
areCustomArgumentsAllowed )
2928
{
30-
if ( areCustomArgumentsAllowed )
31-
{
32-
this.AddParameter(
33-
new TextBuildConfigurationParameter(
34-
GetCustomArgumentsParameterName( id ),
35-
$"{this.ScriptPath} Arguments",
36-
$"Arguments to append to the '{name}' build step.",
37-
allowEmpty: true ) );
38-
}
39-
4029
if ( timeout != null )
4130
{
4231
this.AddParameter(
@@ -50,10 +39,9 @@ private static string GetScriptArguments(
5039
string id,
5140
string command,
5241
string? arguments,
53-
bool areCustomArgumentsAllowed,
5442
TimeSpan? timeout )
5543
{
56-
var args = $"{command}{(arguments == null ? "" : $" {arguments}")}{(!areCustomArgumentsAllowed ? "" : $" %{GetCustomArgumentsParameterName( id )}%")}";
44+
var args = $"{command}{(arguments == null ? "" : $" {arguments}")}";
5745

5846
if ( timeout != null )
5947
{

src/PostSharp.Engineering.BuildTools/ContinuousIntegration/TeamCity/BuildSteps/PowerShellBuildStep.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.
22

3+
using PostSharp.Engineering.BuildTools.ContinuousIntegration.TeamCity.Arguments;
34
using PostSharp.Engineering.BuildTools.Docker;
45
using System.IO;
56

@@ -17,23 +18,43 @@ internal class PowerShellBuildStep : BuildStep
1718

1819
public string? WorkingDirectory { get; init; }
1920

20-
public PowerShellBuildStep( string id, string name, string scriptPath, string scriptArguments, DockerSpec? dockerSpec ) : base( dockerSpec )
21+
public PowerShellBuildStep(
22+
string id,
23+
string name,
24+
string scriptPath,
25+
string scriptArguments,
26+
DockerSpec? dockerSpec,
27+
bool areCustomArgumentsAllowed = false ) : base( dockerSpec )
2128
{
2229
this.Id = id;
2330
this.Name = name;
2431

32+
var buildParameterValue = areCustomArgumentsAllowed ? $"%{GetCustomArgumentsParameterName( id )}%" : "";
33+
2534
if ( dockerSpec == null )
2635
{
2736
this.ScriptPath = scriptPath;
28-
this.ScriptArguments = scriptArguments;
37+
this.ScriptArguments = $"{scriptArguments} {buildParameterValue}";
2938
}
3039
else
3140
{
3241
this.ScriptPath = "DockerBuild.ps1";
33-
this.ScriptArguments = $"-Script {scriptPath} -ImageName {dockerSpec.ImageName} -NoBuildImage {scriptArguments}";
42+
this.ScriptArguments = $"-Script {scriptPath} -ImageName {dockerSpec.ImageName} -NoBuildImage {scriptArguments} {buildParameterValue}";
43+
}
44+
45+
if ( areCustomArgumentsAllowed )
46+
{
47+
this.AddParameter(
48+
new TextBuildConfigurationParameter(
49+
GetCustomArgumentsParameterName( id ),
50+
$"{this.ScriptPath} Arguments",
51+
$"Arguments to append to the '{name}' build step.",
52+
allowEmpty: true ) );
3453
}
3554
}
3655

56+
private static string GetCustomArgumentsParameterName( string id ) => $"{id}.Arguments";
57+
3758
public override string GenerateTeamCityCode()
3859
{
3960
return $@" powerShell {{

src/PostSharp.Engineering.BuildTools/Dependencies/Definitions/MetalamaDependencies.V2026_0.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public MetalamaDependencyDefinition(
5353
isVersioned ) { }
5454
}
5555

56-
public static ProductFamily Family { get; } = new( _projectName, "2026.0", DevelopmentDependencies.Family, PostSharpDependencies.V2026_0.Family )
56+
public static ProductFamily Family { get; } = new( _projectName, "2026.0", DevelopmentDependencies.Family, PostSharpDependencies.V2025_1.Family )
5757
{
5858
UpstreamProductFamily = V2025_2.Family
5959

0 commit comments

Comments
 (0)