Once an application or library has been released, there may be times when you need to reproduce the original build environment to fix bugs. Usually, using the latest version of the environment at the time of the correction is fine. However, there may be various reasons why it’s necessary to reproduce the original build environment. For instance:
- You want to fix only specific bugs with as narrow a scope of impact as possible.
- Cannot use the latest version of Xcode due to system requirements reasons.
- There is a problem with library dependencies.
- Requires an Xcode version that is officially supported by third-party compilers integrated with Xcode.
I maintain a record of the built environment by incorporating its documentation into the code repository or including it with the release notes and handouts.
This article explains how to determine if you still need to keep records.
What changes with different versions of Xcode
Each major version of Xcode comes with a distinct version of cross-platform SDKs. Cross-platform SDKs are SDKs for using frameworks provided by the OS, such as UIKit and AppKit.
Different versions of the cross-platform SDK used at build time may cause the app to behave differently, even on the same OS. For example, in my experience in the past, the design and margins of the NSTableView
table headers have changed. When decoded by NSBitmapImageRep
, the vertical bitmap storage was upside down (this was on macOS 10.5 or so). When running on macOS 11, the OS version that could be obtained was sometimes 10.16
when linked with an older SDK and 11.0
with a newer SDK.
While these changes are frequently mentioned in the Xcode release notes, they may sometimes be omitted.
About the “Info.plist” file
On Apple platforms, like macOS and iOS, apps reside in application packages denoted by the .app
extension. Also, frameworks are in a bundle format with a .framework
extension.
These bundles contain the Info.plist
file, built at development time with the version number and other information. It contains information the developer enters, but the compiler and linker also add information. Among the information added automatically is information about the built environment.
Information about the built environment
The following table details the build environment information added to the Info.plist
file. The entries I predict may be added are marked with a “?”.
Key | Description |
---|---|
BuildMachineOSBuild | OS build number at build time |
DTCompiler | com.apple.compilers.llvm.clang.1_0 |
DTPlatformBuild | Toolchain version of platform SDK? |
DTPlatformName | Platform Name of Platform SDK |
DTPlatformVersion | Target Version of Platform SDK |
DTSDKBuild | Platform SDK build number |
DTSDKName | Name of Platform SDK |
DTXcode | Xcode Version |
DTXcodeBuild | Xcode build number |
macOS Application Example
Below is an example from a macOS app I developed. The following was written to the Info.plist
file.
Key | Description |
---|---|
BuildMachineOSBuild | 21G217 |
DTCompiler | com.apple.compilers.llvm.clang.1_0 |
DTPlatformBuild | 14A400 |
DTPlatformName | macosx |
DTPlatformVersion | 12.3 |
DTSDKBuild | 21E226 |
DTSDKName | macosx12.3 |
DTXcode | 1401 |
DTXcodeBuild | 14A400 |
The application was developed in an environment utilizing macOS 12.6.1 and Xcode 14.0.1.
Wikipedia has a list of OS build numbers, and if you check, 21G217
is listed as macOS 12.6.1
. Also, in DTXcode
, the top two digits are the major version, the third digit is the minor version, and the fourth digit is the revision, so 1401
is 14.0.1
.
iOS App Example
Here is an example of an iOS app I built. The following was written to the Info.plist
file.
Key | Description |
---|---|
BuildMachineOSBuild | 21G217 |
DTCompiler | com.apple.compilers.llvm.clang.1_0 |
DTPlatformBuild | 20A360 |
DTPlatformName | iphonesimulator |
DTPlatformVersion | 16.0 |
DTSDKBuild | 20A360 |
DTSDKName | iphonesimulator16.0 |
DTXcode | 1401 |
DTXcodeBuild | 14A400 |
The environment in which this application was built is macOS 12.6.1 + Xcode 14.0.1.
Wikipedia lists OS build numbers; if you check, 21G217
is listed as macOS 12.6.1
. Also, in DTXcode
, the top two digits are the major version, the third digit is the minor version, and the fourth digit is the revision, so 1401
is 14.0.1
.
Also, as the DTPlatformName
is the iphonesimulator
, it is built for the iOS simulator. Also, the DTPlatformVersion
of the SDK is 16.0
, indicating that the iOS 16 SDK is used.