diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 6805623..4ff503c 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -38,7 +38,7 @@ jobs: steps: # https://github.com/actions/checkout#usage - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: # A fetch-depth of 0 includes all history and tags for script/version fetch-depth: 0 diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index cece6df..cc6838d 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -7,7 +7,7 @@ jobs: name: Danger runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Danger # https://github.com/orgs/danger/packages/container/package/danger-swift uses: docker://ghcr.io/danger/danger-swift:3.12.3 diff --git a/.swift-version b/.swift-version index 84197c8..b7c7542 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -5.3.2 +5.6.1 diff --git a/Brewfile.lock.json b/Brewfile.lock.json index 3548ed2..093e70e 100644 --- a/Brewfile.lock.json +++ b/Brewfile.lock.json @@ -2,15 +2,15 @@ "entries": { "brew": { "markdownlint-cli": { - "version": "0.30.0", + "version": "0.31.1", "bottle": { "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { "all": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/markdownlint-cli/blobs/sha256:8ada1bd40ab7ddd6566099ef74f8930ef1d8c4ce526e3f4d2619cfbd7e3651a4", - "sha256": "8ada1bd40ab7ddd6566099ef74f8930ef1d8c4ce526e3f4d2619cfbd7e3651a4" + "url": "https://ghcr.io/v2/homebrew/core/markdownlint-cli/blobs/sha256:26519a6a4330fd29cd897e61f8af2070def21758b06517c136690a5404d07d5a", + "sha256": "26519a6a4330fd29cd897e61f8af2070def21758b06517c136690a5404d07d5a" } } } @@ -55,74 +55,74 @@ } }, "shfmt": { - "version": "3.4.2", + "version": "3.5.1", "bottle": { "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { "arm64_monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:3d16adb18028a2bf572104d383a081d513ec3c608e2ea9dfd44fccf20c1e7b0f", - "sha256": "3d16adb18028a2bf572104d383a081d513ec3c608e2ea9dfd44fccf20c1e7b0f" + "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:633116b598a60ad576a79753208e13388f6a2460139c8aca44e5a25befdb017c", + "sha256": "633116b598a60ad576a79753208e13388f6a2460139c8aca44e5a25befdb017c" }, "arm64_big_sur": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:3eaff57d43b2b12b276a866e693fc76597091b6580b484cb27beb0f5b7a30f43", - "sha256": "3eaff57d43b2b12b276a866e693fc76597091b6580b484cb27beb0f5b7a30f43" + "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:1b0653c0a44f7db5e78c5c6d67de534a52c4f588fb65e3acbb8211d06b871bd9", + "sha256": "1b0653c0a44f7db5e78c5c6d67de534a52c4f588fb65e3acbb8211d06b871bd9" }, "monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:b4508d0a67b4a5802fa2cb9875687ec933c2369395521b23b89faf4e7eb53cad", - "sha256": "b4508d0a67b4a5802fa2cb9875687ec933c2369395521b23b89faf4e7eb53cad" + "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:e7168603f81cf1357c2460c5c476fa66bf5421183d4dedeafe9cf38550fe8855", + "sha256": "e7168603f81cf1357c2460c5c476fa66bf5421183d4dedeafe9cf38550fe8855" }, "big_sur": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:b6765390c7387bb16bfa4fb63bb75bedf346bd2f42e70b2042c88230e668bd70", - "sha256": "b6765390c7387bb16bfa4fb63bb75bedf346bd2f42e70b2042c88230e668bd70" + "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:0e0683566d83cceecd4d02596e3c899a640918ff067b6e15e10f8aee424f1759", + "sha256": "0e0683566d83cceecd4d02596e3c899a640918ff067b6e15e10f8aee424f1759" }, "catalina": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:ab7bb4cf991a41eecda3fca4bef473dd711a62b89d906f3861515b8ec1386c98", - "sha256": "ab7bb4cf991a41eecda3fca4bef473dd711a62b89d906f3861515b8ec1386c98" + "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:4fabb118ba0da244f2b0ffe280b28e343712fac23e738ddf1db29fad68526d73", + "sha256": "4fabb118ba0da244f2b0ffe280b28e343712fac23e738ddf1db29fad68526d73" }, "x86_64_linux": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:8ed1ad0c691990dd7bc6bc1665f5c47f6815b73ad28e7d97bce07af69b28f962", - "sha256": "8ed1ad0c691990dd7bc6bc1665f5c47f6815b73ad28e7d97bce07af69b28f962" + "url": "https://ghcr.io/v2/homebrew/core/shfmt/blobs/sha256:faa60f70812132e10f94477676499a1e2bacb0d06fbe437e8480a997695c2203", + "sha256": "faa60f70812132e10f94477676499a1e2bacb0d06fbe437e8480a997695c2203" } } } }, "swiftformat": { - "version": "0.49.1", + "version": "0.49.9", "bottle": { "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { "arm64_monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:c43caffb4d2cf9546b0a8fa732ffe5d95b1b1fd7ab03f1c5da39c8e7a0e8ecb4", - "sha256": "c43caffb4d2cf9546b0a8fa732ffe5d95b1b1fd7ab03f1c5da39c8e7a0e8ecb4" + "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:bacd0dc8f488fd7909252467eaf16dcd339468857aea13a3643f7e0efd7715f8", + "sha256": "bacd0dc8f488fd7909252467eaf16dcd339468857aea13a3643f7e0efd7715f8" }, "arm64_big_sur": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:ad0ce5fc15fe1d339d366ece18694fdc1d14021684462a126ed20b537a1a9bf5", - "sha256": "ad0ce5fc15fe1d339d366ece18694fdc1d14021684462a126ed20b537a1a9bf5" + "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:7bc39a57d110f727993aa556cca5cba5549d536367bc12f25b56e25c4fdfa194", + "sha256": "7bc39a57d110f727993aa556cca5cba5549d536367bc12f25b56e25c4fdfa194" }, "monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:33652b8015d31dbe45e00bdc598f1b228cb63c7083b90137fdec66318a88010f", - "sha256": "33652b8015d31dbe45e00bdc598f1b228cb63c7083b90137fdec66318a88010f" + "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:739d230372dd797d5cf5a0586156068ecb5965878550a67b5ca56ccdf2799557", + "sha256": "739d230372dd797d5cf5a0586156068ecb5965878550a67b5ca56ccdf2799557" }, "big_sur": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:f0ad88e5594a6a3e5a35834a9a22473a05511375942dbb046d1085cc537d60b8", - "sha256": "f0ad88e5594a6a3e5a35834a9a22473a05511375942dbb046d1085cc537d60b8" + "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:22080bdc75b03f5926d68fb248fc401d6a94876205ce03663a8950644b0e41e6", + "sha256": "22080bdc75b03f5926d68fb248fc401d6a94876205ce03663a8950644b0e41e6" }, "catalina": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:564f5daf9cd82407843aed590bd4190f3e5aaa73a30b3bc8ae07135f1319ac97", - "sha256": "564f5daf9cd82407843aed590bd4190f3e5aaa73a30b3bc8ae07135f1319ac97" + "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:d4cda88cf3bef7b18e960197b8db4826f234e3b3434ba902c3924c37b9040fe8", + "sha256": "d4cda88cf3bef7b18e960197b8db4826f234e3b3434ba902c3924c37b9040fe8" } } } @@ -130,12 +130,12 @@ }, "tap": { "peripheryapp/periphery": { - "revision": "3b6699d53841e642169dc64e1acef1397806a081" + "revision": "020a0b79994d454dbc8dbd886009137fd741b836" } }, "cask": { "periphery": { - "version": "2.8.3", + "version": "2.9.0", "options": { "full_name": "periphery" } @@ -145,12 +145,12 @@ "system": { "macos": { "monterey": { - "HOMEBREW_VERSION": "3.3.9-36-ge970bb1", + "HOMEBREW_VERSION": "3.5.3-75-g39c9e2d", "HOMEBREW_PREFIX": "/opt/homebrew", - "Homebrew/homebrew-core": "f2b69fcaf6cf9925caac56dad26d39d30e89b42c", - "CLT": "13.2.0.0.1.1638488800", - "Xcode": "13.2.1", - "macOS": "12.1" + "Homebrew/homebrew-core": "00e5383db36fddc6b26df896229289b42462e63e", + "CLT": "13.4.0.0.1.1651278267", + "Xcode": "13.4.1", + "macOS": "12.4" } } } diff --git a/Makefile b/Makefile index b5088bc..2c739ba 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ # mas # - ################################################################################ # # Variables @@ -19,7 +18,7 @@ PREFIX ?= /usr/local # Swift 5.3 # SWIFT_VERSION = swift-5.3-DEVELOPMENT-SNAPSHOT-2020-04-21-a -SWIFT_VERSION = 5.3.2 +SWIFT_VERSION = 5.6.1 # set EXECUTABLE_DIRECTORY according to your specific environment # run swift build and see where the output executable is created @@ -33,46 +32,60 @@ PLATFORM = $(ARCH)-apple-macosx EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug endif +################################################################################ +# +# Help +# + +.DEFAULT_GOAL := help + +.PHONY: help +help: MAKEFILE_FMT = " \033[36m%-25s\033[0m%s\n" +help: ## (default) Displays this message + @echo "Ditto main Makefile." + @echo "" + @echo "Targets:" + @grep -E '^[a-zA-Z0-9_-]*:.*?##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##"}; {printf $(MAKEFILE_FMT), $$1, $$2}' + @echo "" + @echo "Parameters:" + @grep -E '^[A-Z0-9_-]* ?\?=.*?##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = " ?\\?=.*?##"}; {printf $(MAKEFILE_FMT), $$1, $$2}' +: # Hacky way to display a newline ## ################################################################################ # # Targets # -# Prints versions of tools used by this Makefile. .PHONY: version -version: +version: ## Prints versions of tools used by this Makefile. xcodebuild -version swiftenv version swift --version swift package tools-version .PHONY: init -init: +init: ## Installs tools. - swiftenv install $(SWIFT_VERSION) swiftenv local $(SWIFT_VERSION) .PHONY: bootstrap -bootstrap: +bootstrap: ## Installs tools. script/bootstrap .PHONY: clean -clean: +clean: ## Cleans built products. script/clean -.PHONY: distclean -distclean: clean - .PHONY: updateHeaders -updateHeaders: +updateHeaders: ## Updates private headers. script/update_headers .PHONY: build -build: +build: ## Builds the project. script/build .PHONY: test -test: build +test: build ## Runs tests. script/test # make run ARGS="asdf" @@ -81,54 +94,53 @@ run: build ${EXECUTABLE_DIRECTORY}/${CMD_NAME} $(ARGS) .PHONY: install -install: +install: ## Installs the project. script/install $(PREFIX) .PHONY: uninstall -uninstall: +uninstall: ## Uninstalls the project. script/uninstall .PHONY: format -format: +format: ## Formats source code. script/format .PHONY: lint -lint: +lint: ## Lints source code. script/lint .PHONY: danger -danger: +danger: ## Runs danger. script/danger # Builds bottles .PHONY: bottles -bottles: +bottles: ## Builds bottles. script/bottle -# Alias for bottles .PHONY: bottle -bottle: bottles +bottle: bottles ## Alias for bottles .PHONY: package -package: +package: build ## Packages the project. script/package .PHONY: packageInstall -packageInstall: +packageInstall: package ## Installs the package. script/package_install .PHONY: describe -describe: +describe: ## Describes the Swift package. swift package describe .PHONY: resolve -resolve: +resolve: ## Resolves SwiftPM dependencies. swift package resolve .PHONY: dependencies -dependencies: resolve +dependencies: resolve ## Lists SwiftPM dependencies. swift package show-dependencies .PHONY: update -update: resolve +update: resolve ## Updates SwiftPM dependencies. swift package update diff --git a/Package.resolved b/Package.resolved index bea10ba..ef2401b 100644 --- a/Package.resolved +++ b/Package.resolved @@ -60,16 +60,16 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser.git", "state": { "branch": null, - "revision": "e1465042f195f374b94f915ba8ca49de24300a0d", - "version": "1.0.2" + "revision": "df9ee6676cd5b3bf5b330ec7568a5644f547201b", + "version": "1.1.3" } }, { "package": "swift-format", "repositoryURL": "https://github.com/apple/swift-format", "state": { - "branch": "swift-5.5-branch", - "revision": "f872223e16742fd97fabd319fbf4a939230cc796", + "branch": "release/5.6", + "revision": "e6b8c60c7671066d229e30efa1e31acf57be412e", "version": null } }, @@ -78,8 +78,26 @@ "repositoryURL": "https://github.com/apple/swift-syntax", "state": { "branch": null, - "revision": "75e60475d9d8fd5bbc16a12e0eaa2cb01b0c322e", - "version": "0.50500.0" + "revision": "0b6c22b97f8e9320bca62e82cdbee601cf37ad3f", + "version": "0.50600.1" + } + }, + { + "package": "swift-system", + "repositoryURL": "https://github.com/apple/swift-system.git", + "state": { + "branch": null, + "revision": "836bc4557b74fe6d2660218d56e3ce96aff76574", + "version": "1.1.1" + } + }, + { + "package": "swift-tools-support-core", + "repositoryURL": "https://github.com/apple/swift-tools-support-core.git", + "state": { + "branch": null, + "revision": "b7667f3e266af621e5cc9c77e74cacd8e8c00cb4", + "version": "0.2.5" } }, { diff --git a/Package.swift b/Package.swift index 404a534..2918211 100644 --- a/Package.swift +++ b/Package.swift @@ -70,7 +70,12 @@ let package = Package( swiftLanguageVersions: [.v5] ) -#if compiler(>=5.5) +// https://github.com/apple/swift-format#matching-swift-format-to-your-swift-version +#if compiler(>=5.6) + package.dependencies += [ + .package(url: "https://github.com/apple/swift-format", .branch("release/5.6")) + ] +#elseif compiler(>=5.5) package.dependencies += [ .package(url: "https://github.com/apple/swift-format", .branch("swift-5.5-branch")) ] diff --git a/README.md b/README.md index e2f1d2c..196d1fc 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ apps, and is not yet able to install or update them. [#321](https://github.com/m If you see this error, it's probably because you haven't installed the app through the App Store yet. See [#46](https://github.com/mas-cli/mas/issues/46#issuecomment-248581233). -> This redownload is not available for this Apple ID either because it was bought by a different user of the +> This redownload is not available for this Apple ID either because it was bought by a different user or the > item was refunded or cancelled. If `mas` doesn't work for you as expected (e.g. you can't update/download apps), run `mas reset` and try again. diff --git a/Sources/MasKit/AppStore/Downloader.swift b/Sources/MasKit/AppStore/Downloader.swift index 2b5ab14..650229d 100644 --- a/Sources/MasKit/AppStore/Downloader.swift +++ b/Sources/MasKit/AppStore/Downloader.swift @@ -64,11 +64,10 @@ private func downloadWithRetries( /// - Returns: A promise the completes when the download is complete. private func download(_ appID: UInt64, purchase: Bool = false) -> Promise { var storeAccount: ISStoreAccount? - if #available(macOS 12, *) { + if #unavailable(macOS 12) { // Monterey obscured the user's account information, but still allows // redownloads without passing it to SSPurchase. // https://github.com/mas-cli/mas/issues/417 - } else { guard let account = ISStoreAccount.primaryAccount else { return Promise(error: MASError.notSignedIn) } diff --git a/script/install b/script/install index 7bb2379..1b72f39 100755 --- a/script/install +++ b/script/install @@ -23,7 +23,7 @@ fi while test -n "$1"; do if [[ "$1" == '--universal' ]]; then ARCH=universal - RELEASE=.build/apple/Products/Release + RELEASE=.build/release else # Override default prefix path with optional arg PREFIX="$1"