From d3a2d2b7611e573433f5ab67b5b7a7e107c73e04 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 3 May 2021 22:31:18 -0600 Subject: [PATCH 01/11] =?UTF-8?q?=E2=9E=95=20Add=20markdownlint=20to=20bre?= =?UTF-8?q?w=20lock=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Brewfile.lock.json | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/Brewfile.lock.json b/Brewfile.lock.json index 8d0927dc3..95d1140a2 100644 --- a/Brewfile.lock.json +++ b/Brewfile.lock.json @@ -1,6 +1,35 @@ { "entries": { "brew": { + "markdownlint-cli": { + "version": "0.27.1", + "bottle": { + "rebuild": 0, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "arm64_big_sur": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/markdownlint-cli/blobs/sha256:ed9779fa2a2cc0141debd2c61501681dcd2c78741ee47ea90726e65f52515d81", + "sha256": "ed9779fa2a2cc0141debd2c61501681dcd2c78741ee47ea90726e65f52515d81" + }, + "big_sur": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/markdownlint-cli/blobs/sha256:d6454296ad369bb59d89724a04b36374946d5880eaaefc9690f617f5a74ff310", + "sha256": "d6454296ad369bb59d89724a04b36374946d5880eaaefc9690f617f5a74ff310" + }, + "catalina": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/markdownlint-cli/blobs/sha256:b005b2342165d9c7dbd528d57659fa4bbe6615c2fc6f7ea87fbec39cdb7857a5", + "sha256": "b005b2342165d9c7dbd528d57659fa4bbe6615c2fc6f7ea87fbec39cdb7857a5" + }, + "mojave": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/markdownlint-cli/blobs/sha256:802003979b630f36bfce119b8cd8a05ce34a006e19d94bbceb2040944167233b", + "sha256": "802003979b630f36bfce119b8cd8a05ce34a006e19d94bbceb2040944167233b" + } + } + } + }, "shfmt": { "version": "3.2.4", "bottle": { @@ -97,12 +126,12 @@ "system": { "macos": { "big_sur": { - "HOMEBREW_VERSION": "3.1.3-107-g1157a97", + "HOMEBREW_VERSION": "3.1.5", "HOMEBREW_PREFIX": "/opt/homebrew", - "Homebrew/homebrew-core": "1da7ce26f5cfa33eec131571755152680a5321b7", + "Homebrew/homebrew-core": "e6c5a215e70e758472a62b1ff0a1ecdf94facc61", "CLT": "12.5.0.0.1.1617976050", "Xcode": "12.5", - "macOS": "11.3" + "macOS": "11.3.1" } } } From cec804279e7cce3fdf849caa5b450a5152f8a763 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 3 May 2021 22:33:28 -0600 Subject: [PATCH 02/11] =?UTF-8?q?=F0=9F=93=9C=20Conditionally=20install=20?= =?UTF-8?q?swiftlint=20when=20not=20running=20on=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/bootstrap | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/script/bootstrap b/script/bootstrap index d4e3aec27..5fdfa8b8c 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -18,6 +18,13 @@ main() { rm -f Brewfile.lock.json brew bundle install --no-upgrade --verbose + if [[ "CI" != "true" ]]; then + # Already installed on GitHub Actions runner. + if ! command -v swiftlint >/dev/null; then + brew install swiftlint + fi + fi + # Generate Package.swift script/version } From bc7c3325153ae14a27a03ea8d93a5434197b7c42 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 6 May 2021 22:17:57 -0600 Subject: [PATCH 03/11] =?UTF-8?q?=F0=9F=91=BD=20Update=20core=20formula=20?= =?UTF-8?q?path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit brew 3 --- script/brew_formula_update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/brew_formula_update b/script/brew_formula_update index dd4db2ba3..43274067a 100755 --- a/script/brew_formula_update +++ b/script/brew_formula_update @@ -9,7 +9,7 @@ # brew bump-formula-pr --help # -BREW_CORE_PATH="$(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula" +BREW_CORE_PATH="$(brew --prefix)/Library/Taps/homebrew/homebrew-core/Formula" function usage { echo "Usage: brew_formula_bump [v1.0] [sha1_hash]" From e1dbc653e5650a8a354576e82d1aac9557d7b57d Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 6 May 2021 22:19:11 -0600 Subject: [PATCH 04/11] =?UTF-8?q?=F0=9F=8F=9D=20Build=20args=20for=20brew?= =?UTF-8?q?=20sandbox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #363 --- script/build | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/script/build b/script/build index 702c77dfc..d5cb5c808 100755 --- a/script/build +++ b/script/build @@ -6,8 +6,10 @@ # Builds the Swift Package. # -script/clean -script/lint - echo "==> 🏗️ Building mas ($(script/version))" -swift build --configuration release --arch arm64 --arch x86_64 +swift build \ + --configuration release \ + --arch arm64 \ + --arch x86_64 \ + --disable-sandbox \ + --manifest-cache none From c0c01251f1d282571a376a4e78d13877dcf81b27 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Thu, 6 May 2021 22:19:37 -0600 Subject: [PATCH 05/11] =?UTF-8?q?=F0=9F=8D=BA=20Update=20formula=20for=201?= =?UTF-8?q?.8.2=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Homebrew/mas-tap.rb | 7 ++++--- Homebrew/mas.rb | 13 +++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Homebrew/mas-tap.rb b/Homebrew/mas-tap.rb index 6678ee52d..1ed149f51 100644 --- a/Homebrew/mas-tap.rb +++ b/Homebrew/mas-tap.rb @@ -2,8 +2,8 @@ class Mas < Formula desc "Mac App Store command-line interface" homepage "https://github.com/mas-cli/mas" url "https://github.com/mas-cli/mas.git", - tag: "v1.8.1", - revision: "23a36b4555f5625fe29915b31b8b101064452dca" + tag: "v1.8.2", + revision: "c88a98892e52a0ad8527a532aaa5dd1a2dd19635" license "MIT" head "https://github.com/mas-cli/mas.git" @@ -26,6 +26,7 @@ class Mas < Formula end def install + system "script/build" system "script/install", prefix bash_completion.install "contrib/completion/mas-completion.bash" => "mas" @@ -34,6 +35,6 @@ def install test do assert_equal version.to_s, shell_output("#{bin}/mas version").chomp - assert_include shell_output("#{bin}/mas info 497799835"), "Xcode" + assert_includes shell_output("#{bin}/mas info 497799835"), "Xcode" end end diff --git a/Homebrew/mas.rb b/Homebrew/mas.rb index 1aba3a839..811c886ef 100644 --- a/Homebrew/mas.rb +++ b/Homebrew/mas.rb @@ -2,15 +2,15 @@ class Mas < Formula desc "Mac App Store command-line interface" homepage "https://github.com/mas-cli/mas" url "https://github.com/mas-cli/mas.git", - tag: "v1.8.1", - revision: "23a36b4555f5625fe29915b31b8b101064452dca" + tag: "v1.8.2", + revision: "c88a98892e52a0ad8527a532aaa5dd1a2dd19635" license "MIT" head "https://github.com/mas-cli/mas.git" bottle do - sha256 cellar: :any, arm64_big_sur: "ef2ed904d1283722af006811471484cb1c9c73b255a766b5c0c65ecd1654c8d8" - sha256 cellar: :any, big_sur: "dc98d69cfa94467e046b443c088a6097fe0ce0d2935e37046815fa3a984a0ca4" - sha256 cellar: :any, catalina: "2e7ffedf674543f98c2b95868b6a23db208cb2e6a3ec1ddbb3553ddab0cf9a68" + sha256 cellar: :any, arm64_big_sur: "f5ef4f44057f43ecc14f970687d832bd152bc6142c0ad848977f0a6527aa934f" + sha256 cellar: :any, big_sur: "d92cfc734e730fde87b29c6bf4a50ce63a78b9e505f464dc557eee128aa06d05" + sha256 cellar: :any, catalina: "163eb9cfdfed3d8fbda133b4079d104ad687f1ddb71d70d5661d02b22f562e76" end depends_on :macos @@ -21,6 +21,7 @@ class Mas < Formula end def install + system "script/build" system "script/install", prefix bash_completion.install "contrib/completion/mas-completion.bash" => "mas" @@ -29,6 +30,6 @@ def install test do assert_equal version.to_s, shell_output("#{bin}/mas version").chomp - assert_include shell_output("#{bin}/mas info 497799835"), "Xcode" + assert_includes shell_output("#{bin}/mas info 497799835"), "Xcode" end end From 3e88d286227df07ddbe0551c4dbaf27b2c0f4ff6 Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Fri, 7 May 2021 11:32:32 -0700 Subject: [PATCH 06/11] =?UTF-8?q?=F0=9F=97=91=20Remove=20mas.zip=20archive?= =?UTF-8?q?=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/archive | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100755 script/archive diff --git a/script/archive b/script/archive deleted file mode 100755 index 1f405726b..000000000 --- a/script/archive +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -e -# -# script/archive -# mas -# -# Compresses artifacts so the can be archived more easily. -# - -echo "==> 🗜️ Compressing mas" -zip .build/mas.zip .build/apple/Products/Release/mas - -echo "==> 🔢 File Hash" -shasum -a 256 .build/mas.zip From c177fa79a1156055736f09c8e2d587ba4e9f03f6 Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Fri, 7 May 2021 11:33:39 -0700 Subject: [PATCH 07/11] =?UTF-8?q?=F0=9F=9B=A0=20Make=20--universal=20a=20b?= =?UTF-8?q?uild=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/build | 17 ++++++++++++++--- script/build_artifacts | 3 +-- script/install | 21 ++++++++++++++++----- script/package | 2 +- script/uninstall | 2 +- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/script/build b/script/build index d5cb5c808..46d4dd5d4 100755 --- a/script/build +++ b/script/build @@ -6,10 +6,21 @@ # Builds the Swift Package. # +# Build for the host architecture by default. +ARCH= +if [[ "$1" == '--universal' ]]; then + ARCH='--arch arm64 --arch x86_64' +fi + +# Disable the manifest cache on Xcode 12.5 and later. +CACHE= +if [[ "$(swift build --help)" =~ manifest-cache ]]; then + CACHE='--manifest-cache none' +fi + echo "==> 🏗️ Building mas ($(script/version))" swift build \ --configuration release \ - --arch arm64 \ - --arch x86_64 \ + ${ARCH} \ --disable-sandbox \ - --manifest-cache none + ${CACHE} diff --git a/script/build_artifacts b/script/build_artifacts index a3b3a10da..30d384b08 100755 --- a/script/build_artifacts +++ b/script/build_artifacts @@ -11,6 +11,5 @@ VERSION=$(script/version) echo "Building mas $VERSION artifacts" script/clean -script/build -script/archive +script/build --universal script/package diff --git a/script/install b/script/install index 20c4466d6..7bb2379db 100755 --- a/script/install +++ b/script/install @@ -10,18 +10,29 @@ # https://github.com/Homebrew/homebrew-core/blob/master/Formula/mas.rb # +ARCH=$(uname -m) +RELEASE=.build/${ARCH}-apple-macosx/release VERSION=$(script/version) -# Override default prefix path with optional 1st arg -if test -n "$1"; then - PREFIX="$1" -elif [[ $(uname -m) == 'arm64' ]]; then +if [[ $(uname -m) == 'arm64' ]]; then PREFIX=/opt/homebrew else PREFIX=/usr/local fi +while test -n "$1"; do + if [[ "$1" == '--universal' ]]; then + ARCH=universal + RELEASE=.build/apple/Products/Release + else + # Override default prefix path with optional arg + PREFIX="$1" + fi + + shift +done + echo "==> 📲 Installing mas ($VERSION) for $ARCH to $PREFIX" ditto -v \ - ".build/apple/Products/Release/mas" \ + "$RELEASE/mas" \ "$PREFIX/bin/" diff --git a/script/package b/script/package index 526c2c410..686647c05 100755 --- a/script/package +++ b/script/package @@ -18,7 +18,7 @@ DISTRIBUTION_PLIST="Package/Distribution.plist" # Destination for install root DSTROOT=.build/distributions -script/install "$DSTROOT/usr/local" +script/install "$DSTROOT/usr/local" --universal VERSION=$(script/version) diff --git a/script/uninstall b/script/uninstall index 853e35bfb..8e2af57fc 100755 --- a/script/uninstall +++ b/script/uninstall @@ -3,7 +3,7 @@ # script/uninstall # mas # -# Removes mas and MasKit from PREFIX. +# Removes mas from PREFIX. # # Override default prefix path with optional 1st arg From 10b92cc639a8009910217f8507a5644fe34238b8 Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Fri, 7 May 2021 11:38:36 -0700 Subject: [PATCH 08/11] =?UTF-8?q?=E2=9C=A8=20Clean=20with=20SPM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/clean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/clean b/script/clean index 19b95d0b5..ded54c5be 100755 --- a/script/clean +++ b/script/clean @@ -6,5 +6,5 @@ # Deletes the build directory. # -BUILD_DIR=.build -rm -rf ${BUILD_DIR:?} +swift package clean +swift package reset From 24859bb1df86a26f4915510e5e859b187b6414ce Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Fri, 7 May 2021 11:39:13 -0700 Subject: [PATCH 09/11] =?UTF-8?q?=F0=9F=9B=A0=20Update=20Makefile=20for=20?= =?UTF-8?q?SPM=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 73 +++++++++++++++++--------------------------------------- 1 file changed, 22 insertions(+), 51 deletions(-) diff --git a/Makefile b/Makefile index a12208623..1370e549a 100644 --- a/Makefile +++ b/Makefile @@ -26,17 +26,13 @@ SWIFT_VERSION = 5.3.2 # OS specific differences UNAME = ${shell uname} +ARCH = ${shell uname -m} ifeq ($(UNAME), Darwin) -SWIFTC_FLAGS = -LINKER_FLAGS = -Xlinker -L/usr/local/lib -PLATFORM = x86_64-apple-macosx +PLATFORM = $(ARCH)-apple-macosx EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug -TEST_BUNDLE = ${CMD_NAME}PackageTests.xctest -TEST_RESOURCES_DIRECTORY = ./.build/${PLATFORM}/debug/${TEST_BUNDLE}/Contents/Resources endif -RUN_RESOURCES_DIRECTORY = ${EXECUTABLE_DIRECTORY} ################################################################################ # @@ -49,7 +45,7 @@ version: xcodebuild -version swiftenv version swift --version - # swift package tools-version + swift package tools-version .PHONY: init init: @@ -63,38 +59,21 @@ bootstrap: .PHONY: clean clean: script/clean - xcodebuild clean - # swift package clean - # swift package reset .PHONY: distclean -distclean: - rm -rf Packages - # swift package clean +distclean: clean .PHONY: updateHeaders updateHeaders: script/update_headers .PHONY: build -build: #copyRunResources +build: script/build - # swift build $(SWIFTC_FLAGS) $(LINKER_FLAGS) .PHONY: test -test: build #copyTestResources +test: build script/test - # swift test --enable-test-discovery - -.PHONY: copyRunResources -copyRunResources: - mkdir -p ${RUN_RESOURCES_DIRECTORY} - cp -r Resources/* ${RUN_RESOURCES_DIRECTORY} - -.PHONY: copyTestResources -copyTestResources: - mkdir -p ${TEST_RESOURCES_DIRECTORY} - cp -r Resources/* ${TEST_RESOURCES_DIRECTORY} # make run ARGS="asdf" .PHONY: run @@ -109,6 +88,10 @@ install: uninstall: script/uninstall +.PHONY: format +lint: + script/format + .PHONY: lint lint: script/lint @@ -117,10 +100,6 @@ lint: danger: script/danger -.PHONY: archive -archive: - script/archive - # Builds bottles .PHONY: bottles bottles: @@ -138,26 +117,18 @@ package: packageInstall: script/package_install -.PHONY: release -release: - script/release - -# .PHONY: describe -# describe: -# swift package describe - -# .PHONY: resolve -# resolve: -# swift package resolve +.PHONY: describe +describe: + swift package describe -# .PHONY: dependencies -# dependencies: resolve -# swift package show-dependencies +.PHONY: resolve +resolve: + swift package resolve -# .PHONY: update -# update: resolve -# swift package update +.PHONY: dependencies +dependencies: resolve + swift package show-dependencies -# .PHONY: xcproj -# xcproj: -# swift package generate-xcodeproj +.PHONY: update +update: resolve + swift package update From 68b860f8c4de487943340920c088df570c0c571d Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Fri, 7 May 2021 11:43:49 -0700 Subject: [PATCH 10/11] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20path=20to=20Package.?= =?UTF-8?q?Version=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dangerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dangerfile b/Dangerfile index 274fc0196..41045fc56 100644 --- a/Dangerfile +++ b/Dangerfile @@ -13,7 +13,7 @@ has_test_changes = !git.modified_files.grep(/Tests/).empty? is_version_bump = git.modified_files.sort == [ "Package.swift", - "MasKit/SupportingFiles/Package.swift" + "MasKit/Package.swift" ].sort message(":bookmark: Version bump!") if is_version_bump From 7f0af9c53e53e789d16eb914bfa48995ecd5d02c Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Fri, 7 May 2021 13:50:20 -0700 Subject: [PATCH 11/11] =?UTF-8?q?=F0=9F=8D=BA=20Bottle=20universal=20binar?= =?UTF-8?q?y=20for=20custom=20tap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Homebrew/mas-tap.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Homebrew/mas-tap.rb b/Homebrew/mas-tap.rb index 1ed149f51..a36721ce2 100644 --- a/Homebrew/mas-tap.rb +++ b/Homebrew/mas-tap.rb @@ -26,8 +26,8 @@ class Mas < Formula end def install - system "script/build" - system "script/install", prefix + system "script/build", "--universal" + system "script/install", "--universal", prefix bash_completion.install "contrib/completion/mas-completion.bash" => "mas" fish_completion.install "contrib/completion/mas.fish"