From 07a0f3310db6fb33b50dc24abf5c3da1b1131cb3 Mon Sep 17 00:00:00 2001 From: Majd Alfhaily Date: Sat, 2 Jul 2022 23:59:14 +0200 Subject: [PATCH] Update Makefile (#93) --- .github/workflows/distribute.yml | 38 ++-------------------- .github/workflows/dry-builds.yml | 35 +++----------------- .github/workflows/integration-tests.yml | 2 +- Makefile | 43 ++++++++++++++++++++++--- 4 files changed, 48 insertions(+), 70 deletions(-) diff --git a/.github/workflows/distribute.yml b/.github/workflows/distribute.yml index 8504c3b7..e0a4561c 100644 --- a/.github/workflows/distribute.yml +++ b/.github/workflows/distribute.yml @@ -51,7 +51,7 @@ jobs: - name: Inject version run: ./Scripts/version - name: Build - run: make build + run: make build-macos - name: Upload binary uses: actions/upload-artifact@v2 with: @@ -77,40 +77,8 @@ jobs: run: ./Scripts/version - name: Install dependencies run: brew install xcodegen ldid - - name: Generate Xcode project - run: xcodegen -s ios-project.yml - - name: Build archive - run: | - xcodebuild archive -scheme CLI \ - -sdk iphoneos \ - -configuration Release \ - -derivedDataPath .build \ - -archivePath .build/ipatool.xcarchive \ - CODE_SIGN_IDENTITY='' \ - CODE_SIGNING_REQUIRED=NO \ - CODE_SIGN_ENTITLEMENTS='' \ - CODE_SIGNING_ALLOWED=NO - cp .build/ipatool.xcarchive/Products/Applications/CLI.app/CLI .build/ipatool - - name: Fakesign executable - run: | - cat <"$PWD/.build/entitlements.xml" - - - - keychain-access-groups - - ipatool - - application-identifier - ipatool - platform-application - - com.apple.private.security.container-required - - - - EOF - ldid -S.build/entitlements.xml ./.build/ipatool + - name: Build + run: make build-ios - name: Upload binary uses: actions/upload-artifact@v2 with: diff --git a/.github/workflows/dry-builds.yml b/.github/workflows/dry-builds.yml index a5e3ce6c..4e527ef4 100644 --- a/.github/workflows/dry-builds.yml +++ b/.github/workflows/dry-builds.yml @@ -20,39 +20,14 @@ jobs: restore-keys: | ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }} ${{ runner.os }}-spm- - - name: Inject version - run: ./Scripts/version - name: Install dependencies run: brew install xcodegen ldid - - name: Generate Xcode project - run: xcodegen -s ios-project.yml - - name: Build archive + - name: Inject version + run: ./Scripts/version + - name: Build run: | - xcodebuild archive -scheme CLI \ - -sdk iphoneos \ - -configuration Release \ - -derivedDataPath .build \ - -archivePath .build/ipatool.xcarchive \ - CODE_SIGN_IDENTITY='' \ - CODE_SIGNING_REQUIRED=NO \ - CODE_SIGN_ENTITLEMENTS='' \ - CODE_SIGNING_ALLOWED=NO - cp .build/ipatool.xcarchive/Products/Applications/CLI.app/CLI .build/ipatool + make build-ios file .build/ipatool - - name: Fakesign executable - run: | - cat <"$PWD/.build/entitlements.xml" - - - - platform-application - - com.apple.private.security.container-required - - - - EOF - ldid -S.build/entitlements.xml ./.build/ipatool build_macos: name: Dry build (macOS) runs-on: macos-12 @@ -71,5 +46,5 @@ jobs: run: ./Scripts/version - name: Build run: | - make build + make build-macos file .build/ipatool diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 26d9fa92..54adf634 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -26,7 +26,7 @@ jobs: - name: Inject version run: ./Scripts/version - name: Build - run: make build + run: make build-macos - name: Upload binary uses: actions/upload-artifact@v2 with: diff --git a/Makefile b/Makefile index 76ccfb24..a3d1ca47 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,57 @@ prefix ?= /usr/local bindir = $(prefix)/bin +define ios_entitlements + + + + keychain-access-groups + + ipatool + + application-identifier + ipatool + platform-application + + com.apple.private.security.container-required + + + +endef + lint: swiftlint lint --config .swiftlint.yml --path Sources/ Tests/m Plugins/ -build: lint +build-macos: lint swift build -c release --arch arm64 swift build -c release --arch x86_64 lipo -create -output .build/ipatool .build/arm64-apple-macosx/release/ipatool .build/x86_64-apple-macosx/release/ipatool -install: build +build-ios: lint + xcodegen -s ios-project.yml + xcodebuild archive -scheme CLI \ + -sdk iphoneos \ + -configuration Release \ + -derivedDataPath .build \ + -archivePath .build/ipatool.xcarchive \ + CODE_SIGN_IDENTITY='' \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGN_ENTITLEMENTS='' \ + CODE_SIGNING_ALLOWED=NO + cp .build/ipatool.xcarchive/Products/Applications/CLI.app/CLI .build/ipatool + echo "$$ios_entitlements" > "${PWD}/.build/entitlements.xml" + ldid -S.build/entitlements.xml ./.build/ipatool + +install-macos: build install -d "$(bindir)" install ".build/ipatool" "$(bindir)" -uninstall: +uninstall-macos: rm -rf "$(bindir)/ipatool" clean: rm -rf .build -.PHONY: build install uninstall clean +.PHONY: build-macos install-macos uninstall-macos clean + +export ios_entitlements \ No newline at end of file