Skip to content

Commit b76fdb9

Browse files
authored
Install native dependencies on all Apple OS in CI (#82323)
1 parent b0f1bb4 commit b76fdb9

File tree

10 files changed

+55
-52
lines changed

10 files changed

+55
-52
lines changed

eng/install-native-dependencies.sh

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
2+
3+
set -e
24

35
# This is a simple script primarily used for CI to install necessary dependencies
46
#
5-
# For CI typical usage is
6-
#
7-
# ./install-native-dependencies.sh <OS> <arch> azDO
8-
#
9-
# For developer use it is not recommended to include the azDO final argument as that
10-
# makes installation and configuration setting only required for azDO
11-
#
12-
# So simple developer usage would currently be
7+
# Usage:
138
#
149
# ./install-native-dependencies.sh <OS>
1510

16-
if [ "$1" = "Linux" ]; then
17-
sudo apt update
18-
if [ "$?" != "0" ]; then
19-
exit 1;
20-
fi
21-
sudo apt install cmake llvm-3.9 clang-3.9 lldb-3.9 liblldb-3.9-dev libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libcurl4-openssl-dev libssl-dev libkrb5-dev libnuma-dev build-essential
22-
if [ "$?" != "0" ]; then
23-
exit 1;
24-
fi
25-
elif [[ "$1" == "MacCatalyst" || "$1" == "OSX" || "$1" == "tvOS" || "$1" == "iOS" ]]; then
26-
engdir=$(dirname "${BASH_SOURCE[0]}")
27-
28-
echo "Installed xcode version: `xcode-select -p`"
29-
30-
if [ "$3" = "azDO" ]; then
31-
# workaround for old osx images on hosted agents
32-
# piped in case we get an agent without these values installed
33-
if ! brew_output="$(brew uninstall [email protected] 2>&1 >/dev/null)"; then
34-
echo "didn't uninstall [email protected]"
35-
else
36-
echo "successfully uninstalled [email protected]"
37-
fi
38-
fi
39-
40-
export HOMEBREW_NO_INSTALL_CLEANUP=1
41-
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
42-
# Skip brew update for now, see https://github.com/actions/setup-python/issues/577
43-
# brew update --preinstall
44-
brew bundle --no-upgrade --no-lock --file "${engdir}/Brewfile"
45-
if [ "$?" != "0" ]; then
46-
exit 1;
47-
fi
48-
else
49-
echo "Must pass \"Linux\", \"tvOS\", \"iOS\" or \"OSX\" as first argument."
50-
exit 1
11+
os="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
12+
13+
if [ -z "$os" ]; then
14+
. "$(dirname "$0")"/native/init-os-and-arch.sh
15+
os="$(echo "$os" | tr "[:upper:]" "[:lower:]")"
5116
fi
5217

18+
case "$os" in
19+
linux)
20+
if [ -e /etc/os-release ]; then
21+
. /etc/os-release
22+
fi
23+
24+
if [ "$ID" != "debian" ] && [ "$ID_LIKE" != "debian" ]; then
25+
echo "Unsupported distro. distro: $ID"
26+
exit 1
27+
fi
28+
29+
apt update
30+
31+
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
32+
libssl-dev libkrb5-dev libnuma-dev zlib1g-dev
33+
34+
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
35+
;;
36+
37+
osx|mac*|ios*|tvos*)
38+
echo "Installed xcode version: $(xcode-select -p)"
39+
40+
export HOMEBREW_NO_INSTALL_CLEANUP=1
41+
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
42+
# Skip brew update for now, see https://github.com/actions/setup-python/issues/577
43+
# brew update --preinstall
44+
brew bundle --no-upgrade --no-lock --file "$(dirname "$0")/Brewfile"
45+
;;
46+
47+
*)
48+
echo "Unsupported platform. OS: $os"
49+
exit 1
50+
;;
51+
esac

eng/pipelines/common/global-build-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ jobs:
166166
targetRID: banana.24-x64
167167
runtimeOS: linux
168168

169-
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}:
169+
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}:
170170
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
171171
displayName: Install Build Dependencies
172172

eng/pipelines/common/templates/runtimes/build-test-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
steps:
111111

112112
# Install test build dependencies
113-
- ${{ if eq(parameters.osGroup, 'OSX') }}:
113+
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}:
114114
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
115115
displayName: Install native dependencies
116116

eng/pipelines/coreclr/templates/build-jit-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
# Linux builds use docker images with dependencies preinstalled,
8787
# and FreeBSD builds use a build agent with dependencies
8888
# preinstalled, so we only need this step for OSX and Windows.
89-
- ${{ if eq(parameters.osGroup, 'OSX') }}:
89+
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}:
9090
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
9191
displayName: Install native dependencies (OSX)
9292

eng/pipelines/coreclr/templates/build-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
# Linux builds use docker images with dependencies preinstalled,
163163
# and FreeBSD builds use a build agent with dependencies
164164
# preinstalled, so we only need this step for OSX and Windows.
165-
- ${{ if eq(parameters.osGroup, 'OSX') }}:
165+
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}:
166166
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
167167
displayName: Install native dependencies
168168

eng/pipelines/installer/jobs/base-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ jobs:
383383
displayName: 'Libraries artifacts'
384384
cleanUnpackFolder: false
385385

386-
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
386+
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}:
387387
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
388388
displayName: Install Build Dependencies
389389

eng/pipelines/libraries/build-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
- ${{ if eq(parameters.isOfficialBuild, true) }}:
8888
- template: /eng/pipelines/common/restore-internal-tools.yml
8989

90-
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
90+
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}:
9191
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
9292
displayName: Install Build Dependencies
9393

eng/pipelines/libraries/run-test-job.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ jobs:
8888
artifactFileName: $(librariesTestsArtifactName)$(archiveExtension)
8989
unpackFolder: $(Build.SourcesDirectory)/artifacts
9090

91+
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}:
92+
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
93+
displayName: Install Build Dependencies
94+
9195
- ${{ if ne(parameters.liveRuntimeBuildConfig, '') }}:
9296
- script: $(_buildScript)
9397
-subset host.native+libs.pretest

eng/pipelines/mono/templates/build-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ jobs:
123123
# Linux builds use docker images with dependencies preinstalled,
124124
# and FreeBSD builds use a build agent with dependencies
125125
# preinstalled, so we only need this step for OSX and Windows.
126-
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
126+
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}:
127127
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
128128
displayName: Install native dependencies
129129

eng/pipelines/mono/templates/generate-offsets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
# Linux builds use docker images with dependencies preinstalled,
5757
# and FreeBSD builds use a build agent with dependencies
5858
# preinstalled, so we only need this step for OSX and Windows.
59-
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
59+
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}:
6060
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
6161
displayName: Install native dependencies
6262

0 commit comments

Comments
 (0)