Skip to content

Commit b8082f5

Browse files
committed
ci: versioning system
Signed-off-by: 82Flex <[email protected]>
1 parent 8e0c7f2 commit b8082f5

File tree

8 files changed

+160
-6
lines changed

8 files changed

+160
-6
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SUBPROJECTS += TrollFoolsTweak
1313
include $(THEOS_MAKE_PATH)/aggregate.mk
1414

1515
before-package::
16-
$(ECHO_NOTHING)ldid -STrollFools.entitlements $(THEOS_STAGING_DIR)/Applications/TrollFools.app$(ECHO_END)
16+
$(ECHO_NOTHING)ldid -STrollFools/TrollFools.entitlements $(THEOS_STAGING_DIR)/Applications/TrollFools.app$(ECHO_END)
1717

1818
after-package::
1919
$(ECHO_NOTHING)mkdir -p packages $(THEOS_STAGING_DIR)/Payload$(ECHO_END)

TrollFools.xcodeproj/project.pbxproj

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
CC15490C2C4B79D800A4173E /* optool in Resources */ = {isa = PBXBuildFile; fileRef = CC15490B2C4B79D800A4173E /* optool */; };
2626
CC15490E2C4B80AF00A4173E /* EjectListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC15490D2C4B80AF00A4173E /* EjectListView.swift */; };
2727
CC19E4BB2C561D7300E0F1B5 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC19E4BA2C561D7300E0F1B5 /* SettingsView.swift */; };
28+
CC3485172C71B219007E0E28 /* Version.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = CC3485152C71B219007E0E28 /* Version.xcconfig */; };
29+
CC3485182C71B219007E0E28 /* Version.Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = CC3485162C71B219007E0E28 /* Version.Debug.xcconfig */; };
2830
CC5E54BE2C4E12F900FDE4A8 /* install_name_tool in Resources */ = {isa = PBXBuildFile; fileRef = CC5E54BC2C4E12F900FDE4A8 /* install_name_tool */; };
2931
CC5E54BF2C4E131000FDE4A8 /* libxar.1.dylib in Resources */ = {isa = PBXBuildFile; fileRef = CC5E54BB2C4E12F900FDE4A8 /* libxar.1.dylib */; };
3032
CC61A87C2C4A677B003BD9A0 /* CydiaSubstrate.framework.zip in Resources */ = {isa = PBXBuildFile; fileRef = CC61A87B2C4A677B003BD9A0 /* CydiaSubstrate.framework.zip */; };
@@ -66,6 +68,9 @@
6668
CC15490B2C4B79D800A4173E /* optool */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = optool; sourceTree = "<group>"; };
6769
CC15490D2C4B80AF00A4173E /* EjectListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EjectListView.swift; sourceTree = "<group>"; };
6870
CC19E4BA2C561D7300E0F1B5 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
71+
CC3485142C71B219007E0E28 /* TrollFools.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = TrollFools.entitlements; sourceTree = "<group>"; };
72+
CC3485152C71B219007E0E28 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
73+
CC3485162C71B219007E0E28 /* Version.Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.Debug.xcconfig; sourceTree = "<group>"; };
6974
CC5E54BB2C4E12F900FDE4A8 /* libxar.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libxar.1.dylib; sourceTree = "<group>"; };
7075
CC5E54BC2C4E12F900FDE4A8 /* install_name_tool */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = install_name_tool; sourceTree = "<group>"; };
7176
CC61A87B2C4A677B003BD9A0 /* CydiaSubstrate.framework.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = CydiaSubstrate.framework.zip; sourceTree = "<group>"; };
@@ -134,6 +139,9 @@
134139
CCC564E72C4BE8320097C300 /* libplist-2.0.3.dylib */,
135140
CC5E54BB2C4E12F900FDE4A8 /* libxar.1.dylib */,
136141
CCF4706B2C4A4919008D8197 /* Localizable.strings */,
142+
CC3485142C71B219007E0E28 /* TrollFools.entitlements */,
143+
CC3485152C71B219007E0E28 /* Version.xcconfig */,
144+
CC3485162C71B219007E0E28 /* Version.Debug.xcconfig */,
137145
);
138146
name = Resources;
139147
sourceTree = "<group>";
@@ -275,11 +283,13 @@
275283
CC15490C2C4B79D800A4173E /* optool in Resources */,
276284
CCC564EC2C4BE8470097C300 /* libcrypto.3.dylib in Resources */,
277285
CC1548E62C4A974E00A4173E /* libintl.8.dylib in Resources */,
286+
CC3485172C71B219007E0E28 /* Version.xcconfig in Resources */,
278287
CC1548E72C4A974E00A4173E /* libiosexec.1.dylib in Resources */,
279288
CCC564ED2C4BE8470097C300 /* libplist-2.0.3.dylib in Resources */,
280289
CC5E54BF2C4E131000FDE4A8 /* libxar.1.dylib in Resources */,
281290
CC61A87C2C4A677B003BD9A0 /* CydiaSubstrate.framework.zip in Resources */,
282291
CCF4705E2C4A464B008D8197 /* Assets.xcassets in Resources */,
292+
CC3485182C71B219007E0E28 /* Version.Debug.xcconfig in Resources */,
283293
CCF470692C4A4919008D8197 /* Localizable.strings in Resources */,
284294
);
285295
runOnlyForDeploymentPostprocessing = 0;
@@ -446,12 +456,13 @@
446456
};
447457
CCF470652C4A464B008D8197 /* Debug */ = {
448458
isa = XCBuildConfiguration;
459+
baseConfigurationReference = CC3485162C71B219007E0E28 /* Version.Debug.xcconfig */;
449460
buildSettings = {
450461
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
451462
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
452463
CLANG_ENABLE_MODULES = YES;
453464
CODE_SIGN_STYLE = Automatic;
454-
CURRENT_PROJECT_VERSION = 3;
465+
CURRENT_PROJECT_VERSION = $DEBUG_BUILD_NUMBER;
455466
DEVELOPMENT_TEAM = GXZ23M5TP2;
456467
ENABLE_PREVIEWS = NO;
457468
GENERATE_INFOPLIST_FILE = YES;
@@ -471,7 +482,7 @@
471482
"$(inherited)",
472483
"$(PROJECT_DIR)/TrollFools",
473484
);
474-
MARKETING_VERSION = 2.5;
485+
MARKETING_VERSION = $DEBUG_VERSION;
475486
PRODUCT_BUNDLE_IDENTIFIER = wiki.qaq.TrollFools;
476487
PRODUCT_NAME = "$(TARGET_NAME)";
477488
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -488,12 +499,13 @@
488499
};
489500
CCF470662C4A464B008D8197 /* Release */ = {
490501
isa = XCBuildConfiguration;
502+
baseConfigurationReference = CC3485152C71B219007E0E28 /* Version.xcconfig */;
491503
buildSettings = {
492504
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
493505
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
494506
CLANG_ENABLE_MODULES = YES;
495507
CODE_SIGN_STYLE = Automatic;
496-
CURRENT_PROJECT_VERSION = 3;
508+
CURRENT_PROJECT_VERSION = $BUILD_NUMBER;
497509
DEVELOPMENT_TEAM = GXZ23M5TP2;
498510
ENABLE_PREVIEWS = NO;
499511
GENERATE_INFOPLIST_FILE = YES;
@@ -513,7 +525,7 @@
513525
"$(inherited)",
514526
"$(PROJECT_DIR)/TrollFools",
515527
);
516-
MARKETING_VERSION = 2.5;
528+
MARKETING_VERSION = $VERSION;
517529
PRODUCT_BUNDLE_IDENTIFIER = wiki.qaq.TrollFools;
518530
PRODUCT_NAME = "$(TARGET_NAME)";
519531
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
File renamed without changes.

TrollFools/Version.Debug.xcconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// Version.xcconfig
3+
// TrollFools
4+
//
5+
// Created by Lessica on 2024/8/18.
6+
//
7+
8+
// Configuration settings file format documentation can be found at:
9+
// https://help.apple.com/xcode/#/dev745c5c974
10+
11+
DEBUG_VERSION = 2.5
12+
DEBUG_BUILD_NUMBER = 202408181

TrollFools/Version.xcconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// Version.xcconfig
3+
// TRApp
4+
//
5+
// Created by Lessica on 2024/8/18.
6+
//
7+
8+
// Configuration settings file format documentation can be found at:
9+
// https://help.apple.com/xcode/#/dev745c5c974
10+
11+
VERSION = 2.5
12+
BUILD_NUMBER = 3

devkit/bump_version.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/bin/bash
2+
3+
# This script is designed to increment the build number consistently across all
4+
# targets.
5+
6+
# Usage: bump_version.sh <version>
7+
# Example: bump_version.sh 1.0
8+
9+
# Usage: DEBUG=1 bump_version.sh <version>
10+
# Example: DEBUG=1 bump_version.sh 1.0
11+
12+
set -e
13+
cd "$(dirname "$0")"
14+
15+
if [ $# -ne 1 ]; then
16+
echo "Usage: $0 <version>"
17+
exit 1
18+
fi
19+
20+
VERSION=$1
21+
22+
if [ ! -z "$DEBUG" ]; then
23+
24+
# Navigating to the 'carbonwatchuk' directory inside the source root.
25+
XCCONFIG_NAME=../TrollFools/Version.Debug.xcconfig
26+
if [ ! -f $XCCONFIG_NAME ]; then
27+
echo "Versioning configuration not found!"
28+
exit 1
29+
fi
30+
31+
# Get the current date in the format "YYYYMMDD".
32+
current_date=$(date "+%Y%m%d")
33+
34+
# Parse the 'Config.xcconfig' file to retrieve the previous build number.
35+
# The 'awk' command is used to find the line containing "BUILD_NUMBER"
36+
# and the 'tr' command is used to remove any spaces.
37+
previous_build_number=$(awk -F "=" '/DEBUG_BUILD_NUMBER/ {print $2}' $XCCONFIG_NAME | tr -d ' ')
38+
39+
# Extract the date part and the counter part from the previous build number.
40+
previous_date="${previous_build_number:0:8}"
41+
counter="${previous_build_number:8}"
42+
43+
# If the current date matches the date from the previous build number,
44+
# increment the counter. Otherwise, reset the counter to 1.
45+
new_counter=$((current_date == previous_date ? counter + 1 : 1))
46+
47+
# Combine the current date and the new counter to create the new build number.
48+
new_build_number="${current_date}${new_counter}"
49+
50+
# Use 'sed' command to replace the previous build number with the new build
51+
# number in the 'Config.xcconfig' file.
52+
sed -i -e "/DEBUG_VERSION =/ s/= .*/= $VERSION/" $XCCONFIG_NAME
53+
sed -i -e "/DEBUG_BUILD_NUMBER =/ s/= .*/= $new_build_number/" $XCCONFIG_NAME
54+
55+
# Remove the backup file created by 'sed' command.
56+
rm -f $XCCONFIG_NAME-e
57+
58+
else
59+
60+
XCCONFIG_NAME=../TrollFools/Version.xcconfig
61+
if [ ! -f $XCCONFIG_NAME ]; then
62+
echo "Versioning configuration not found!"
63+
exit 1
64+
fi
65+
66+
previous_build_number=$(awk -F "=" '/BUILD_NUMBER/ {print $2}' $XCCONFIG_NAME | tr -d ' ')
67+
68+
new_build_number=$((previous_build_number + 1))
69+
70+
sed -i -e "/VERSION =/ s/= .*/= $VERSION/" $XCCONFIG_NAME
71+
sed -i -e "/BUILD_NUMBER =/ s/= .*/= $new_build_number/" $XCCONFIG_NAME
72+
73+
rm -f $XCCONFIG_NAME-e
74+
75+
fi
76+
77+
# Create the layout directory
78+
mkdir -p ../layout/DEBIAN
79+
80+
# Write the control file
81+
cat > ../layout/DEBIAN/control << __EOF__
82+
Package: wiki.qaq.trollfools
83+
Name: TrollFools
84+
Version: $VERSION-$new_build_number
85+
Section: Applications
86+
Depends: firmware (>= 14.0)
87+
Architecture: iphoneos-arm
88+
Author: Lessica <[email protected]>
89+
Maintainer: Lessica <[email protected]>
90+
Description: Give me 108 yuan.
91+
__EOF__
92+
93+
# Set permissions
94+
chmod 0644 ../layout/DEBIAN/control

devkit/print_version.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
set -e
4+
cd "$(dirname "$0")"
5+
6+
if [ ! -z "$DEBUG" ]; then
7+
XCCONFIG_NAME=../TrollFools/Version.Debug.xcconfig
8+
if [ ! -f $XCCONFIG_NAME ]; then
9+
echo "Versioning configuration not found!"
10+
exit 1
11+
fi
12+
previous_version=$(awk -F "=" '/DEBUG_VERSION/ {print $2}' $XCCONFIG_NAME | tr -d ' ')
13+
previous_build_number=$(awk -F "=" '/DEBUG_BUILD_NUMBER/ {print $2}' $XCCONFIG_NAME | tr -d ' ')
14+
else
15+
XCCONFIG_NAME=../TrollFools/Version.xcconfig
16+
if [ ! -f $XCCONFIG_NAME ]; then
17+
echo "Versioning configuration not found!"
18+
exit 1
19+
fi
20+
previous_version=$(awk -F "=" '/VERSION/ {print $2}' $XCCONFIG_NAME | tr -d ' ')
21+
previous_build_number=$(awk -F "=" '/BUILD_NUMBER/ {print $2}' $XCCONFIG_NAME | tr -d ' ')
22+
fi
23+
24+
echo "$previous_version ($previous_build_number)"

control renamed to layout/DEBIAN/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: wiki.qaq.trollfools
22
Name: TrollFools
3-
Version: 0.0.1
3+
Version: 2.5-202408181
44
Section: Applications
55
Depends: firmware (>= 14.0)
66
Architecture: iphoneos-arm

0 commit comments

Comments
 (0)