From a4d73b198a09a3f6cdd60cc88cb256f915609f80 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Wed, 24 Apr 2019 16:59:28 -0700 Subject: [PATCH 1/6] azure-pipelines.yml: use macOS-10.14 --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e1dea13014230..62ba0856f29cb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,7 @@ jobs: - job: macOS pool: - vmImage: macOS-10.13 + vmImage: macOS-10.14 steps: - bash: | set -e From d6bd271986a2f8ca165f13a01626bc51ea157392 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Wed, 24 Apr 2019 17:00:36 -0700 Subject: [PATCH 2/6] dev-cmd/tap-new: azure script to use 10.14 --- Library/Homebrew/dev-cmd/tap-new.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index db5e742c15626..317794aa24ea4 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -54,7 +54,7 @@ def tap_new jobs: - job: macOS pool: - vmImage: macOS-10.13 + vmImage: macOS-10.14 steps: - bash: | set -e From 1406ee7eac845069cc4fefac0820b0d0248691bc Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Wed, 8 May 2019 11:29:37 -0700 Subject: [PATCH 3/6] abstract_uninstall: add timeout to trash_paths --- .../cask/artifact/abstract_uninstall.rb | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index 82aa4fd467866..d0ca32acf0b7e 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -324,20 +324,27 @@ def trash_paths(*paths, command: nil, **_) set item i of argv to (item i of argv as POSIX file) end repeat - tell application "Finder" - set trashedItems to (move argv to trash) - set output to "" - - repeat with i from 1 to (count trashedItems) - set trashedItem to POSIX path of (item i of trashedItems as string) - set output to output & trashedItem - if i < count trashedItems then - set output to output & character id 0 - end if - end repeat - - return output - end tell + try + with timeout of 30 seconds + tell application "Finder" + set trashedItems to (move argv to trash) + set output to "" + + repeat with i from 1 to (count trashedItems) + set trashedItem to POSIX path of (item i of trashedItems as string) + set output to output & trashedItem + if i < count trashedItems then + set output to output & character id 0 + end if + end repeat + + return output + end tell + end timeout + on error + -- Ignore errors (probably running under Azure) + return 0 + end try end run APPLESCRIPT From 93b2c29612dc56b07e7d2e962f0affbe48332ff8 Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" <13498015+amyspark@users.noreply.github.com> Date: Thu, 9 May 2019 18:39:21 +0000 Subject: [PATCH 4/6] Port file trashing to Swift This avoids hitting AppleScript timeouts in CI. --- .../cask/artifact/abstract_uninstall.rb | 32 ++----------------- Library/Homebrew/cask/utils/trash.swift | 22 +++++++++++++ 2 files changed, 25 insertions(+), 29 deletions(-) create mode 100644 Library/Homebrew/cask/utils/trash.swift diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index d0ca32acf0b7e..206f0d380a9db 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -24,6 +24,8 @@ class AbstractUninstall < AbstractArtifact :rmdir, ].freeze + TRASH_SCRIPT = (HOMEBREW_LIBRARY_PATH/"cask/utils/trash.swift").freeze + def self.from_args(cask, **directives) new(cask, directives) end @@ -318,35 +320,7 @@ def uninstall_trash(*paths, **options) end def trash_paths(*paths, command: nil, **_) - result = command.run!("osascript", args: ["-e", <<~APPLESCRIPT, *paths]) - on run argv - repeat with i from 1 to (count argv) - set item i of argv to (item i of argv as POSIX file) - end repeat - - try - with timeout of 30 seconds - tell application "Finder" - set trashedItems to (move argv to trash) - set output to "" - - repeat with i from 1 to (count trashedItems) - set trashedItem to POSIX path of (item i of trashedItems as string) - set output to output & trashedItem - if i < count trashedItems then - set output to output & character id 0 - end if - end repeat - - return output - end tell - end timeout - on error - -- Ignore errors (probably running under Azure) - return 0 - end try - end run - APPLESCRIPT + result = command.run!("/usr/bin/swift", args: [TRASH_SCRIPT, *paths]) # Remove AppleScript's automatic newline. result.tap { |r| r.stdout.sub!(/\n$/, "") } diff --git a/Library/Homebrew/cask/utils/trash.swift b/Library/Homebrew/cask/utils/trash.swift new file mode 100644 index 0000000000000..cddbd686ccd4c --- /dev/null +++ b/Library/Homebrew/cask/utils/trash.swift @@ -0,0 +1,22 @@ +#!/usr/bin/swift + +import Foundation + +if (CommandLine.arguments.count < 2) { + exit(2) +} + +let manager: FileManager = FileManager() + +for item in CommandLine.arguments[1...] { + do { + let path: URL = URL(fileURLWithPath: item) + try manager.trashItem(at: path, resultingItemURL: nil) + print(path) + } + catch { + print("\0") + } +} + +exit(0) From 9875f3a464d1591b21ac8655c13d1a0adefb2ad5 Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" <13498015+amyspark@users.noreply.github.com> Date: Thu, 9 May 2019 20:32:04 +0000 Subject: [PATCH 5/6] Use Xcode 10.2 for CI See https://github.com/Homebrew/brew/pull/6083 --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 62ba0856f29cb..30bbdd14f3619 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,7 +5,7 @@ jobs: steps: - bash: | set -e - sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer + sudo xcode-select --switch /Applications/Xcode_10.2.app/Contents/Developer HOMEBREW_REPOSITORY="$(brew --repo)" mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library" sudo rm -rf "$HOMEBREW_REPOSITORY" From 9050d0a7b1f4f2126beb152212be34fe419c5297 Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" <13498015+amyspark@users.noreply.github.com> Date: Thu, 9 May 2019 23:59:43 +0000 Subject: [PATCH 6/6] Use Xcode 10.2 for new taps too See https://github.com/Homebrew/brew/pull/6083 --- Library/Homebrew/dev-cmd/tap-new.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index 317794aa24ea4..9631a25a1b9df 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -58,7 +58,7 @@ def tap_new steps: - bash: | set -e - sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer + sudo xcode-select --switch /Applications/Xcode_10.2.app/Contents/Developer brew update HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/#{tap.full_name}" mkdir -p "$HOMEBREW_TAP_DIR"