mirror of
https://github.com/mas-cli/mas
synced 2024-11-21 19:23:01 +00:00
Merge pull request #611 from rgoldberg/578-minimum-macos-10.13
Increase minimum macOS version to 10.13 & upgrade Swift to 5.7.1
This commit is contained in:
commit
86f916d4b5
10 changed files with 28 additions and 104 deletions
|
@ -1 +1 @@
|
|||
5.7
|
||||
5.7.1
|
||||
|
|
8
Makefile
8
Makefile
|
@ -12,13 +12,7 @@ CMD_NAME = mas
|
|||
SHELL = /bin/sh
|
||||
PREFIX ?= /usr/local
|
||||
|
||||
# trunk
|
||||
# SWIFT_VERSION = swift-DEVELOPMENT-SNAPSHOT-2020-04-23-a
|
||||
|
||||
# Swift 5.3
|
||||
# SWIFT_VERSION = swift-5.3-DEVELOPMENT-SNAPSHOT-2020-04-21-a
|
||||
|
||||
SWIFT_VERSION = 5.7
|
||||
SWIFT_VERSION = 5.7.1
|
||||
|
||||
# set EXECUTABLE_DIRECTORY according to your specific environment
|
||||
# run swift build and see where the output executable is created
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// swift-tools-version:5.6.1
|
||||
// swift-tools-version:5.7.1
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
@ -6,7 +6,7 @@ import PackageDescription
|
|||
let package = Package(
|
||||
name: "mas",
|
||||
platforms: [
|
||||
.macOS(.v10_11)
|
||||
.macOS(.v10_13)
|
||||
],
|
||||
products: [
|
||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<options customize="never" require-scripts="false"/>
|
||||
<volume-check>
|
||||
<allowed-os-versions>
|
||||
<os-version min="10.11"/>
|
||||
<os-version min="10.13"/>
|
||||
</allowed-os-versions>
|
||||
</volume-check>
|
||||
<choices-outline>
|
||||
|
|
|
@ -41,7 +41,8 @@ sudo port install mas
|
|||
#### 🍻 Custom Homebrew tap
|
||||
|
||||
We provide a [custom Homebrew tap](https://github.com/mas-cli/homebrew-tap) with pre-built bottles
|
||||
for all macOS versions since 10.11 (El Capitan).
|
||||
for all macOS versions since 10.11 (El Capitan). The newest versions of mas, however, are only available
|
||||
for macOS 10.13+ (High Sierra or newer).
|
||||
|
||||
To install mas from our tap:
|
||||
|
||||
|
|
|
@ -14,81 +14,23 @@ private let timeout = 30.0
|
|||
|
||||
extension ISStoreAccount: StoreAccount {
|
||||
static var primaryAccount: Promise<ISStoreAccount> {
|
||||
if #available(macOS 10.13, *) {
|
||||
return race(
|
||||
Promise { seal in
|
||||
ISServiceProxy.genericShared().accountService
|
||||
.primaryAccount { storeAccount in
|
||||
seal.fulfill(storeAccount)
|
||||
}
|
||||
},
|
||||
after(seconds: timeout)
|
||||
.then {
|
||||
Promise(error: MASError.notSignedIn)
|
||||
race(
|
||||
Promise { seal in
|
||||
ISServiceProxy.genericShared().accountService
|
||||
.primaryAccount { storeAccount in
|
||||
seal.fulfill(storeAccount)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
return .value(CKAccountStore.shared().primaryAccount)
|
||||
},
|
||||
after(seconds: timeout)
|
||||
.then {
|
||||
Promise(error: MASError.notSignedIn)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
static func signIn(appleID: String, password: String, systemDialog: Bool) -> Promise<ISStoreAccount> {
|
||||
// swift-format-ignore: UseEarlyExits
|
||||
if #available(macOS 10.13, *) {
|
||||
// Signing in is no longer possible as of High Sierra.
|
||||
// https://github.com/mas-cli/mas/issues/164
|
||||
return Promise(error: MASError.notSupported)
|
||||
// swiftlint:disable:next superfluous_else
|
||||
} else {
|
||||
return
|
||||
primaryAccount
|
||||
.then { account -> Promise<ISStoreAccount> in
|
||||
if account.isSignedIn {
|
||||
return Promise(error: MASError.alreadySignedIn(asAppleID: account.identifier))
|
||||
}
|
||||
|
||||
let password =
|
||||
password.isEmpty && !systemDialog
|
||||
? String(validatingUTF8: getpass("Password: ")) ?? ""
|
||||
: password
|
||||
|
||||
guard !password.isEmpty || systemDialog else {
|
||||
return Promise(error: MASError.noPasswordProvided)
|
||||
}
|
||||
|
||||
let context = ISAuthenticationContext(accountID: 0)
|
||||
context.appleIDOverride = appleID
|
||||
|
||||
let signInPromise =
|
||||
Promise<ISStoreAccount> { seal in
|
||||
let accountService = ISServiceProxy.genericShared().accountService
|
||||
accountService.setStoreClient(ISStoreClient(storeClientType: 0))
|
||||
accountService.signIn(with: context) { success, storeAccount, error in
|
||||
if success, let storeAccount {
|
||||
seal.fulfill(storeAccount)
|
||||
} else {
|
||||
seal.reject(MASError.signInFailed(error: error as NSError?))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if systemDialog {
|
||||
return signInPromise
|
||||
}
|
||||
|
||||
context.demoMode = true
|
||||
context.demoAccountName = appleID
|
||||
context.demoAccountPassword = password
|
||||
context.demoAutologinMode = true
|
||||
|
||||
return race(
|
||||
signInPromise,
|
||||
after(seconds: timeout)
|
||||
.then {
|
||||
Promise(error: MASError.signInFailed(error: nil))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
static func signIn(appleID _: String, password _: String, systemDialog _: Bool) -> Promise<ISStoreAccount> {
|
||||
// Signing in is no longer possible as of High Sierra.
|
||||
// https://github.com/mas-cli/mas/issues/164
|
||||
Promise(error: MASError.notSupported)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,7 @@ extension MAS {
|
|||
|
||||
/// Runs the command.
|
||||
func run() throws {
|
||||
if #available(macOS 10.13, *) {
|
||||
ISServiceProxy.genericShared().accountService.signOut()
|
||||
} else {
|
||||
// Using CKAccountStore to sign out does nothing on High Sierra
|
||||
// https://github.com/mas-cli/mas/issues/129
|
||||
CKAccountStore.shared().signOut()
|
||||
}
|
||||
ISServiceProxy.genericShared().accountService.signOut()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,15 +56,8 @@ extension ExternalCommand {
|
|||
process.standardOutput = stdoutPipe
|
||||
process.standardError = stderrPipe
|
||||
process.arguments = arguments
|
||||
|
||||
if #available(macOS 10.13, *) {
|
||||
process.executableURL = URL(fileURLWithPath: binaryPath)
|
||||
try process.run()
|
||||
} else {
|
||||
process.launchPath = binaryPath
|
||||
process.launch()
|
||||
}
|
||||
|
||||
process.executableURL = URL(fileURLWithPath: binaryPath)
|
||||
try process.run()
|
||||
process.waitUntilExit()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public class SignInSpec: QuickSpec {
|
|||
beforeSuite {
|
||||
MAS.initialize()
|
||||
}
|
||||
// account command disabled since macOS 10.13 High Sierra https://github.com/mas-cli/mas#known-issues
|
||||
// signin command disabled since macOS 10.13 High Sierra: https://github.com/mas-cli/mas#known-issues
|
||||
describe("signin command") {
|
||||
it("signs in") {
|
||||
expect {
|
||||
|
|
|
@ -17,8 +17,8 @@ BOTTLE_DIR="$BUILD_DIR/bottles"
|
|||
VERSION=$(script/version)
|
||||
ROOT_URL="https://github.com/mas-cli/mas/releases/download/v${VERSION}"
|
||||
|
||||
# Supports macOS 10.11 and later
|
||||
OS_NAMES=(arm64_monterey monterey arm64_big_sur big_sur catalina mojave high_sierra sierra el_capitan)
|
||||
# Supports macOS 10.13 and later
|
||||
OS_NAMES=(arm64_monterey monterey arm64_big_sur big_sur catalina mojave high_sierra)
|
||||
|
||||
# Semantic version number split into a list using Ugly, bash 3 compatible syntax
|
||||
IFS=" " read -r -a CURRENT_OS_VERSION <<<"$(sw_vers -productVersion | sed 's/\./ /g'))"
|
||||
|
|
Loading…
Reference in a new issue