Skip to content

Commit 76c378b

Browse files
committed
Update cleanup logic to properly work for all runtimes
1 parent 3bc1d94 commit 76c378b

1 file changed

Lines changed: 40 additions & 11 deletions

File tree

src/windows/Installer.Windows/layout.ps1

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,47 @@ dotnet publish "$GCM_SRC" `
7070
Remove-Item -Path "$PAYLOAD/*.dylib" -Force -ErrorAction Ignore
7171

7272
# Delete extraneous files that get included for other runtimes
73-
Remove-Item -Path "$PAYLOAD/arm/" -Recurse -Force -ErrorAction Ignore
74-
Remove-Item -Path "$PAYLOAD/arm64/" -Recurse -Force -ErrorAction Ignore
75-
Remove-Item -Path "$PAYLOAD/x64/" -Recurse -Force -ErrorAction Ignore
7673
Remove-Item -Path "$PAYLOAD/musl-x64/" -Recurse -Force -ErrorAction Ignore
77-
Remove-Item -Path "$PAYLOAD/runtimes/win-arm64/" -Recurse -Force -ErrorAction Ignore
78-
Remove-Item -Path "$PAYLOAD/runtimes/win-x64/" -Recurse -Force -ErrorAction Ignore
79-
80-
# The Avalonia and MSAL binaries in these directories are already included in
81-
# the $PAYLOAD directory directly, so we can delete these extra copies.
82-
Remove-Item -Path "$PAYLOAD/x86/libSkiaSharp.dll" -Recurse -Force -ErrorAction Ignore
83-
Remove-Item -Path "$PAYLOAD/x86/libHarfBuzzSharp.dll" -Recurse -Force -ErrorAction Ignore
84-
Remove-Item -Path "$PAYLOAD/runtimes/win-x86/native/msalruntime_x86.dll" -Recurse -Force -ErrorAction Ignore
74+
75+
switch ($RuntimeIdentifier) {
76+
"win-x86" {
77+
Remove-Item -Path "$PAYLOAD/arm/" -Recurse -Force -ErrorAction Ignore
78+
Remove-Item -Path "$PAYLOAD/arm64/" -Recurse -Force -ErrorAction Ignore
79+
Remove-Item -Path "$PAYLOAD/x64/" -Recurse -Force -ErrorAction Ignore
80+
Remove-Item -Path "$PAYLOAD/runtimes/win-arm64/" -Recurse -Force -ErrorAction Ignore
81+
Remove-Item -Path "$PAYLOAD/runtimes/win-x64/" -Recurse -Force -ErrorAction Ignore
82+
# The Avalonia and MSAL binaries are already included in the $PAYLOAD directory directly
83+
Remove-Item -Path "$PAYLOAD/x86/libSkiaSharp.dll" -Force -ErrorAction Ignore
84+
Remove-Item -Path "$PAYLOAD/x86/libHarfBuzzSharp.dll" -Force -ErrorAction Ignore
85+
Remove-Item -Path "$PAYLOAD/runtimes/win-x86/native/msalruntime_x86.dll" -Force -ErrorAction Ignore
86+
}
87+
"win-x64" {
88+
Remove-Item -Path "$PAYLOAD/arm/" -Recurse -Force -ErrorAction Ignore
89+
Remove-Item -Path "$PAYLOAD/arm64/" -Recurse -Force -ErrorAction Ignore
90+
Remove-Item -Path "$PAYLOAD/x86/" -Recurse -Force -ErrorAction Ignore
91+
Remove-Item -Path "$PAYLOAD/runtimes/win-arm64/" -Recurse -Force -ErrorAction Ignore
92+
Remove-Item -Path "$PAYLOAD/runtimes/win-x86/" -Recurse -Force -ErrorAction Ignore
93+
# The Avalonia and MSAL binaries are already included in the $PAYLOAD directory directly
94+
Remove-Item -Path "$PAYLOAD/x64/libSkiaSharp.dll" -Force -ErrorAction Ignore
95+
Remove-Item -Path "$PAYLOAD/x64/libHarfBuzzSharp.dll" -Force -ErrorAction Ignore
96+
Remove-Item -Path "$PAYLOAD/x64/libSkiaSharp.so" -Force -ErrorAction Ignore
97+
Remove-Item -Path "$PAYLOAD/x64/libHarfBuzzSharp.so" -Force -ErrorAction Ignore
98+
Remove-Item -Path "$PAYLOAD/runtimes/win-x64/native/msalruntime.dll" -Force -ErrorAction Ignore
99+
}
100+
"win-arm64" {
101+
Remove-Item -Path "$PAYLOAD/arm/" -Recurse -Force -ErrorAction Ignore
102+
Remove-Item -Path "$PAYLOAD/x86/" -Recurse -Force -ErrorAction Ignore
103+
Remove-Item -Path "$PAYLOAD/x64/" -Recurse -Force -ErrorAction Ignore
104+
Remove-Item -Path "$PAYLOAD/runtimes/win-x86/" -Recurse -Force -ErrorAction Ignore
105+
Remove-Item -Path "$PAYLOAD/runtimes/win-x64/" -Recurse -Force -ErrorAction Ignore
106+
# The Avalonia and MSAL binaries are already included in the $PAYLOAD directory directly
107+
Remove-Item -Path "$PAYLOAD/arm64/libSkiaSharp.dll" -Force -ErrorAction Ignore
108+
Remove-Item -Path "$PAYLOAD/arm64/libHarfBuzzSharp.dll" -Force -ErrorAction Ignore
109+
Remove-Item -Path "$PAYLOAD/arm64/libSkiaSharp.so" -Force -ErrorAction Ignore
110+
Remove-Item -Path "$PAYLOAD/arm64/libHarfBuzzSharp.so" -Force -ErrorAction Ignore
111+
Remove-Item -Path "$PAYLOAD/runtimes/win-arm64/native/msalruntime_arm64.dll" -Force -ErrorAction Ignore
112+
}
113+
}
85114

86115
# Delete localized resource assemblies - we don't localize the core GCM assembly anyway
87116
Get-ChildItem "$PAYLOAD" -Recurse -Include "*.resources.dll" | Remove-Item -Force -ErrorAction Ignore

0 commit comments

Comments
 (0)