Skip to content

Commit

Permalink
Use a Brewfile for installing brew packages (#36747)
Browse files Browse the repository at this point in the history
This means we won't be upgrading existing packages on the system that we don't need for the build.
Marks install-native-dependencies.sh as executable (+x) so we don't need to start it with `sh` in the build .yml

Fixes #36727
  • Loading branch information
akoeplinger authored May 20, 2020
1 parent 3620e8d commit af2e5c9
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 40 deletions.
6 changes: 3 additions & 3 deletions docs/workflow/requirements/macos-requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Install Apple Xcode developer tools from the Mac App Store ([link](https://apps.
Toolchain Setup
---------------

Building dotnet/runtime depends on several tools to be installed. You can download them individually or use [Homebrew](http://brew.sh) for easier toolchain setup.
Building dotnet/runtime depends on several tools to be installed. You can download them individually or use [Homebrew](https://brew.sh) for easier toolchain setup.

Install the following packages:

Expand All @@ -29,8 +29,8 @@ Install the following packages:
- pkg-config
- python3

The lines to install all the packages above using Homebrew.
You can install all the packages above using Homebrew by running this command in the repository root:

```
brew install cmake autoconf automake icu4c libtool openssl@1.1 pkg-config python3
brew bundle --no-lock --file eng/Brewfile
```
8 changes: 8 additions & 0 deletions eng/Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
brew "autoconf"
brew "automake"
brew "cmake"
brew "icu4c"
brew "libtool"
brew "openssl@1.1"
brew "pkg-config"
brew "python3"
35 changes: 4 additions & 31 deletions eng/install-native-dependencies.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

if [ "$1" = "Linux" ]; then
sudo apt update
Expand All @@ -9,36 +9,9 @@ if [ "$1" = "Linux" ]; then
if [ "$?" != "0" ]; then
exit 1;
fi
elif [ "$1" = "OSX" ]; then
brew update
brew upgrade
if [ "$?" != "0" ]; then
exit 1;
fi
brew install autoconf automake icu4c libtool openssl@1.1 pkg-config python3
if [ "$?" != "0" ]; then
exit 1;
fi
if [ "$?" != "0" ]; then
exit 1;
fi
elif [ "$1" = "tvOS" ]; then
brew update
brew upgrade
if [ "$?" != "0" ]; then
exit 1;
fi
brew install autoconf automake libtool openssl@1.1 pkg-config python3
if [ "$?" != "0" ]; then
exit 1;
fi
elif [ "$1" = "iOS" ]; then
brew update
brew upgrade
if [ "$?" != "0" ]; then
exit 1;
fi
brew install autoconf automake libtool openssl@1.1 pkg-config python3
elif [ "$1" = "OSX" ] || [ "$1" = "tvOS" ] || [ "$1" = "iOS" ]; then
engdir=$(dirname "${BASH_SOURCE[0]}")
brew bundle --no-lock --file "${engdir}/Brewfile"
if [ "$?" != "0" ]; then
exit 1;
fi
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/common/global-build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- template: /eng/pipelines/common/clone-checkout-bundle-step.yml

- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
displayName: Install Build Dependencies

- script: |
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/common/templates/runtimes/build-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:

# Install test build dependencies
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
displayName: Install native dependencies
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
# Necessary to install correct cmake version
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/coreclr/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
# and FreeBSD builds use a build agent with dependencies
# preinstalled, so we only need this step for OSX and Windows.
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
displayName: Install native dependencies
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
# Necessary to install python
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/installer/jobs/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ jobs:
cleanUnpackFolder: false

- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
displayName: Install Build Dependencies

- script: |
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/libraries/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- template: /eng/pipelines/common/restore-internal-tools.yml

- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
displayName: Install Build Dependencies

- script: |
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/mono/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
# and FreeBSD builds use a build agent with dependencies
# preinstalled, so we only need this step for OSX and Windows.
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
displayName: Install native dependencies
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
# Necessary to install python
Expand Down

0 comments on commit af2e5c9

Please sign in to comment.