|
| 1 | +# swift-numerics |
| 2 | + |
| 3 | +pool: |
| 4 | + vmImage: 'windows-latest' |
| 5 | + |
| 6 | +resources: |
| 7 | + repositories: |
| 8 | + - repository: apple/swift-numerics |
| 9 | + type: github |
| 10 | + name: apple/swift-numerics |
| 11 | + endpoint: GitHub |
| 12 | + |
| 13 | +pr: |
| 14 | + paths: |
| 15 | + include: |
| 16 | + - .ci/swift-numerics.yml |
| 17 | + |
| 18 | +trigger: |
| 19 | + branches: |
| 20 | + include: |
| 21 | + - master |
| 22 | + |
| 23 | +variables: |
| 24 | + toolchain.directory: $(Pipeline.Workspace)/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain |
| 25 | + sdk.directory: $(Pipeline.Workspace)/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk |
| 26 | + developer.directory: $(Pipeline.Workspace)/Library/Developer/Platforms/Windows.platform/Developer/Library |
| 27 | + |
| 28 | +steps: |
| 29 | +- script: | |
| 30 | + git config --global --add core.autocrlf false |
| 31 | + git config --global --add core.symlinks true |
| 32 | + displayName: Configure GIT |
| 33 | + |
| 34 | +- checkout: apple/swift-numerics |
| 35 | + displayName: checkout apple/swift-numerics |
| 36 | + |
| 37 | +- script: | |
| 38 | + git config --global user.name builder |
| 39 | + git config --global user.email [email protected] |
| 40 | +
|
| 41 | + call :ApplyPatches "%SWIFT_NUMERICS_PR%" $(Build.SourcesDirectory) |
| 42 | +
|
| 43 | + goto :eof |
| 44 | +
|
| 45 | + :ApplyPatches |
| 46 | + setlocal |
| 47 | + set list=%~1 |
| 48 | + set repository=%~2 |
| 49 | + for /F "tokens=1*" %%P in ("%list%") do ( |
| 50 | + git -C %repository% fetch origin pull/%%P/merge |
| 51 | + git -C %repository% merge FETCH_HEAD |
| 52 | + if not "%%Q" == "" call :ApplyPatches "%%Q" %repository% |
| 53 | + ) |
| 54 | + displayName: Apply Patches |
| 55 | + enabled: false |
| 56 | + |
| 57 | +- task: DownloadPipelineArtifact@2 |
| 58 | + inputs: |
| 59 | + buildType: 'specific' |
| 60 | + project: '3133d6ab-80a8-4996-ac4f-03df25cd3224' |
| 61 | + definition: '7' |
| 62 | + buildVersionToDownload: 'latest' |
| 63 | + allowPartiallySucceededBuilds: true |
| 64 | + artifactName: 'toolchain-windows-x64' |
| 65 | + targetPath: '$(Pipeline.Workspace)' |
| 66 | + |
| 67 | +- task: DownloadPipelineArtifact@2 |
| 68 | + inputs: |
| 69 | + buildType: 'specific' |
| 70 | + project: '3133d6ab-80a8-4996-ac4f-03df25cd3224' |
| 71 | + definition: '7' |
| 72 | + buildVersionToDownload: 'latest' |
| 73 | + allowPartiallySucceededBuilds: true |
| 74 | + artifactName: 'sdk-windows-x64' |
| 75 | + targetPath: '$(Pipeline.Workspace)' |
| 76 | + |
| 77 | +- task: BatchScript@1 |
| 78 | + displayName: VsDevCmd |
| 79 | + inputs: |
| 80 | + filename: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/VsDevCmd.bat |
| 81 | + arguments: -no_logo -arch=x64 -host_arch=x64 |
| 82 | + modifyEnvironment: true |
| 83 | + |
| 84 | +- script: | |
| 85 | + curl -L "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/ucrt.modulemap" -o "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" |
| 86 | + curl -L "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/visualc.modulemap" -o "%VCToolsInstallDir%\include\module.modulemap" |
| 87 | + curl -L "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/visualc.apinotes" -o "%VCToolsInstallDir%\include\visualc.apinotes" |
| 88 | + curl -L "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/winsdk.modulemap" -o "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" |
| 89 | + displayName: Configure SDK |
| 90 | + |
| 91 | +- script: | |
| 92 | + echo ##vso[task.prependpath]$(toolchain.directory)/usr/bin |
| 93 | + displayName: Update PATH |
| 94 | + |
| 95 | +- task: CMake@1 |
| 96 | + displayName: Configure swift-nuermics |
| 97 | + inputs: |
| 98 | + cmakeArgs: |
| 99 | + -B $(Build.BinariesDirectory)/swift-numerics |
| 100 | + -D BUILD_SHARED_LIBS=YES |
| 101 | + -D CMAKE_BUILD_TYPE=Release |
| 102 | + -D CMAKE_INSTALL_PREFIX=$(Build.StagingDirectory)/swift-numerics-windows-x64/Library/swift-numerics-development/usr |
| 103 | + -D CMAKE_Swift_FLAGS="-sdk $(sdk.directory) -I $(sdk.directory)/usr/lib/swift -L $(sdk.directory)/usr/lib/swift/windows -I $(developer.directory)/XCTest-development/usr/lib/swift/windows/x86_64 -L $(developer.directory)/XCTest-development/usr/lib/swift/windows" |
| 104 | + -G Ninja |
| 105 | + -S $(Build.SourcesDirectory) |
| 106 | + |
| 107 | +- task: CMake@1 |
| 108 | + displayName: Build swift-numerics |
| 109 | + inputs: |
| 110 | + cmakeArgs: --build $(Build.BinariesDirectory)/swift-numerics |
| 111 | + |
| 112 | +- task: CMake@1 |
| 113 | + displayName: Install swift-numerics |
| 114 | + inputs: |
| 115 | + cmakeArgs: --build $(Build.BinariesDirectory)/swift-numerics --target install |
| 116 | + |
| 117 | +- publish: $(Build.StagingDirectory)/swift-numerics-windows-x64 |
| 118 | + artifact: swift-numerics-windows-x64 |
0 commit comments