Skip to content

Commit abc4865

Browse files
committed
[android] remove Android API level from Dispatch.swiftmodule names
1 parent 59e07f1 commit abc4865

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

utils/build.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,11 @@ function Get-BuildProjectCMakeModules([BuildComponent]$Project) {
478478
return "$BinaryCache\$($Project.value__)\cmake\modules"
479479
}
480480

481+
function Get-PlainLLVMTarget($Arch) {
482+
# Remove trailing Android API number from the LLVMTarget (if present)
483+
return $Arch.LLVMTarget.Replace("$AndroidAPILevel","")
484+
}
485+
481486
function Copy-File($Src, $Dst) {
482487
# Create the directory tree first so Copy-Item succeeds
483488
# If $Dst is the target directory, make sure it ends with "\"
@@ -1091,7 +1096,7 @@ function Build-CMakeProject {
10911096
if (-not ($Platform -eq "Windows")) {
10921097
TryAdd-KeyValue $Defines CMAKE_Swift_COMPILER_WORKS = "YES"
10931098
}
1094-
TryAdd-KeyValue $Defines CMAKE_Swift_COMPILER_TARGET $Arch.LLVMTarget.Replace("$AndroidAPILevel", "")
1099+
TryAdd-KeyValue $Defines CMAKE_Swift_COMPILER_TARGET "$(Get-PlainLLVMTarget $Arch)
10951100
if ($UseBuiltCompilers.Contains("Swift")) {
10961101
$RuntimeBinaryCache = Get-TargetProjectBinaryCache $Arch Runtime
10971102
$SwiftResourceDir = "${RuntimeBinaryCache}\lib\swift"
@@ -1671,12 +1676,10 @@ function Build-RegsGen2($Arch) {
16711676
}
16721677
16731678
function Build-DS2([Platform]$Platform, $Arch) {
1674-
$ArchName = $Arch.LLVMTarget.Replace("$AndroidAPILevel","")
1675-
16761679
Build-CMakeProject `
16771680
-Src "$SourceCache\ds2" `
16781681
-Bin "$($Arch.BinaryCache)\$Platform\ds2" `
1679-
-InstallTo "$($Arch.PlatformInstallRoot)\Developer\Library\$ArchName" `
1682+
-InstallTo "$($Arch.PlatformInstallRoot)\Developer\Library\$(Get-PlainLLVMTarget $Arch)" `
16801683
-Arch $Arch `
16811684
-Platform $Platform `
16821685
-BuildTargets default `
@@ -1828,7 +1831,7 @@ function Build-Runtime([Platform]$Platform, $Arch) {
18281831
-CacheScript $SourceCache\swift\cmake\caches\Runtime-$Platform-$($Arch.LLVMName).cmake `
18291832
-UseBuiltCompilers C,CXX,Swift `
18301833
-Defines ($PlatformDefines + @{
1831-
CMAKE_Swift_COMPILER_TARGET = $Arch.LLVMTarget.Replace("$AndroidAPILevel", "");
1834+
CMAKE_Swift_COMPILER_TARGET = "$(Get-PlainLLVMTarget $Arch)";
18321835
CMAKE_Swift_COMPILER_WORKS = "YES";
18331836
CMAKE_SYSTEM_NAME = $Platform.ToString();
18341837
LLVM_DIR = "$(Get-TargetProjectBinaryCache $Arch LLVM)\lib\cmake\llvm";
@@ -2124,7 +2127,7 @@ function Install-Platform([Platform]$Platform, $Arch) {
21242127
Get-ChildItem -Recurse "$PlatformLibSrc\$($Arch.LLVMName)" | ForEach-Object {
21252128
if (".swiftmodule", ".swiftdoc", ".swiftinterface" -contains $_.Extension) {
21262129
$DstDir = "$PlatformLibDst\$($_.BaseName).swiftmodule"
2127-
Copy-File $_.FullName "$DstDir\$($Arch.LLVMTarget)$($_.Extension)"
2130+
Copy-File $_.FullName "$DstDir\$(Get-PlainLLVMTarget $Arch)$($_.Extension)"
21282131
} else {
21292132
Copy-File $_.FullName "$PlatformLibDst\$($Arch.LLVMName)\"
21302133
}

0 commit comments

Comments
 (0)