Appconf
A Go tool that sets the application identifiers and display
names of the assembled projects from the merged per-platform configs. Run
after task core, against build/.
The Xcode project file is rewritten in place:
PRODUCT_BUNDLE_IDENTIFIER of the Application (app_id), ApplicationTests
(app_id.Tests) and ApplicationUITests (app_id.UITests) targets, in both
Debug and Release configs. INFOPLIST_KEY_CFBundleDisplayName is set on the
Application target to app_name; PRODUCT_NAME stays $(TARGET_NAME) so
the bundle keeps the name Application.app in the test host paths. On the
Application target only, MARKETING_VERSION is set to app_version and
CURRENT_PROJECT_VERSION to the current Unix timestamp (the build number).
The Android applicationId is rewritten to app_id; the namespace is left
untouched. Android versionName is rewritten to app_version and
versionCode to the current Unix timestamp. The Android android:label is
rewritten to app_name.
A missing or empty app_name leaves the app name untouched (only identifiers
are set). A missing or empty app_version leaves the versions untouched.
Values are written literally, so the default wildcard app_id
(com.example.*) is not translated. Re-running is a no-op, except the build
number (CURRENT_PROJECT_VERSION / versionCode) changes because it is the
current timestamp.
Usage
From the repository root:
tools/appconf/dist/appconf-{{os}}-{{arch}}
Flags
All flags have defaults that point to the standard build/ tree.
| Flag | Required | Description |
|---|---|---|
|
No |
Path to the merged Xcode config file. Default:
|
|
No |
Path to the assembled Xcode project. Default:
|
|
No |
Path to the merged Android config file. Default:
|
|
No |
Path to the assembled Android Application module. Default:
|
|
No |
Path to the assembled Android manifest. Default:
|
How it works
-
Reads
app_id,app_nameandapp_versionfrom the Xcode config. A missing or emptyapp_idis an error; a missing or emptyapp_nameskips the display name and a missing or emptyapp_versionskips the versions. -
Rewrites the three
PRODUCT_BUNDLE_IDENTIFIERmarkers in the pbxproj. Each marker must appear exactly twice (Debug + Release) or, when the file was already patched, the new value must appear twice. Any other count means the file was customized and the tool fails rather than guess. Matches are case-sensitive, so the Application id never collides with the test ids. -
Sets
INFOPLIST_KEY_CFBundleDisplayNamein both Application configurations. When a different name is already set it is replaced. -
Sets
MARKETING_VERSIONtoapp_versionandCURRENT_PROJECT_VERSIONto the current Unix timestamp in both Application configurations. When the values are already set they are replaced. Test targets are left untouched. -
Reads
app_id,app_nameandapp_versionfrom the Android config. -
Rewrites the single
applicationId = "…"line in thebuild.gradle.kts. The line must appear exactly once; when its value already equalsapp_idit is left unchanged. -
Rewrites the single
versionName = "…"andversionCode = …lines in thebuild.gradle.kts. Each line must appear exactly once;versionNamebecomesapp_versionandversionCodethe current Unix timestamp. -
Rewrites the single
android:label="…"line in the manifest. The line must appear exactly once; when its value already equalsapp_nameit is left unchanged.
Files are only written when they changed.
Tasks
From the repository root:
-
task appconf(aid): set the app identifiers for both Xcode and Android. -
task appconf.build(aib): build thetools/appconfbinary.
From tools/appconf/src:
-
task build(b): cross-compile binaries into../dist/for macOS (amd64/arm64), Linux (amd64) and Windows (amd64). -
task test(t): run the test suite.