diff --git a/Makefile b/Makefile index e1da367..bf156f9 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ SUBPROJECTS += TrollFoolsTweak include $(THEOS_MAKE_PATH)/aggregate.mk before-package:: - $(ECHO_NOTHING)ldid -STrollFools.entitlements $(THEOS_STAGING_DIR)/Applications/TrollFools.app$(ECHO_END) + $(ECHO_NOTHING)ldid -STrollFools/TrollFools.entitlements $(THEOS_STAGING_DIR)/Applications/TrollFools.app$(ECHO_END) after-package:: $(ECHO_NOTHING)mkdir -p packages $(THEOS_STAGING_DIR)/Payload$(ECHO_END) diff --git a/TrollFools.xcodeproj/project.pbxproj b/TrollFools.xcodeproj/project.pbxproj index 2d1af55..078e0d9 100644 --- a/TrollFools.xcodeproj/project.pbxproj +++ b/TrollFools.xcodeproj/project.pbxproj @@ -25,6 +25,8 @@ CC15490C2C4B79D800A4173E /* optool in Resources */ = {isa = PBXBuildFile; fileRef = CC15490B2C4B79D800A4173E /* optool */; }; CC15490E2C4B80AF00A4173E /* EjectListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC15490D2C4B80AF00A4173E /* EjectListView.swift */; }; CC19E4BB2C561D7300E0F1B5 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC19E4BA2C561D7300E0F1B5 /* SettingsView.swift */; }; + CC3485172C71B219007E0E28 /* Version.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = CC3485152C71B219007E0E28 /* Version.xcconfig */; }; + CC3485182C71B219007E0E28 /* Version.Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = CC3485162C71B219007E0E28 /* Version.Debug.xcconfig */; }; CC5E54BE2C4E12F900FDE4A8 /* install_name_tool in Resources */ = {isa = PBXBuildFile; fileRef = CC5E54BC2C4E12F900FDE4A8 /* install_name_tool */; }; CC5E54BF2C4E131000FDE4A8 /* libxar.1.dylib in Resources */ = {isa = PBXBuildFile; fileRef = CC5E54BB2C4E12F900FDE4A8 /* libxar.1.dylib */; }; CC61A87C2C4A677B003BD9A0 /* CydiaSubstrate.framework.zip in Resources */ = {isa = PBXBuildFile; fileRef = CC61A87B2C4A677B003BD9A0 /* CydiaSubstrate.framework.zip */; }; @@ -66,6 +68,9 @@ CC15490B2C4B79D800A4173E /* optool */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = optool; sourceTree = ""; }; CC15490D2C4B80AF00A4173E /* EjectListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EjectListView.swift; sourceTree = ""; }; CC19E4BA2C561D7300E0F1B5 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; + CC3485142C71B219007E0E28 /* TrollFools.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = TrollFools.entitlements; sourceTree = ""; }; + CC3485152C71B219007E0E28 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = ""; }; + CC3485162C71B219007E0E28 /* Version.Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.Debug.xcconfig; sourceTree = ""; }; CC5E54BB2C4E12F900FDE4A8 /* libxar.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libxar.1.dylib; sourceTree = ""; }; CC5E54BC2C4E12F900FDE4A8 /* install_name_tool */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = install_name_tool; sourceTree = ""; }; CC61A87B2C4A677B003BD9A0 /* CydiaSubstrate.framework.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = CydiaSubstrate.framework.zip; sourceTree = ""; }; @@ -134,6 +139,9 @@ CCC564E72C4BE8320097C300 /* libplist-2.0.3.dylib */, CC5E54BB2C4E12F900FDE4A8 /* libxar.1.dylib */, CCF4706B2C4A4919008D8197 /* Localizable.strings */, + CC3485142C71B219007E0E28 /* TrollFools.entitlements */, + CC3485152C71B219007E0E28 /* Version.xcconfig */, + CC3485162C71B219007E0E28 /* Version.Debug.xcconfig */, ); name = Resources; sourceTree = ""; @@ -275,11 +283,13 @@ CC15490C2C4B79D800A4173E /* optool in Resources */, CCC564EC2C4BE8470097C300 /* libcrypto.3.dylib in Resources */, CC1548E62C4A974E00A4173E /* libintl.8.dylib in Resources */, + CC3485172C71B219007E0E28 /* Version.xcconfig in Resources */, CC1548E72C4A974E00A4173E /* libiosexec.1.dylib in Resources */, CCC564ED2C4BE8470097C300 /* libplist-2.0.3.dylib in Resources */, CC5E54BF2C4E131000FDE4A8 /* libxar.1.dylib in Resources */, CC61A87C2C4A677B003BD9A0 /* CydiaSubstrate.framework.zip in Resources */, CCF4705E2C4A464B008D8197 /* Assets.xcassets in Resources */, + CC3485182C71B219007E0E28 /* Version.Debug.xcconfig in Resources */, CCF470692C4A4919008D8197 /* Localizable.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -446,12 +456,13 @@ }; CCF470652C4A464B008D8197 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = CC3485162C71B219007E0E28 /* Version.Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = $DEBUG_BUILD_NUMBER; DEVELOPMENT_TEAM = GXZ23M5TP2; ENABLE_PREVIEWS = NO; GENERATE_INFOPLIST_FILE = YES; @@ -471,7 +482,7 @@ "$(inherited)", "$(PROJECT_DIR)/TrollFools", ); - MARKETING_VERSION = 2.5; + MARKETING_VERSION = $DEBUG_VERSION; PRODUCT_BUNDLE_IDENTIFIER = wiki.qaq.TrollFools; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -488,12 +499,13 @@ }; CCF470662C4A464B008D8197 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = CC3485152C71B219007E0E28 /* Version.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = $BUILD_NUMBER; DEVELOPMENT_TEAM = GXZ23M5TP2; ENABLE_PREVIEWS = NO; GENERATE_INFOPLIST_FILE = YES; @@ -513,7 +525,7 @@ "$(inherited)", "$(PROJECT_DIR)/TrollFools", ); - MARKETING_VERSION = 2.5; + MARKETING_VERSION = $VERSION; PRODUCT_BUNDLE_IDENTIFIER = wiki.qaq.TrollFools; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/TrollFools.entitlements b/TrollFools/TrollFools.entitlements similarity index 100% rename from TrollFools.entitlements rename to TrollFools/TrollFools.entitlements diff --git a/TrollFools/Version.Debug.xcconfig b/TrollFools/Version.Debug.xcconfig new file mode 100644 index 0000000..807a0dd --- /dev/null +++ b/TrollFools/Version.Debug.xcconfig @@ -0,0 +1,12 @@ +// +// Version.xcconfig +// TrollFools +// +// Created by Lessica on 2024/8/18. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +DEBUG_VERSION = 2.5 +DEBUG_BUILD_NUMBER = 202408181 diff --git a/TrollFools/Version.xcconfig b/TrollFools/Version.xcconfig new file mode 100644 index 0000000..b4c95a9 --- /dev/null +++ b/TrollFools/Version.xcconfig @@ -0,0 +1,12 @@ +// +// Version.xcconfig +// TRApp +// +// Created by Lessica on 2024/8/18. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +VERSION = 2.5 +BUILD_NUMBER = 3 diff --git a/devkit/bump_version.sh b/devkit/bump_version.sh new file mode 100755 index 0000000..697b6ce --- /dev/null +++ b/devkit/bump_version.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +# This script is designed to increment the build number consistently across all +# targets. + +# Usage: bump_version.sh +# Example: bump_version.sh 1.0 + +# Usage: DEBUG=1 bump_version.sh +# Example: DEBUG=1 bump_version.sh 1.0 + +set -e +cd "$(dirname "$0")" + +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +VERSION=$1 + +if [ ! -z "$DEBUG" ]; then + +# Navigating to the 'carbonwatchuk' directory inside the source root. +XCCONFIG_NAME=../TrollFools/Version.Debug.xcconfig +if [ ! -f $XCCONFIG_NAME ]; then + echo "Versioning configuration not found!" + exit 1 +fi + +# Get the current date in the format "YYYYMMDD". +current_date=$(date "+%Y%m%d") + +# Parse the 'Config.xcconfig' file to retrieve the previous build number. +# The 'awk' command is used to find the line containing "BUILD_NUMBER" +# and the 'tr' command is used to remove any spaces. +previous_build_number=$(awk -F "=" '/DEBUG_BUILD_NUMBER/ {print $2}' $XCCONFIG_NAME | tr -d ' ') + +# Extract the date part and the counter part from the previous build number. +previous_date="${previous_build_number:0:8}" +counter="${previous_build_number:8}" + +# If the current date matches the date from the previous build number, +# increment the counter. Otherwise, reset the counter to 1. +new_counter=$((current_date == previous_date ? counter + 1 : 1)) + +# Combine the current date and the new counter to create the new build number. +new_build_number="${current_date}${new_counter}" + +# Use 'sed' command to replace the previous build number with the new build +# number in the 'Config.xcconfig' file. +sed -i -e "/DEBUG_VERSION =/ s/= .*/= $VERSION/" $XCCONFIG_NAME +sed -i -e "/DEBUG_BUILD_NUMBER =/ s/= .*/= $new_build_number/" $XCCONFIG_NAME + +# Remove the backup file created by 'sed' command. +rm -f $XCCONFIG_NAME-e + +else + +XCCONFIG_NAME=../TrollFools/Version.xcconfig +if [ ! -f $XCCONFIG_NAME ]; then + echo "Versioning configuration not found!" + exit 1 +fi + +previous_build_number=$(awk -F "=" '/BUILD_NUMBER/ {print $2}' $XCCONFIG_NAME | tr -d ' ') + +new_build_number=$((previous_build_number + 1)) + +sed -i -e "/VERSION =/ s/= .*/= $VERSION/" $XCCONFIG_NAME +sed -i -e "/BUILD_NUMBER =/ s/= .*/= $new_build_number/" $XCCONFIG_NAME + +rm -f $XCCONFIG_NAME-e + +fi + +# Create the layout directory +mkdir -p ../layout/DEBIAN + +# Write the control file +cat > ../layout/DEBIAN/control << __EOF__ +Package: wiki.qaq.trollfools +Name: TrollFools +Version: $VERSION-$new_build_number +Section: Applications +Depends: firmware (>= 14.0) +Architecture: iphoneos-arm +Author: Lessica <82flex@gmail.com> +Maintainer: Lessica <82flex@gmail.com> +Description: Give me 108 yuan. +__EOF__ + +# Set permissions +chmod 0644 ../layout/DEBIAN/control diff --git a/devkit/print_version.sh b/devkit/print_version.sh new file mode 100755 index 0000000..9e75993 --- /dev/null +++ b/devkit/print_version.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e +cd "$(dirname "$0")" + +if [ ! -z "$DEBUG" ]; then +XCCONFIG_NAME=../TrollFools/Version.Debug.xcconfig +if [ ! -f $XCCONFIG_NAME ]; then + echo "Versioning configuration not found!" + exit 1 +fi +previous_version=$(awk -F "=" '/DEBUG_VERSION/ {print $2}' $XCCONFIG_NAME | tr -d ' ') +previous_build_number=$(awk -F "=" '/DEBUG_BUILD_NUMBER/ {print $2}' $XCCONFIG_NAME | tr -d ' ') +else +XCCONFIG_NAME=../TrollFools/Version.xcconfig +if [ ! -f $XCCONFIG_NAME ]; then + echo "Versioning configuration not found!" + exit 1 +fi +previous_version=$(awk -F "=" '/VERSION/ {print $2}' $XCCONFIG_NAME | tr -d ' ') +previous_build_number=$(awk -F "=" '/BUILD_NUMBER/ {print $2}' $XCCONFIG_NAME | tr -d ' ') +fi + +echo "$previous_version ($previous_build_number)" \ No newline at end of file diff --git a/control b/layout/DEBIAN/control similarity index 90% rename from control rename to layout/DEBIAN/control index 9db4b11..b7da2cf 100644 --- a/control +++ b/layout/DEBIAN/control @@ -1,6 +1,6 @@ Package: wiki.qaq.trollfools Name: TrollFools -Version: 0.0.1 +Version: 2.5-202408181 Section: Applications Depends: firmware (>= 14.0) Architecture: iphoneos-arm