forked from dotnet/jitutils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add eng/download-checkout-llvm.yml eng/download-llvm-release.py eng/d…
…ownload-llvm-release.yml
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
steps: | ||
- download: current | ||
artifact: $(LLVMSourceBundle) | ||
displayName: Download LLVM bundle | ||
|
||
- script: git clone $(Pipeline.Workspace)\$(LLVMSourceBundle)\$(LLVMSourceBundle) $(Build.SourcesDirectory)\src\llvm-project | ||
displayName: Checkout LLVM from bundle (Windows) | ||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) | ||
|
||
- script: git clone $(Pipeline.Workspace)/$(LLVMSourceBundle)/$(LLVMSourceBundle) $(Build.SourcesDirectory)/src/llvm-project | ||
displayName: Checkout LLVM from bundle (Linux or macOS) | ||
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Licensed to the .NET Foundation under one or more agreements. | ||
# The .NET Foundation licenses this file to you under the MIT license. | ||
# | ||
import argparse | ||
import io | ||
import os | ||
import sys | ||
import tarfile | ||
from urllib import request | ||
from urllib.error import URLError, HTTPError | ||
|
||
Release_urls = { | ||
'llvmorg-9.0.1': { | ||
'linux': 'https://github.com/llvm/llvm-project/releases/download/llvmorg-9.0.1/clang+llvm-9.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz', | ||
'macos': 'https://github.com/llvm/llvm-project/releases/download/llvmorg-9.0.1/clang+llvm-9.0.1-x86_64-apple-darwin.tar.xz' | ||
}, | ||
'llvmorg-10.0.1': { | ||
'linux': 'https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.1/clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz', | ||
'macos': 'https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.1/clang+llvm-10.0.1-x86_64-apple-darwin.tar.xz' | ||
} | ||
} | ||
|
||
def download_llvm_release(release_url, output_dir): | ||
try: | ||
with request.urlopen(release_url) as response: | ||
downloaded_bytes = response.read() | ||
except (URLError, HTTPError) as err: | ||
print(err) | ||
sys.exit(1) | ||
|
||
with io.BytesIO(downloaded_bytes) as downloaded_fileobj: | ||
with tarfile.open(fileobj=downloaded_fileobj, mode='r:xz') as archive: | ||
archive.extractall(path=output_dir) | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('-release', required=True, choices=Release_urls.keys()) | ||
parser.add_argument('-os', required=True, choices=['linux', 'macos']) | ||
parser.add_argument('-output-dir', dest='output_dir', default=os.getcwd()) | ||
args = parser.parse_args() | ||
|
||
release_url = Release_urls[args.release][args.os] | ||
download_llvm_release(release_url, args.output_dir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
parameters: | ||
- name: os | ||
type: string | ||
- name: release | ||
type: string | ||
|
||
steps: | ||
- script: python3 $(Build.SourcesDirectory)/eng/download-llvm-release.py -os ${{ parameters.os }} -release ${{ parameters.release }} -output-dir $(Pipeline.Workspace) | ||
displayName: Download LLVM release from GitHub | ||
|
||
- script: echo '##vso[task.prependpath]'$(find $(Pipeline.Workspace) -name "clang+llvm-*" -type d)/bin | ||
displayName: Add Clang and LLVM to the PATH |