Skip to content

Commit 97b576e

Browse files
committed
fix: properly integrate xcconfig for centralized version management
- Added Version.xcconfig as the single source of truth for versions - Linked xcconfig to project configurations via baseConfigurationReference - Removed all hardcoded version values from project.pbxproj - Added Config group to project structure with xcconfig file - Updated documentation to reflect the correct process Now only need to edit V2er/Config/Version.xcconfig to update versions! No more updating multiple places in project.pbxproj.
1 parent fe9a9d3 commit 97b576e

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

V2er.xcodeproj/project.pbxproj

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
5D2B2B3926FF5DF800446F93 /* AccountInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountInfo.swift; sourceTree = "<group>"; };
204204
5D2B2B3B26FF754F00446F93 /* Persist.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persist.swift; sourceTree = "<group>"; };
205205
5D2B2B3D26FF797600446F93 /* AccountState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountState.swift; sourceTree = "<group>"; };
206+
5DA0000000000000000001 /* Version.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
206207
5D2DD00726FB353C0001C85A /* DefaultReducer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultReducer.swift; sourceTree = "<group>"; };
207208
5D2DD00926FB443D0001C85A /* GlobalActions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalActions.swift; sourceTree = "<group>"; };
208209
5D368C8726C419D000794B8E /* APIService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIService.swift; sourceTree = "<group>"; };
@@ -342,6 +343,14 @@
342343
/* End PBXFrameworksBuildPhase section */
343344

344345
/* Begin PBXGroup section */
346+
5DA0000000000000000002 /* Config */ = {
347+
isa = PBXGroup;
348+
children = (
349+
5DA0000000000000000001 /* Version.xcconfig */,
350+
);
351+
path = Config;
352+
sourceTree = "<group>";
353+
};
345354
5D179BFD2496F6EC00E40E90 /* Widget */ = {
346355
isa = PBXGroup;
347356
children = (
@@ -448,6 +457,7 @@
448457
5D436FE724791C2C00FFA37E /* V2er */ = {
449458
isa = PBXGroup;
450459
children = (
460+
5DA0000000000000000002 /* Config */,
451461
5DE5C577249D90690004DCC6 /* General */,
452462
5DE5B4C826845F4F00569684 /* View */,
453463
5DA2AD3326C17E7F007FB1EF /* State */,
@@ -1011,6 +1021,7 @@
10111021
/* Begin XCBuildConfiguration section */
10121022
5D43700D24791C2D00FFA37E /* Debug */ = {
10131023
isa = XCBuildConfiguration;
1024+
baseConfigurationReference = 5DA0000000000000000001 /* Version.xcconfig */;
10141025
buildSettings = {
10151026
ALWAYS_SEARCH_USER_PATHS = NO;
10161027
CLANG_ANALYZER_NONNULL = YES;
@@ -1061,19 +1072,18 @@
10611072
GCC_WARN_UNUSED_FUNCTION = YES;
10621073
GCC_WARN_UNUSED_VARIABLE = YES;
10631074
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
1064-
MARKETING_VERSION = 1.1.2;
10651075
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
10661076
MTL_FAST_MATH = YES;
10671077
ONLY_ACTIVE_ARCH = YES;
10681078
SDKROOT = iphoneos;
10691079
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
10701080
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1071-
CURRENT_PROJECT_VERSION = 29;
10721081
};
10731082
name = Debug;
10741083
};
10751084
5D43700E24791C2D00FFA37E /* Release */ = {
10761085
isa = XCBuildConfiguration;
1086+
baseConfigurationReference = 5DA0000000000000000001 /* Version.xcconfig */;
10771087
buildSettings = {
10781088
ALWAYS_SEARCH_USER_PATHS = NO;
10791089
CLANG_ANALYZER_NONNULL = YES;
@@ -1118,14 +1128,12 @@
11181128
GCC_WARN_UNUSED_FUNCTION = YES;
11191129
GCC_WARN_UNUSED_VARIABLE = YES;
11201130
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
1121-
MARKETING_VERSION = 1.1.2;
11221131
MTL_ENABLE_DEBUG_INFO = NO;
11231132
MTL_FAST_MATH = YES;
11241133
SDKROOT = iphoneos;
11251134
SWIFT_COMPILATION_MODE = wholemodule;
11261135
SWIFT_OPTIMIZATION_LEVEL = "-O";
11271136
VALIDATE_PRODUCT = YES;
1128-
CURRENT_PROJECT_VERSION = 29;
11291137
};
11301138
name = Release;
11311139
};

V2er/Config/Version.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
MARKETING_VERSION = 1.1.2
1010

1111
// VERSION_CODE - Internal build number (e.g., 29, 30, 31...)
12-
CURRENT_PROJECT_VERSION = 29
12+
CURRENT_PROJECT_VERSION = 30

VERSIONING.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,24 @@ This project uses two version identifiers:
2020

2121
**Versions are now defined in ONE place only!**
2222

23-
The version numbers are defined at the project level and automatically inherited by all targets (Debug and Release).
24-
2523
### How to Update Versions
2624

27-
To update versions, you only need to modify **2 locations** in `V2er.xcodeproj/project.pbxproj`:
25+
To update versions, simply edit the file `V2er/Config/Version.xcconfig`:
2826

29-
1. Search for the **Debug** project configuration and update:
30-
```
31-
/* Debug project configuration */
32-
MARKETING_VERSION = 1.1.2; /* VERSION_NAME */
33-
CURRENT_PROJECT_VERSION = 29; /* VERSION_CODE */
34-
```
27+
```bash
28+
# Open the file
29+
V2er/Config/Version.xcconfig
3530

36-
2. Search for the **Release** project configuration and update:
37-
```
38-
/* Release project configuration */
39-
MARKETING_VERSION = 1.1.2; /* VERSION_NAME */
40-
CURRENT_PROJECT_VERSION = 29; /* VERSION_CODE */
31+
# Update these two lines:
32+
MARKETING_VERSION = 1.1.2 # VERSION_NAME (user-facing version)
33+
CURRENT_PROJECT_VERSION = 29 # VERSION_CODE (build number)
4134
```
4235

43-
That's it! The target configurations will automatically inherit these values.
36+
**That's it!** No need to edit project.pbxproj or any other files. The xcconfig file is automatically loaded by Xcode and applies to all build configurations.
4437

4538
## Important Notes
4639

47-
1. **Both values must be updated** in both Debug and Release configurations
40+
1. **Only update Version.xcconfig** - Never modify version numbers in project.pbxproj
4841
2. **VERSION_CODE must always increase** - even for the same VERSION_NAME
4942
3. **Fastlane auto-increment**: Our Fastlane setup automatically increments VERSION_CODE for TestFlight builds
5043
4. **Info.plist**: Automatically uses these values via:

0 commit comments

Comments
 (0)