Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure-pipelines: use 10.14 (and Swift) #6113

Merged
merged 6 commits into from May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 3 additions & 22 deletions Library/Homebrew/cask/artifact/abstract_uninstall.rb
Expand Up @@ -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
Expand Down Expand Up @@ -318,28 +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

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 run
APPLESCRIPT
result = command.run!("/usr/bin/swift", args: [TRASH_SCRIPT, *paths])

# Remove AppleScript's automatic newline.
result.tap { |r| r.stdout.sub!(/\n$/, "") }
Expand Down
22 changes: 22 additions & 0 deletions 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)
4 changes: 2 additions & 2 deletions Library/Homebrew/dev-cmd/tap-new.rb
Expand Up @@ -54,11 +54,11 @@ def tap_new
jobs:
- job: macOS
pool:
vmImage: macOS-10.13
vmImage: macOS-10.14
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"
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
@@ -1,11 +1,11 @@
jobs:
- job: macOS
pool:
vmImage: macOS-10.13
vmImage: macOS-10.14
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"
Expand Down