Skip to content

Commit e695f2d

Browse files
committed
refactor: build script to include both releases
1 parent 54998f0 commit e695f2d

7 files changed

Lines changed: 43 additions & 29 deletions

File tree

.assets/scripts/set-version-and-build.ps1

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,47 @@ $solutionDir = Get-SolutionDirectory
1111
Set-Location $solutionDir
1212

1313
# Ensure GitVersion environment variables are set
14-
Ensure-GitVersion-Environment
15-
16-
# Build the project with the version information applied
17-
Build-Project -Configuration $BuildType
14+
Ensure-GitVersion-Environment
1815

1916
$solutionName = Split-Path $solutionDir -Leaf
2017

21-
# Output directory
22-
$releaseDir = Join-Path $solutionDir "src\$solutionName\bin\Release"
18+
# Build and package for each release configuration
19+
$configurations = @("Release", "ReleaseNoMemoryPack")
2320

24-
# Ensure release directory exists
25-
if (Test-Path $releaseDir) {
26-
Get-ChildItem -Path $releaseDir -Directory | ForEach-Object {
27-
$targetDir = $_.FullName
28-
$frameworkName = $_.Name
21+
foreach ($config in $configurations) {
22+
# Build the project with the current configuration
23+
Build-Project -Configuration $config
2924

30-
# Construct final archive name
31-
$zipFileName = "${solutionName}-v$($Env:GitVersion_FullSemVer)-${frameworkName}-release.zip"
32-
$zipPath = Join-Path $releaseDir $zipFileName
25+
# Output directory for this configuration
26+
$releaseDir = Join-Path $solutionDir "src\$solutionName\bin\$config"
3327

34-
Write-Host "Creating archive: $zipPath"
28+
# Determine archive label suffix (lowercase, hyphen-separated)
29+
$configLabel = $config.ToLower() -replace "release", "release" # keeps "release" / "releasenomemorypack"
3530

36-
if (Test-Path $zipPath) {
37-
Remove-Item $zipPath -Force
38-
}
31+
if (Test-Path $releaseDir) {
32+
Get-ChildItem -Path $releaseDir -Directory | ForEach-Object {
33+
$targetDir = $_.FullName
34+
$frameworkName = $_.Name
35+
36+
# Construct final archive name
37+
$zipFileName = "${solutionName}-v$($Env:GitVersion_FullSemVer)-${frameworkName}-${configLabel}.zip"
38+
$zipPath = Join-Path $releaseDir $zipFileName
39+
40+
Write-Host "Creating archive: $zipPath"
41+
42+
if (Test-Path $zipPath) {
43+
Remove-Item $zipPath -Force
44+
}
3945

40-
Compress-Archive -Path "$targetDir\*" -DestinationPath $zipPath -Force
46+
Compress-Archive -Path "$targetDir\*" -DestinationPath $zipPath -Force
4147

42-
if (Test-Path $zipPath) {
43-
Write-Host "Archive created for $frameworkName"
44-
} else {
45-
Write-Warning "Failed to create archive for $frameworkName"
48+
if (Test-Path $zipPath) {
49+
Write-Host "Archive created for $frameworkName ($config)"
50+
} else {
51+
Write-Warning "Failed to create archive for $frameworkName ($config)"
52+
}
4653
}
54+
} else {
55+
Write-Warning "Release directory not found for configuration '$config': $releaseDir"
4756
}
48-
} else {
49-
Write-Warning "Release directory not found: $releaseDir"
5057
}

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ dotnet_diagnostic.IDE0251.severity = silent
1212
# Enable XML documentation warnings only for source code
1313
[src/**/*.cs]
1414
dotnet_diagnostic.CS1591.severity = warning
15-

.globalconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
is_global = true
22

33
# Suppress CS1591 (missing XML comments) for all files
4-
dotnet_diagnostic.CS1591.severity = none
4+
dotnet_diagnostic.CS1591.severity = none

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
- Solution: `FixedMathSharp.slnx` with library project and test project.
1313
- Target frameworks are configured in the respective `.csproj` files; `net8.0` is the primary TFM.
14+
- There are two release build configurations:
15+
- `Release` — standard release build with MemoryPack support.
16+
- `ReleaseNoMemoryPack` — release build with MemoryPack excluded.
1417
- Typical local workflow:
1518
- `dotnet restore`
1619
- `dotnet build --configuration Debug --no-restore`

FixedMathSharp.slnx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<Solution>
2+
<Configurations>
3+
<BuildType Name="Debug" />
4+
<BuildType Name="Release" />
5+
<BuildType Name="ReleaseNoMemoryPack" />
6+
</Configurations>
27
<Folder Name="/Solution Items/">
38
<File Path=".editorconfig" />
49
<File Path=".gitattributes" />

src/FixedMathSharp.FluentAssertions/FixedMathSharp.FluentAssertions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<DebugType>portable</DebugType>
2121
<Deterministic>true</Deterministic>
2222
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
23-
<Configurations>Debug;Release</Configurations>
23+
<Configurations>Debug;Release;ReleaseNoMemoryPack</Configurations>
2424
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2525
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2626
<AssemblyName>FixedMathSharp.FluentAssertions</AssemblyName>

tests/FixedMathSharp.Tests/FixedMathSharp.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Nullable>enable</Nullable>
77
<IsPackable>false</IsPackable>
88
<IsTestProject>true</IsTestProject>
9-
<Configurations>Debug;Release</Configurations>
9+
<Configurations>Debug;Release;ReleaseNoMemoryPack</Configurations>
1010
<OutputType>Exe</OutputType>
1111
<RunSettingsFilePath>$(MSBuildThisFileDirectory)coverlet.runsettings</RunSettingsFilePath>
1212
</PropertyGroup>

0 commit comments

Comments
 (0)