-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathlldb-mi.template.yml
More file actions
160 lines (125 loc) · 6.58 KB
/
lldb-mi.template.yml
File metadata and controls
160 lines (125 loc) · 6.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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: 31ed003a15a4a8e44881401d065217dfb2642406
lldb_mi_additional_parameters: "-DUSE_LLDB_FRAMEWORK=1"
jobs:
- job: LLDB_MI_${{ parameters.llvm_arch }}
timeoutInMinutes: 360
pool:
${{if eq(parameters['llvm_arch'], 'arm64')}}:
name: cpptoolsMacM1pool
${{ else }}:
vmImage: macOS-latest
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()