swift: Fix pre_install (#5612)

Fix the pre_install script because the msi file and the path to be expanded have changed.

---------

Co-authored-by: tech189 <dlloyd189@gmail.com>
This commit is contained in:
KOGA Mitsuhiro 2024-03-20 08:08:50 +09:00 committed by GitHub
parent 50b1bb1e3b
commit 3318d71913
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,22 +19,37 @@
}, },
"pre_install": [ "pre_install": [
"Expand-DarkArchive \"$dir\\swiftsetup.exe\" \"$dir\\extract_folder\" -Removal", "Expand-DarkArchive \"$dir\\swiftsetup.exe\" \"$dir\\extract_folder\" -Removal",
"Get-ChildItem \"$dir\\extract_folder\\AttachedContainer\\a*\" | ForEach-Object {", "$xml = [xml](Get-Content -Raw \"$dir\\extract_folder\\UX\\manifest.xml\" -Encoding utf8)",
" Expand-MsiArchive $_ \"$dir\\extract_folder\"", "$xml.BurnManifest.Payload | ForEach-Object {",
" Move-Item -Path \"$dir\\extract_folder\\AttachedContainer\\$($_.SourcePath)\" -Destination \"$dir\\extract_folder\\AttachedContainer\\$($_.FilePath)\"",
"}", "}",
"Move-Item \"$dir\\extract_folder\\PFiles64\\Swift\" -Destination \"$dir\"", "$xml.BurnManifest.Payload | Where-Object { $_.FilePath.EndsWith(\".msi\") } | ForEach-Object {",
"Move-Item \"$dir\\extract_folder\\Library\\Developer\" -Destination \"$dir\"", " if ($($_.FilePath) -eq \"rtl.msi\") {",
"Remove-Item \"$dir\\extract_folder\" -Recurse | Out-Null" " Expand-MsiArchive \"$dir\\extract_folder\\AttachedContainer\\$($_.FilePath)\" \"$dir\\extract_folder\\LocalApp\\Programs\\Swift\\Runtimes\\usr\\bin\"",
" } else {",
" Expand-MsiArchive \"$dir\\extract_folder\\AttachedContainer\\$($_.FilePath)\" \"$dir\\extract_folder\"",
" }",
"}",
"$ver = $xml.BurnManifest.Registration.Version",
"Move-Item -Path \"$dir\\extract_folder\\LocalApp\\Programs\\Swift\" -Destination \"$dir\"",
"Move-Item -Path \"$dir\\Swift\\Platforms\\$ver\\Windows.platform\" -Destination \"$dir\\Swift\\Platforms\"",
"Move-Item -Path \"$dir\\Swift\\Toolchains\\$($ver)+Asserts\\usr\" -Destination \"$dir\\Swift\\Toolchains\"",
"Move-Item -Path \"$dir\\Swift\\Tools\\$ver\\*\" -Destination \"$dir\\Swift\\Tools\"",
"Remove-Item \"$dir\\Swift\\Platforms\\$ver\" | Out-Null",
"Remove-Item \"$dir\\Swift\\Toolchains\\$ver+Asserts\" | Out-Null",
"Remove-Item \"$dir\\Swift\\Tools\\$ver\" | Out-Null",
"Remove-Item \"$dir\\extract_folder\" -Recurse | Out-Null",
"Move-Item -Path \"$dir\\Swift\\*\" -Destination \"$dir\"",
"Remove-Item \"$dir\\Swift\" | Out-Null"
], ],
"env_add_path": [ "env_add_path": [
"Developer\\Toolchains\\unknown-Asserts-development.xctoolchain\\usr\\bin", "Runtimes\\usr\\bin",
"Swift\\runtime-development\\usr\\bin" "Toolchains\\usr\\bin",
"Tools"
], ],
"env_set": { "env_set": {
"SDKROOT": "$dir\\Developer\\Platforms\\Windows.platform\\Developer\\SDKs\\Windows.sdk", "SDKROOT": "$dir\\Platforms\\Windows.platform\\Developer\\SDKs\\Windows.sdk"
"DEVELOPER_DIR": "$dir\\Developer"
}, },
"bin": "Swift\\runtime-development\\usr\\bin\\plutil.exe",
"checkver": { "checkver": {
"url": "https://github.com/apple/swift", "url": "https://github.com/apple/swift",
"regex": "/swift-([\\d.]+)-RELEASE" "regex": "/swift-([\\d.]+)-RELEASE"