160 lines
6.6 KiB
YAML
160 lines
6.6 KiB
YAML
parameters:
|
|
# Note: Make sure llvm_repo is the same as the one in Extension/cgmanifest.json
|
|
# 'RepositoryUrl' for llvm-project.
|
|
llvm_repo: https://github.com/llvm/llvm-project.git
|
|
|
|
# Note: Make sure llvm_commit is the same as the one in Extension/cgmanifest.json
|
|
# 'CommitHash' for llvm-project.
|
|
llvm_commit: 0d44201451f03ba907cdb268ddddfc3fa38a0ebd
|
|
|
|
llvm_build_type: Release
|
|
|
|
llvm_arch: x86_64
|
|
|
|
llvm_additional_parameters: "-DLLDB_USE_SYSTEM_DEBUGSERVER=ON -DLLDB_RELOCATABLE_PYTHON=1 -DLLDB_INCLUDE_TESTS=OFF -DLLDB_BUILD_FRAMEWORK=1"
|
|
|
|
# Note: Make sure lldb_mi_repo is the same as the one in Extension/cgmanifest.json
|
|
# 'CommitHash' for lldb-mi.
|
|
lldb_mi_repo: https://github.com/lldb-tools/lldb-mi.git
|
|
|
|
# Note: Make sure lldb_mi_commit is the same as the one in Extension/cgmanifest.json
|
|
# 'CommitHash' for lldb-mi.
|
|
lldb_mi_commit: 4fe9c663edce2447e114c71851694d8c529b982d
|
|
|
|
lldb_mi_additional_parameters: "-DUSE_LLDB_FRAMEWORK=1"
|
|
|
|
jobs:
|
|
- job: LLDB_MI_${{ parameters.llvm_arch }}
|
|
timeoutInMinutes: 360
|
|
pool:
|
|
${{if eq(parameters['llvm_arch'], 'arm64')}}:
|
|
vmImage: macos-13-arm64
|
|
${{ else }}:
|
|
vmImage: macOS-13
|
|
steps:
|
|
- task: CmdLine@2
|
|
displayName: 'Install Dependencies'
|
|
inputs:
|
|
script: brew install cmake ninja swig
|
|
continueOnError: true
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Make sure buildspace does not exist'
|
|
inputs:
|
|
script: rm -rf $(Build.StagingDirectory)/buildspace
|
|
condition: always()
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Build LLVM Project'
|
|
inputs:
|
|
script: |
|
|
log_and_exec_cmd() {
|
|
echo "##[command] $1"
|
|
$1
|
|
}
|
|
|
|
log_and_exec_cmd "sudo rm -rf /Library/Developer/CommandLineTools"
|
|
log_and_exec_cmd "sudo xcode-select --switch /Applications/XCode.app"
|
|
|
|
log_and_exec_cmd "cd $(Build.StagingDirectory)"
|
|
log_and_exec_cmd "mkdir $(Build.StagingDirectory)/buildspace"
|
|
|
|
log_and_exec_cmd "git clone ${{ parameters.llvm_repo }} llvm-project"
|
|
log_and_exec_cmd "cd llvm-project"
|
|
log_and_exec_cmd "git checkout ${{ parameters.llvm_commit }}"
|
|
|
|
log_and_exec_cmd "./lldb/scripts/macos-setup-codesign.sh"
|
|
|
|
log_and_exec_cmd "cd .."
|
|
log_and_exec_cmd "mkdir $(Build.StagingDirectory)/buildspace/llvm-inst"
|
|
log_and_exec_cmd "mkdir $(Build.StagingDirectory)/buildspace/llvm-build"
|
|
log_and_exec_cmd "cd $(Build.StagingDirectory)/buildspace/llvm-build"
|
|
|
|
log_and_exec_cmd "cmake -DLLVM_ENABLE_PROJECTS=clang;lldb -DCMAKE_BUILD_TYPE=${{ parameters.llvm_build_type }} -DCMAKE_INSTALL_PREFIX=$(Build.StagingDirectory)/buildspace/llvm-inst/ -DCMAKE_OSX_ARCHITECTURES=${{ parameters.llvm_arch }} ${{ parameters.llvm_additional_parameters }} -GNinja $(Build.StagingDirectory)/llvm-project/llvm"
|
|
if [[ $? -ne 0 ]]
|
|
then
|
|
echo "##[error] cmake llvm failed"
|
|
cat $(Build.SourcesDirectory)/buildspace/llvm-build/CMakeFiles/CMakeError.log
|
|
exit 1
|
|
fi
|
|
|
|
log_and_exec_cmd ninja
|
|
if [[ $? -ne 0 ]]
|
|
then
|
|
echo "##[error] ninja failed"
|
|
exit 1
|
|
fi
|
|
|
|
### Workaround for https://github.com/llvm/llvm-project/issues/108
|
|
log_and_exec_cmd "ninja install"
|
|
|
|
# Remove conflicting LLDB.framework file.
|
|
log_and_exec_cmd "rm -rf $(Build.StagingDirectory)/buildspace/llvm-inst/Library/Frameworks/LLDB.framework"
|
|
|
|
# Build lldb/sources/API first
|
|
log_and_exec_cmd "cmake -P $(Build.StagingDirectory)/buildspace/llvm-build/tools/lldb/source/API/cmake_install.cmake"
|
|
### End of Workaround
|
|
|
|
log_and_exec_cmd "ninja install"
|
|
if [[ $? -ne 0 ]]
|
|
then
|
|
echo "##[error] ninja install failed"
|
|
exit 1
|
|
fi
|
|
|
|
echo "##[section] Build LLDB-MI"
|
|
# Download lldb-mi and build it against our custom installation.
|
|
log_and_exec_cmd "cd $(Build.StagingDirectory)/buildspace"
|
|
log_and_exec_cmd "git clone ${{ parameters.lldb_mi_repo }} lldb-mi"
|
|
log_and_exec_cmd "cd lldb-mi"
|
|
log_and_exec_cmd "git checkout ${{ parameters.lldb_mi_commit }}"
|
|
|
|
# Create a separate build directory for building lldb-mi.
|
|
log_and_exec_cmd "mkdir build"
|
|
log_and_exec_cmd "cd build"
|
|
log_and_exec_cmd "cmake -DCMAKE_PREFIX_PATH=$(Build.StagingDirectory)/buildspace/llvm-inst/ -DCMAKE_OSX_ARCHITECTURES=${{ parameters.llvm_arch }} ${{ parameters.lldb_mi_additional_parameters }} -GNinja .."
|
|
log_and_exec_cmd "ninja"
|
|
if [[ $? -ne 0 ]]
|
|
then
|
|
echo "##[error] ninja failed"
|
|
exit 1
|
|
fi
|
|
|
|
log_and_exec_cmd "mkdir $(Build.StagingDirectory)/publish"
|
|
log_and_exec_cmd "cd $(Build.StagingDirectory)/publish"
|
|
|
|
log_and_exec_cmd "mkdir -p ./debugAdapters/lldb-mi_${{ parameters.llvm_arch }}/bin"
|
|
|
|
log_and_exec_cmd "cp $(Build.StagingDirectory)/buildspace/lldb-mi/build/src/lldb-mi ./debugAdapters/lldb-mi_${{ parameters.llvm_arch }}/bin/."
|
|
|
|
# Set rpath for finding LLDB.Framework
|
|
log_and_exec_cmd "install_name_tool -add_rpath @rpath/LLDB.framework/Versions/A/LLDB ./debugAdapters/lldb-mi_${{ parameters.llvm_arch }}/bin/lldb-mi"
|
|
|
|
# Set rpath for App Store XCode LLDB.Framework
|
|
log_and_exec_cmd "install_name_tool -add_rpath /Applications/Xcode.app/Contents/SharedFrameworks/ ./debugAdapters/lldb-mi_${{ parameters.llvm_arch }}/bin/lldb-mi"
|
|
|
|
# Set rpath for XCode CLI LLDB.Framework
|
|
log_and_exec_cmd "install_name_tool -add_rpath /Library/Developer/CommandLineTools/Library/PrivateFrameworks/ ./debugAdapters/lldb-mi_${{ parameters.llvm_arch }}/bin/lldb-mi"
|
|
|
|
# Set rpath next to the lldb-mi executable LLDB.Framework
|
|
log_and_exec_cmd "install_name_tool -add_rpath @executable_path/. ./debugAdapters/lldb-mi_${{ parameters.llvm_arch }}/bin/lldb-mi"
|
|
|
|
# Add entitlements
|
|
log_and_exec_cmd "codesign -s - -f --entitlements $(Build.SourcesDirectory)/Build/lldb-mi/debugger-entitlements.plist ./debugAdapters/lldb-mi_${{ parameters.llvm_arch }}/bin/lldb-mi"
|
|
|
|
# Grab NOTICE.TXT
|
|
cp $(Build.SourcesDirectory)/Build/lldb-mi/NOTICE.TXT ./debugAdapters/lldb-mi_${{ parameters.llvm_arch }}/.
|
|
|
|
zip -r $(Build.StagingDirectory)/lldb-mi_${{ parameters.llvm_arch }}.zip ./debugAdapters
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: 'Publish LLDB-MI'
|
|
inputs:
|
|
targetPath: '$(Build.StagingDirectory)/lldb-mi_${{ parameters.llvm_arch }}.zip'
|
|
artifactName: 'unsigned_lldb-mi_${{ parameters.llvm_arch }}'
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Clean up'
|
|
inputs:
|
|
script: rm -rf $(Build.StagingDirectory)/buildspace
|
|
condition: always() |