Use a Brewfile for installing brew packages (#36747)
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Wed, 20 May 2020 15:57:57 +0000 (17:57 +0200)
committerGitHub <noreply@github.com>
Wed, 20 May 2020 15:57:57 +0000 (17:57 +0200)
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 https://github.com/dotnet/runtime/issues/36727

docs/workflow/requirements/macos-requirements.md
eng/Brewfile [new file with mode: 0644]
eng/install-native-dependencies.sh [changed mode: 0644->0755]
eng/pipelines/common/global-build-job.yml
eng/pipelines/common/templates/runtimes/build-test-job.yml
eng/pipelines/coreclr/templates/build-job.yml
eng/pipelines/installer/jobs/base-job.yml
eng/pipelines/libraries/build-job.yml
eng/pipelines/mono/templates/build-job.yml

index 82a6610..4604b87 100644 (file)
@@ -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:
 
@@ -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
 ```
diff --git a/eng/Brewfile b/eng/Brewfile
new file mode 100644 (file)
index 0000000..40252a1
--- /dev/null
@@ -0,0 +1,8 @@
+brew "autoconf"
+brew "automake"
+brew "cmake"
+brew "icu4c"
+brew "libtool"
+brew "openssl@1.1"
+brew "pkg-config"
+brew "python3"
old mode 100644 (file)
new mode 100755 (executable)
index be15481..00be5a6
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
 
 if [ "$1" = "Linux" ]; then
     sudo apt update
@@ -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
index e0f71a3..2907120 100644 (file)
@@ -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: |
index a4f94ef..6c46cfa 100644 (file)
@@ -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
index 870cdc6..c23db63 100644 (file)
@@ -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
index 2c309c0..8e9c3f1 100644 (file)
@@ -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: |
index 2287c8f..94df7e9 100644 (file)
@@ -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: |
index 8593d86..901bab9 100644 (file)
@@ -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