Merge pull request #6113 from amyspark/azure_mojave_only
azure-pipelines: use 10.14 (and Swift)
This commit is contained in:
commit
ea0b36f69a
@ -24,6 +24,8 @@ module Cask
|
|||||||
:rmdir,
|
:rmdir,
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
|
TRASH_SCRIPT = (HOMEBREW_LIBRARY_PATH/"cask/utils/trash.swift").freeze
|
||||||
|
|
||||||
def self.from_args(cask, **directives)
|
def self.from_args(cask, **directives)
|
||||||
new(cask, directives)
|
new(cask, directives)
|
||||||
end
|
end
|
||||||
@ -318,28 +320,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def trash_paths(*paths, command: nil, **_)
|
def trash_paths(*paths, command: nil, **_)
|
||||||
result = command.run!("osascript", args: ["-e", <<~APPLESCRIPT, *paths])
|
result = command.run!("/usr/bin/swift", args: [TRASH_SCRIPT, *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
|
|
||||||
|
|
||||||
# Remove AppleScript's automatic newline.
|
# Remove AppleScript's automatic newline.
|
||||||
result.tap { |r| r.stdout.sub!(/\n$/, "") }
|
result.tap { |r| r.stdout.sub!(/\n$/, "") }
|
||||||
|
|||||||
22
Library/Homebrew/cask/utils/trash.swift
Normal file
22
Library/Homebrew/cask/utils/trash.swift
Normal file
@ -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)
|
||||||
@ -54,11 +54,11 @@ module Homebrew
|
|||||||
jobs:
|
jobs:
|
||||||
- job: macOS
|
- job: macOS
|
||||||
pool:
|
pool:
|
||||||
vmImage: macOS-10.13
|
vmImage: macOS-10.14
|
||||||
steps:
|
steps:
|
||||||
- bash: |
|
- bash: |
|
||||||
set -e
|
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
|
brew update
|
||||||
HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/#{tap.full_name}"
|
HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/#{tap.full_name}"
|
||||||
mkdir -p "$HOMEBREW_TAP_DIR"
|
mkdir -p "$HOMEBREW_TAP_DIR"
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
jobs:
|
jobs:
|
||||||
- job: macOS
|
- job: macOS
|
||||||
pool:
|
pool:
|
||||||
vmImage: macOS-10.13
|
vmImage: macOS-10.14
|
||||||
steps:
|
steps:
|
||||||
- bash: |
|
- bash: |
|
||||||
set -e
|
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)"
|
HOMEBREW_REPOSITORY="$(brew --repo)"
|
||||||
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"
|
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"
|
||||||
sudo rm -rf "$HOMEBREW_REPOSITORY"
|
sudo rm -rf "$HOMEBREW_REPOSITORY"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user