From adee94819a52d3efd6e95bd05430e0cbb3a17308 Mon Sep 17 00:00:00 2001 From: Magesh K <47920326+mahee96@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:00:53 +0530 Subject: [PATCH] [Beta-Suuport]: Added commit ID appending to version if in beta track build --- AltStore/Operations/VerifyAppOperation.swift | 7 +++++ AltStoreCore/Model/AppVersion.swift | 2 ++ Makefile | 29 ++++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/AltStore/Operations/VerifyAppOperation.swift b/AltStore/Operations/VerifyAppOperation.swift index 466b6ca2..c63f0c69 100644 --- a/AltStore/Operations/VerifyAppOperation.swift +++ b/AltStore/Operations/VerifyAppOperation.swift @@ -83,6 +83,13 @@ final class VerifyAppOperation: ResultOperation { guard let ipaURL = self.context.ipaURL else { throw OperationError.appNotFound(name: app.name) } + + // TODO: @mahee96: appVersion is instantiated source info as AppVersion incoming from source json + // app is the instantiated ipa downloaded from the specified in the source json in temp dir + // + // For alpha and beta/nightly releases, the CFBundleShortVersionString which is the + // $(MARKETING_VERSION) will be overriden with the commit id before invoking xcode build + // try await self.verifyHash(of: app, at: ipaURL, matches: appVersion) try await self.verifyDownloadedVersion(of: app, matches: appVersion) try await self.verifyPermissions(of: app, match: appVersion) diff --git a/AltStoreCore/Model/AppVersion.swift b/AltStoreCore/Model/AppVersion.swift index 85e312bc..6c0b2c9a 100644 --- a/AltStoreCore/Model/AppVersion.swift +++ b/AltStoreCore/Model/AppVersion.swift @@ -46,6 +46,7 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable @NSManaged public var appBundleID: String @NSManaged public var sourceID: String? + @NSManaged public var isBeta: Bool /* Relationships */ @NSManaged public private(set) var app: StoreApp? @@ -67,6 +68,7 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable case sha256 case minOSVersion case maxOSVersion + case isBeta } public required init(from decoder: Decoder) throws diff --git a/Makefile b/Makefile index e102ce3e..3411c8eb 100755 --- a/Makefile +++ b/Makefile @@ -156,7 +156,31 @@ test: ## -- Building -- -build: +# Fetch the latest commit ID if IS_BETA is defined +fetch_commit_id: + @echo "" + @if [ -n "$$IS_BETA" ]; then \ + echo "'IS_BETA' is defined. Fetching the latest commit ID from HEAD..."; \ + export COMMIT_ID=$$(git rev-parse --short HEAD); \ + echo "Commit ID: $$COMMIT_ID"; \ + else \ + echo "'IS_BETA' is not defined. Skipping commit ID fetch."; \ + fi + @echo "" + +# Print release type based on the presence of COMMIT_ID +print_release_type: + @if [ -z "$$COMMIT_ID" ]; then \ + echo ">>>>>>>> This is STABLE release <<<<<<<<<"; \ + echo " Using default MARKETING_VERSION from project.pbxproj."; \ + else \ + echo ">>>>>>>> This is ALPHA/BETA release for commitID = $$COMMIT_ID <<<<<<<<<"; \ + echo " Building with MARKETING_VERSION=$$COMMIT_ID"; \ + fi + @echo "" + +# Build target with the fetch_commit_id dependency +build: fetch_commit_id print_release_type @xcodebuild -workspace AltStore.xcworkspace \ -scheme SideStore \ -sdk iphoneos \ @@ -166,7 +190,8 @@ build: CODE_SIGNING_ALLOWED=NO \ DEVELOPMENT_TEAM=XYZ0123456 \ ORG_IDENTIFIER=com.SideStore \ - DWARF_DSYM_FOLDER_PATH="." + DWARF_DSYM_FOLDER_PATH="." \ + MARKETING_VERSION=$$COMMIT_ID fakesign: rm -rf archive.xcarchive/Products/Applications/SideStore.app/Frameworks/AltStoreCore.framework/Frameworks/