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
|
SHELL = /bin/sh
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
|
|
||||||
# trunk
|
SWIFT_VERSION = 5.7.1
|
||||||
# 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
|
|
||||||
|
|
||||||
# set EXECUTABLE_DIRECTORY according to your specific environment
|
# set EXECUTABLE_DIRECTORY according to your specific environment
|
||||||
# run swift build and see where the output executable is created
|
# 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.
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
@ -6,7 +6,7 @@ import PackageDescription
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "mas",
|
name: "mas",
|
||||||
platforms: [
|
platforms: [
|
||||||
.macOS(.v10_11)
|
.macOS(.v10_13)
|
||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
// 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"/>
|
<options customize="never" require-scripts="false"/>
|
||||||
<volume-check>
|
<volume-check>
|
||||||
<allowed-os-versions>
|
<allowed-os-versions>
|
||||||
<os-version min="10.11"/>
|
<os-version min="10.13"/>
|
||||||
</allowed-os-versions>
|
</allowed-os-versions>
|
||||||
</volume-check>
|
</volume-check>
|
||||||
<choices-outline>
|
<choices-outline>
|
||||||
|
|
|
@ -41,7 +41,8 @@ sudo port install mas
|
||||||
#### 🍻 Custom Homebrew tap
|
#### 🍻 Custom Homebrew tap
|
||||||
|
|
||||||
We provide a [custom Homebrew tap](https://github.com/mas-cli/homebrew-tap) with pre-built bottles
|
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:
|
To install mas from our tap:
|
||||||
|
|
||||||
|
|
|
@ -14,81 +14,23 @@ private let timeout = 30.0
|
||||||
|
|
||||||
extension ISStoreAccount: StoreAccount {
|
extension ISStoreAccount: StoreAccount {
|
||||||
static var primaryAccount: Promise<ISStoreAccount> {
|
static var primaryAccount: Promise<ISStoreAccount> {
|
||||||
if #available(macOS 10.13, *) {
|
race(
|
||||||
return race(
|
Promise { seal in
|
||||||
Promise { seal in
|
ISServiceProxy.genericShared().accountService
|
||||||
ISServiceProxy.genericShared().accountService
|
.primaryAccount { storeAccount in
|
||||||
.primaryAccount { storeAccount in
|
seal.fulfill(storeAccount)
|
||||||
seal.fulfill(storeAccount)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
after(seconds: timeout)
|
|
||||||
.then {
|
|
||||||
Promise(error: MASError.notSignedIn)
|
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
after(seconds: timeout)
|
||||||
|
.then {
|
||||||
return .value(CKAccountStore.shared().primaryAccount)
|
Promise(error: MASError.notSignedIn)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func signIn(appleID: String, password: String, systemDialog: Bool) -> Promise<ISStoreAccount> {
|
static func signIn(appleID _: String, password _: String, systemDialog _: Bool) -> Promise<ISStoreAccount> {
|
||||||
// swift-format-ignore: UseEarlyExits
|
// Signing in is no longer possible as of High Sierra.
|
||||||
if #available(macOS 10.13, *) {
|
// https://github.com/mas-cli/mas/issues/164
|
||||||
// Signing in is no longer possible as of High Sierra.
|
Promise(error: MASError.notSupported)
|
||||||
// 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))
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,7 @@ extension MAS {
|
||||||
|
|
||||||
/// Runs the command.
|
/// Runs the command.
|
||||||
func run() throws {
|
func run() throws {
|
||||||
if #available(macOS 10.13, *) {
|
ISServiceProxy.genericShared().accountService.signOut()
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,15 +56,8 @@ extension ExternalCommand {
|
||||||
process.standardOutput = stdoutPipe
|
process.standardOutput = stdoutPipe
|
||||||
process.standardError = stderrPipe
|
process.standardError = stderrPipe
|
||||||
process.arguments = arguments
|
process.arguments = arguments
|
||||||
|
process.executableURL = URL(fileURLWithPath: binaryPath)
|
||||||
if #available(macOS 10.13, *) {
|
try process.run()
|
||||||
process.executableURL = URL(fileURLWithPath: binaryPath)
|
|
||||||
try process.run()
|
|
||||||
} else {
|
|
||||||
process.launchPath = binaryPath
|
|
||||||
process.launch()
|
|
||||||
}
|
|
||||||
|
|
||||||
process.waitUntilExit()
|
process.waitUntilExit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class SignInSpec: QuickSpec {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
MAS.initialize()
|
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") {
|
describe("signin command") {
|
||||||
it("signs in") {
|
it("signs in") {
|
||||||
expect {
|
expect {
|
||||||
|
|
|
@ -17,8 +17,8 @@ BOTTLE_DIR="$BUILD_DIR/bottles"
|
||||||
VERSION=$(script/version)
|
VERSION=$(script/version)
|
||||||
ROOT_URL="https://github.com/mas-cli/mas/releases/download/v${VERSION}"
|
ROOT_URL="https://github.com/mas-cli/mas/releases/download/v${VERSION}"
|
||||||
|
|
||||||
# Supports macOS 10.11 and later
|
# Supports macOS 10.13 and later
|
||||||
OS_NAMES=(arm64_monterey monterey arm64_big_sur big_sur catalina mojave high_sierra sierra el_capitan)
|
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
|
# 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'))"
|
IFS=" " read -r -a CURRENT_OS_VERSION <<<"$(sw_vers -productVersion | sed 's/\./ /g'))"
|
||||||
|
|
Loading…
Reference in a new issue