Skip to content

Commit 5465252

Browse files
committed
Port build script fixes from BOS
1 parent 2573b47 commit 5465252

File tree

3 files changed

+112
-96
lines changed

3 files changed

+112
-96
lines changed

CHANGELIST.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### WIP (xxxx-xx-xx)
22

33
- Remove debugging lines from build script
4+
- Port build script fixes from BOS
45

56
### 3.1.1 (2024-02-20)
67

publish-nix.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ then
7575
do
7676
for RUNTIME in "${UI_RUNTIMES[@]}"
7777
do
78+
# If we have an invalid combination of framework and runtime
79+
if [[ ! $(echo ${VALID_CROSS_PLATFORM_FRAMEWORKS[@]} | fgrep -w $FRAMEWORK) ]]
80+
then
81+
if [[ $(echo ${VALID_CROSS_PLATFORM_RUNTIMES[@]} | fgrep -w $RUNTIME) ]]
82+
then
83+
continue
84+
fi
85+
fi
86+
7887
# Only .NET 5 and above can publish to a single file
7988
if [[ $(echo ${SINGLE_FILE_CAPABLE[@]} | fgrep -w $FRAMEWORK) ]]
8089
then

publish-win.ps1

Lines changed: 102 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ param(
1414
[Alias("UseAll")]
1515
[switch]$USE_ALL,
1616

17-
[Parameter(Mandatory = $false)]
17+
[Parameter(Mandatory = $false)]
1818
[Alias("IncludePrograms")]
1919
[switch]$INCLUDE_PROGRAMS,
2020

21-
[Parameter(Mandatory = $false)]
21+
[Parameter(Mandatory = $false)]
2222
[Alias("NoBuild")]
2323
[switch]$NO_BUILD,
2424

25-
[Parameter(Mandatory = $false)]
25+
[Parameter(Mandatory = $false)]
2626
[Alias("NoArchive")]
2727
[switch]$NO_ARCHIVE
2828
)
@@ -56,102 +56,108 @@ $VALID_CROSS_PLATFORM_RUNTIMES = @('win-arm64', 'linux-x64', 'linux-arm64', 'osx
5656
# Only build if requested
5757
if (!$NO_BUILD.IsPresent)
5858
{
59-
# Restore Nuget packages for all builds
60-
Write-Host "Restoring Nuget packages"
61-
dotnet restore
62-
63-
# Build UI
64-
foreach ($FRAMEWORK in $UI_FRAMEWORKS)
65-
{
66-
foreach ($RUNTIME in $UI_RUNTIMES)
67-
{
68-
# Only .NET 5 and above can publish to a single file
69-
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK)
70-
{
71-
dotnet publish MPF\MPF.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
72-
dotnet publish MPF\MPF.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
73-
}
74-
else
75-
{
76-
dotnet publish MPF\MPF.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
77-
dotnet publish MPF\MPF.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
78-
}
79-
}
80-
}
81-
82-
# Build Check
83-
foreach ($FRAMEWORK in $CHECK_FRAMEWORKS)
84-
{
85-
foreach ($RUNTIME in $CHECK_RUNTIMES)
86-
{
87-
# If we have an invalid combination of framework and runtime
88-
if ($VALID_CROSS_PLATFORM_FRAMEWORKS -notcontains $FRAMEWORK -and $VALID_CROSS_PLATFORM_RUNTIMES -contains $RUNTIME)
89-
{
90-
continue
91-
}
92-
93-
# Only .NET 5 and above can publish to a single file
94-
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK)
95-
{
96-
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
97-
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
98-
}
99-
else
100-
{
101-
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
102-
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
103-
}
104-
}
105-
}
59+
# Restore Nuget packages for all builds
60+
Write-Host "Restoring Nuget packages"
61+
dotnet restore
62+
63+
# Build UI
64+
foreach ($FRAMEWORK in $UI_FRAMEWORKS)
65+
{
66+
foreach ($RUNTIME in $UI_RUNTIMES)
67+
{
68+
# If we have an invalid combination of framework and runtime
69+
if ($VALID_CROSS_PLATFORM_FRAMEWORKS -notcontains $FRAMEWORK -and $VALID_CROSS_PLATFORM_RUNTIMES -contains $RUNTIME)
70+
{
71+
continue
72+
}
73+
74+
# Only .NET 5 and above can publish to a single file
75+
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK)
76+
{
77+
dotnet publish MPF\MPF.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
78+
dotnet publish MPF\MPF.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
79+
}
80+
else
81+
{
82+
dotnet publish MPF\MPF.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
83+
dotnet publish MPF\MPF.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
84+
}
85+
}
86+
}
87+
88+
# Build Check
89+
foreach ($FRAMEWORK in $CHECK_FRAMEWORKS)
90+
{
91+
foreach ($RUNTIME in $CHECK_RUNTIMES)
92+
{
93+
# If we have an invalid combination of framework and runtime
94+
if ($VALID_CROSS_PLATFORM_FRAMEWORKS -notcontains $FRAMEWORK -and $VALID_CROSS_PLATFORM_RUNTIMES -contains $RUNTIME)
95+
{
96+
continue
97+
}
98+
99+
# Only .NET 5 and above can publish to a single file
100+
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK)
101+
{
102+
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
103+
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
104+
}
105+
else
106+
{
107+
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
108+
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
109+
}
110+
}
111+
}
106112
}
107113

108114
# Only create archives if requested
109115
if (!$NO_ARCHIVE.IsPresent)
110116
{
111-
# Create UI archives
112-
foreach ($FRAMEWORK in $UI_FRAMEWORKS)
113-
{
114-
foreach ($RUNTIME in $UI_RUNTIMES)
115-
{
116-
Set-Location -Path $BUILD_FOLDER\MPF\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
117-
if ($INCLUDE_PROGRAMS.IsPresent)
118-
{
119-
7z a -tzip $BUILD_FOLDER\MPF_${FRAMEWORK}_${RUNTIME}_debug.zip *
120-
}
121-
else
122-
{
123-
7z a -tzip -x!Programs\* $BUILD_FOLDER\MPF_${FRAMEWORK}_${RUNTIME}_debug.zip *
124-
}
125-
Set-Location -Path $BUILD_FOLDER\MPF\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\
126-
if ($INCLUDE_PROGRAMS.IsPresent)
127-
{
128-
7z a -tzip $BUILD_FOLDER\MPF_${FRAMEWORK}_${RUNTIME}_release.zip *
129-
}
130-
else
131-
{
132-
7z a -tzip -x!Programs\* $BUILD_FOLDER\MPF_${FRAMEWORK}_${RUNTIME}_release.zip *
133-
}
134-
}
135-
}
136-
137-
# Create Check archives
138-
foreach ($FRAMEWORK in $CHECK_FRAMEWORKS)
139-
{
140-
foreach ($RUNTIME in $CHECK_RUNTIMES)
141-
{
142-
# If we have an invalid combination of framework and runtime
143-
if ($VALID_CROSS_PLATFORM_FRAMEWORKS -notcontains $FRAMEWORK -and $VALID_CROSS_PLATFORM_RUNTIMES -contains $RUNTIME)
144-
{
145-
continue
146-
}
147-
148-
Set-Location -Path $BUILD_FOLDER\MPF.Check\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
149-
7z a -tzip $BUILD_FOLDER\MPF.Check_${FRAMEWORK}_${RUNTIME}_debug.zip *
150-
Set-Location -Path $BUILD_FOLDER\MPF.Check\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\
151-
7z a -tzip $BUILD_FOLDER\MPF.Check_${FRAMEWORK}_${RUNTIME}_release.zip *
152-
}
153-
}
154-
155-
# Reset the directory
156-
Set-Location -Path $PSScriptRoot
117+
# Create UI archives
118+
foreach ($FRAMEWORK in $UI_FRAMEWORKS)
119+
{
120+
foreach ($RUNTIME in $UI_RUNTIMES)
121+
{
122+
Set-Location -Path $BUILD_FOLDER\MPF\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
123+
if ($INCLUDE_PROGRAMS.IsPresent)
124+
{
125+
7z a -tzip $BUILD_FOLDER\MPF_${FRAMEWORK}_${RUNTIME}_debug.zip *
126+
}
127+
else
128+
{
129+
7z a -tzip -x!Programs\* $BUILD_FOLDER\MPF_${FRAMEWORK}_${RUNTIME}_debug.zip *
130+
}
131+
Set-Location -Path $BUILD_FOLDER\MPF\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\
132+
if ($INCLUDE_PROGRAMS.IsPresent)
133+
{
134+
7z a -tzip $BUILD_FOLDER\MPF_${FRAMEWORK}_${RUNTIME}_release.zip *
135+
}
136+
else
137+
{
138+
7z a -tzip -x!Programs\* $BUILD_FOLDER\MPF_${FRAMEWORK}_${RUNTIME}_release.zip *
139+
}
140+
}
141+
}
142+
143+
# Create Check archives
144+
foreach ($FRAMEWORK in $CHECK_FRAMEWORKS)
145+
{
146+
foreach ($RUNTIME in $CHECK_RUNTIMES)
147+
{
148+
# If we have an invalid combination of framework and runtime
149+
if ($VALID_CROSS_PLATFORM_FRAMEWORKS -notcontains $FRAMEWORK -and $VALID_CROSS_PLATFORM_RUNTIMES -contains $RUNTIME)
150+
{
151+
continue
152+
}
153+
154+
Set-Location -Path $BUILD_FOLDER\MPF.Check\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
155+
7z a -tzip $BUILD_FOLDER\MPF.Check_${FRAMEWORK}_${RUNTIME}_debug.zip *
156+
Set-Location -Path $BUILD_FOLDER\MPF.Check\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\
157+
7z a -tzip $BUILD_FOLDER\MPF.Check_${FRAMEWORK}_${RUNTIME}_release.zip *
158+
}
159+
}
160+
161+
# Reset the directory
162+
Set-Location -Path $PSScriptRoot
157163
}

0 commit comments

Comments
 (0)