From 3318d719135192c81e4be6f36747abfc587685a5 Mon Sep 17 00:00:00 2001 From: KOGA Mitsuhiro Date: Wed, 20 Mar 2024 08:08:50 +0900 Subject: [PATCH] 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 --- bucket/swift.json | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/bucket/swift.json b/bucket/swift.json index 5b8c76d6c3..804366ce83 100644 --- a/bucket/swift.json +++ b/bucket/swift.json @@ -19,22 +19,37 @@ }, "pre_install": [ "Expand-DarkArchive \"$dir\\swiftsetup.exe\" \"$dir\\extract_folder\" -Removal", - "Get-ChildItem \"$dir\\extract_folder\\AttachedContainer\\a*\" | ForEach-Object {", - " Expand-MsiArchive $_ \"$dir\\extract_folder\"", + "$xml = [xml](Get-Content -Raw \"$dir\\extract_folder\\UX\\manifest.xml\" -Encoding utf8)", + "$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\"", - "Move-Item \"$dir\\extract_folder\\Library\\Developer\" -Destination \"$dir\"", - "Remove-Item \"$dir\\extract_folder\" -Recurse | Out-Null" + "$xml.BurnManifest.Payload | Where-Object { $_.FilePath.EndsWith(\".msi\") } | ForEach-Object {", + " if ($($_.FilePath) -eq \"rtl.msi\") {", + " 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": [ - "Developer\\Toolchains\\unknown-Asserts-development.xctoolchain\\usr\\bin", - "Swift\\runtime-development\\usr\\bin" + "Runtimes\\usr\\bin", + "Toolchains\\usr\\bin", + "Tools" ], "env_set": { - "SDKROOT": "$dir\\Developer\\Platforms\\Windows.platform\\Developer\\SDKs\\Windows.sdk", - "DEVELOPER_DIR": "$dir\\Developer" + "SDKROOT": "$dir\\Platforms\\Windows.platform\\Developer\\SDKs\\Windows.sdk" }, - "bin": "Swift\\runtime-development\\usr\\bin\\plutil.exe", "checkver": { "url": "https://github.com/apple/swift", "regex": "/swift-([\\d.]+)-RELEASE"