Skip to content

Commit 3f7100b

Browse files
committed
chore(release): consolidate maintenance commands
- Add metadata update and Xcode scheme test wrapper scripts - Add podspec lint mode to the dependency-aware publishing script - Replace repeated lint, metadata, and Xcode command lists in release docs
1 parent 578bac0 commit 3f7100b

6 files changed

Lines changed: 579 additions & 70 deletions

File tree

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,15 @@ For user-reported numbering-plan gaps that are not yet in upstream metadata, fol
398398

399399
## Updating Metadata
400400

401+
Use the all-in-one updater for normal metadata releases:
402+
403+
```bash
404+
swift scripts/updateMetadata.swift <libphonenumber-version> --dry-run
405+
swift scripts/updateMetadata.swift <libphonenumber-version>
406+
```
407+
408+
Use `--only main,geocoding` or `--skip carrier,timezones` when the release intentionally covers only specific metadata families. See the [release runbook](docs/RELEASE_RUNBOOK.md) for the full release flow.
409+
401410
### Main And Short-Number Metadata
402411

403412
Run the metadata generator from the `scripts` directory:
@@ -444,19 +453,13 @@ git diff --check
444453
For Swift facade changes:
445454

446455
```bash
447-
pod lib lint libPhoneNumber-iOS-SwiftCore.podspec --allow-warnings --include-podspecs='*.podspec'
448-
pod lib lint libPhoneNumber-iOS-SwiftGeocoding.podspec --allow-warnings --include-podspecs='*.podspec'
449-
pod lib lint libPhoneNumber-iOS-SwiftShortNumber.podspec --allow-warnings --include-podspecs='*.podspec'
450-
pod lib lint libPhoneNumber-iOS-SwiftUI.podspec --allow-warnings --include-podspecs='*.podspec'
451-
pod lib lint libPhoneNumber-iOS-Swift.podspec --allow-warnings --include-podspecs='*.podspec'
456+
swift scripts/publishPodspecs.swift --lint
452457
```
453458

454459
For Xcode schemes:
455460

456461
```bash
457-
xcodebuild test -scheme libPhoneNumber -destination 'platform=iOS Simulator,name=iPhone 16'
458-
xcodebuild test -scheme libPhoneNumberGeocoding -destination 'platform=iOS Simulator,name=iPhone 16'
459-
xcodebuild test -scheme libPhoneNumberShortNumber -destination 'platform=iOS Simulator,name=iPhone 16'
462+
swift scripts/testXcodeSchemes.swift
460463
```
461464

462465
## Release Checklist
@@ -470,7 +473,10 @@ xcodebuild test -scheme libPhoneNumberShortNumber -destination 'platform=iOS Sim
470473
swift scripts/updateProjectVersions.swift <new-version>
471474
```
472475
3. Run the validation matrix.
473-
4. Lint the affected podspecs.
476+
4. Lint podspecs:
477+
```bash
478+
swift scripts/publishPodspecs.swift --lint
479+
```
474480
5. Open a pull request with upstream version, parity results, and test results.
475481
6. Create a GitHub release after merge.
476482
7. Push updated podspecs in dependency order:

docs/RELEASE_RUNBOOK.md

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,34 @@ If the release is for a user-reported numbering-plan issue, add or run a focused
3535

3636
## Update Metadata
3737

38-
Update main, testing, and short-number metadata:
38+
Run the all-in-one metadata updater first. Use `--dry-run` to validate downloads, parsing, and generated outputs without changing checked-in metadata:
3939

4040
```bash
41-
swift scripts/metadataGenerator.swift <metadata-ref> --pretty
41+
swift scripts/updateMetadata.swift <metadata-ref> --dry-run
4242
```
4343

44-
Update geocoding metadata when upstream geocoding resources changed:
44+
Update all checked-in metadata families:
4545

4646
```bash
47-
swift scripts/updateGeocodingMetadata.swift <metadata-ref> --replace-bundle
47+
swift scripts/updateMetadata.swift <metadata-ref>
4848
```
4949

50-
Update carrier metadata when upstream carrier resources changed:
50+
Limit the update when only specific metadata families are in scope:
5151

5252
```bash
53-
swift scripts/updateCarrierMetadata.swift <metadata-ref> --replace-bundle
53+
swift scripts/updateMetadata.swift <metadata-ref> --only main,geocoding
54+
swift scripts/updateMetadata.swift <metadata-ref> --skip carrier,timezones
5455
```
5556

56-
Update timezone metadata when upstream timezone resources changed:
57+
The wrapper runs these underlying generators in order:
5758

58-
```bash
59-
swift scripts/updateTimeZonesMetadata.swift <metadata-ref> --replace-bundle
60-
```
59+
- `scripts/metadataGenerator.swift` for main, testing, and short-number metadata.
60+
- `scripts/updateGeocodingMetadata.swift` for geocoding databases.
61+
- `scripts/updateCarrierMetadata.swift` for carrier metadata.
62+
- `scripts/updateTimeZonesMetadata.swift` for timezone metadata.
63+
- `scripts/checkMetadataFreshness.swift --current-ref <metadata-ref>` after checked-in updates.
6164

62-
Use `--output <dir>` instead of `--replace-bundle` when reviewing generated artifacts before changing checked-in bundles.
65+
Use the individual generator scripts only when debugging or intentionally updating one metadata family outside the normal release flow.
6366

6467
## Version Bump
6568

@@ -96,34 +99,20 @@ git diff --check
9699
Run the main Xcode schemes:
97100

98101
```bash
99-
xcodebuild test -scheme libPhoneNumber -destination 'platform=iOS Simulator,name=iPhone 16'
100-
xcodebuild test -scheme libPhoneNumberGeocoding -destination 'platform=iOS Simulator,name=iPhone 16'
101-
xcodebuild test -scheme libPhoneNumberShortNumber -destination 'platform=iOS Simulator,name=iPhone 16'
102+
swift scripts/testXcodeSchemes.swift
102103
```
103104

104105
If the simulator destination is ambiguous, use a concrete UDID:
105106

106107
```bash
107108
xcodebuild -scheme libPhoneNumber -showdestinations
108-
xcodebuild test -scheme libPhoneNumber -destination 'id=<simulator-udid>'
109+
swift scripts/testXcodeSchemes.swift --destination 'id=<simulator-udid>'
109110
```
110111

111112
Run CocoaPods lint for every shipped podspec when packaging, dependency, or release metadata changed:
112113

113114
```bash
114-
pod lib lint libPhoneNumber-iOS.podspec --allow-warnings
115-
pod lib lint libPhoneNumberGeocoding.podspec --allow-warnings --include-podspecs='*.podspec'
116-
pod lib lint libPhoneNumberShortNumber.podspec --allow-warnings --include-podspecs='*.podspec'
117-
pod lib lint libPhoneNumberCarrier.podspec --allow-warnings --include-podspecs='*.podspec'
118-
pod lib lint libPhoneNumberTimeZones.podspec --allow-warnings --include-podspecs='*.podspec'
119-
pod lib lint libPhoneNumber-iOS-SwiftCore.podspec --allow-warnings --include-podspecs='*.podspec'
120-
pod lib lint libPhoneNumber-iOS-SwiftGeocoding.podspec --allow-warnings --include-podspecs='*.podspec'
121-
pod lib lint libPhoneNumber-iOS-SwiftShortNumber.podspec --allow-warnings --include-podspecs='*.podspec'
122-
pod lib lint libPhoneNumber-iOS-SwiftCarrier.podspec --allow-warnings --include-podspecs='*.podspec'
123-
pod lib lint libPhoneNumber-iOS-SwiftTimeZones.podspec --allow-warnings --include-podspecs='*.podspec'
124-
pod lib lint libPhoneNumber-iOS-SwiftUI.podspec --allow-warnings --include-podspecs='*.podspec'
125-
pod lib lint libPhoneNumber-iOS-SwiftUIEnrichment.podspec --allow-warnings --include-podspecs='*.podspec'
126-
pod lib lint libPhoneNumber-iOS-Swift.podspec --allow-warnings --include-podspecs='*.podspec'
115+
swift scripts/publishPodspecs.swift --lint
127116
```
128117

129118
Re-run freshness after the metadata update to confirm the checked-in metadata matches the selected upstream ref:

docs/TESTING.md

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,23 @@ See `docs/UPSTREAM_PARITY.md` for the full parity workflow.
6464
Run the three main schemes on an iOS Simulator:
6565

6666
```bash
67-
xcodebuild test -scheme libPhoneNumber -destination 'platform=iOS Simulator,name=iPhone 16'
68-
xcodebuild test -scheme libPhoneNumberGeocoding -destination 'platform=iOS Simulator,name=iPhone 16'
69-
xcodebuild test -scheme libPhoneNumberShortNumber -destination 'platform=iOS Simulator,name=iPhone 16'
67+
swift scripts/testXcodeSchemes.swift
7068
```
7169

7270
If the destination name is ambiguous or unavailable, list destinations and use a simulator UDID:
7371

7472
```bash
7573
xcodebuild -scheme libPhoneNumber -showdestinations
76-
xcodebuild test -scheme libPhoneNumber -destination 'id=<simulator-udid>'
74+
swift scripts/testXcodeSchemes.swift --destination 'id=<simulator-udid>'
7775
```
7876

7977
Using a fresh `-derivedDataPath` is useful when code coverage files or stale derived data create noisy warnings:
8078

8179
```bash
82-
xcodebuild test -scheme libPhoneNumberShortNumber \
83-
-destination 'id=<simulator-udid>' \
84-
-derivedDataPath /tmp/libphone-xc-shortnumber-dd
80+
swift scripts/testXcodeSchemes.swift \
81+
--destination 'id=<simulator-udid>' \
82+
--derived-data-root /tmp/libphone-xc-dd \
83+
libPhoneNumberShortNumber
8584
```
8685

8786
## Required Matrix By Change Type
@@ -98,7 +97,7 @@ For metadata updates:
9897
- `swift scripts/checkMetadataFreshness.swift --current-ref <metadata-ref> --output .build/metadata-freshness`
9998
- `swift scripts/checkUpstreamTestParity.swift --upstream-ref <metadata-ref>`
10099
- `swift scripts/checkUpstreamAPIParity.swift --upstream-ref <metadata-ref>`
101-
- `swift scripts/updateGeocodingMetadata.swift <metadata-ref> --output /tmp/geocoding-review` if geocoding metadata changed upstream.
100+
- `swift scripts/updateMetadata.swift <metadata-ref> --dry-run`
102101
- `scripts/testGeocodingMetadataUpdater.sh` if the geocoding updater changed.
103102
- Update `docs/METADATA_UPDATE_LOG.md` with the upstream comparison and validation results.
104103
- `swift test`
@@ -121,47 +120,28 @@ For geocoding behavior changes:
121120

122121
- `swift test`
123122
- `LC_ALL=ko_KR.UTF-8 LANG=ko_KR.UTF-8 swift test`
124-
- `xcodebuild test -scheme libPhoneNumberGeocoding -destination 'id=<simulator-udid>'`
123+
- `swift scripts/testXcodeSchemes.swift --destination 'id=<simulator-udid>' libPhoneNumberGeocoding`
125124
- `git diff --check`
126125

127126
For short-number behavior changes:
128127

129128
- `swift test`
130-
- `xcodebuild test -scheme libPhoneNumberShortNumber -destination 'id=<simulator-udid>'`
129+
- `swift scripts/testXcodeSchemes.swift --destination 'id=<simulator-udid>' libPhoneNumberShortNumber`
131130
- `git diff --check`
132131

133132
For Swift facade changes:
134133

135134
- `swift test`
136135
- `LC_ALL=ko_KR.UTF-8 LANG=ko_KR.UTF-8 swift test`
137136
- `swift build -c release`
138-
- `pod lib lint libPhoneNumber-iOS-SwiftCore.podspec --allow-warnings --include-podspecs='*.podspec'`
139-
- `pod lib lint libPhoneNumber-iOS-SwiftGeocoding.podspec --allow-warnings --include-podspecs='*.podspec'`
140-
- `pod lib lint libPhoneNumber-iOS-SwiftShortNumber.podspec --allow-warnings --include-podspecs='*.podspec'`
141-
- `pod lib lint libPhoneNumber-iOS-SwiftCarrier.podspec --allow-warnings --include-podspecs='*.podspec'`
142-
- `pod lib lint libPhoneNumber-iOS-SwiftTimeZones.podspec --allow-warnings --include-podspecs='*.podspec'`
143-
- `pod lib lint libPhoneNumber-iOS-SwiftUI.podspec --allow-warnings --include-podspecs='*.podspec'`
144-
- `pod lib lint libPhoneNumber-iOS-SwiftUIEnrichment.podspec --allow-warnings --include-podspecs='*.podspec'`
145-
- `pod lib lint libPhoneNumber-iOS-Swift.podspec --allow-warnings --include-podspecs='*.podspec'`
137+
- `swift scripts/publishPodspecs.swift --lint`
146138
- Confirm the facade remains a thin wrapper over the Objective-C core instead of duplicating phone-number logic.
147139
- See `docs/SWIFT_FACADE_MODULE_SPLIT.md` before changing module boundaries.
148140

149141
For packaging changes:
150142

151143
- `swift scripts/checkVersionConsistency.swift`
152-
- `pod lib lint libPhoneNumber-iOS.podspec --allow-warnings`
153-
- `pod lib lint libPhoneNumberGeocoding.podspec --allow-warnings --include-podspecs='*.podspec'`
154-
- `pod lib lint libPhoneNumberShortNumber.podspec --allow-warnings --include-podspecs='*.podspec'`
155-
- `pod lib lint libPhoneNumberCarrier.podspec --allow-warnings --include-podspecs='*.podspec'`
156-
- `pod lib lint libPhoneNumberTimeZones.podspec --allow-warnings --include-podspecs='*.podspec'`
157-
- `pod lib lint libPhoneNumber-iOS-SwiftCore.podspec --allow-warnings --include-podspecs='*.podspec'`
158-
- `pod lib lint libPhoneNumber-iOS-SwiftGeocoding.podspec --allow-warnings --include-podspecs='*.podspec'`
159-
- `pod lib lint libPhoneNumber-iOS-SwiftShortNumber.podspec --allow-warnings --include-podspecs='*.podspec'`
160-
- `pod lib lint libPhoneNumber-iOS-SwiftCarrier.podspec --allow-warnings --include-podspecs='*.podspec'`
161-
- `pod lib lint libPhoneNumber-iOS-SwiftTimeZones.podspec --allow-warnings --include-podspecs='*.podspec'`
162-
- `pod lib lint libPhoneNumber-iOS-SwiftUI.podspec --allow-warnings --include-podspecs='*.podspec'`
163-
- `pod lib lint libPhoneNumber-iOS-SwiftUIEnrichment.podspec --allow-warnings --include-podspecs='*.podspec'`
164-
- `pod lib lint libPhoneNumber-iOS-Swift.podspec --allow-warnings --include-podspecs='*.podspec'`
144+
- `swift scripts/publishPodspecs.swift --lint`
165145

166146
## Locale-Sensitive Tests
167147

scripts/publishPodspecs.swift

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Foundation
44

55
struct Options {
66
var shouldPublish = false
7+
var shouldLint = false
78
var skipExisting = true
89
var retries = 2
910
var waitTimeout = 120
@@ -48,13 +49,14 @@ func usage() -> String {
4849
swift scripts/publishPodspecs.swift [options] [podspec ...]
4950
5051
Options:
52+
--lint Lint podspecs in dependency order without publishing.
5153
--publish Push missing podspec versions to CocoaPods trunk.
5254
--no-skip-existing Attempt to push versions even when trunk already has them.
5355
--retries <count> Retry failed trunk pushes. Default: 2.
5456
--wait-timeout <sec> Wait for trunk visibility after each push. Default: 120.
5557
--help Print this help.
5658
57-
Without --publish, the script only prints dependency order and trunk status.
59+
Without --lint or --publish, the script only prints dependency order and trunk status.
5860
"""
5961
}
6062

@@ -66,6 +68,8 @@ func parseOptions(_ arguments: [String]) throws -> Options {
6668
let argument = arguments[index]
6769

6870
switch argument {
71+
case "--lint":
72+
options.shouldLint = true
6973
case "--publish":
7074
options.shouldPublish = true
7175
case "--no-skip-existing":
@@ -240,7 +244,7 @@ func waitForTrunkVersion(name: String, version: String, timeout: Int) throws ->
240244
}
241245

242246
func printPlan(_ podspecs: [Podspec]) {
243-
print("Dependency-aware CocoaPods trunk order:")
247+
print("Dependency-aware CocoaPods podspec order:")
244248
for (index, podspec) in podspecs.enumerated() {
245249
let localDependencies = podspec.dependencies.filter { dependencyName in
246250
podspecs.contains { $0.name == dependencyName }
@@ -253,6 +257,28 @@ func printPlan(_ podspecs: [Podspec]) {
253257
}
254258
}
255259

260+
func lint(_ podspec: Podspec) throws -> Bool {
261+
print("[lint] \(podspec.path)")
262+
let exitCode = try runStreaming(
263+
"pod",
264+
[
265+
"lib",
266+
"lint",
267+
podspec.path,
268+
"--allow-warnings",
269+
"--include-podspecs=*.podspec",
270+
]
271+
)
272+
273+
if exitCode == 0 {
274+
print("[ok] \(podspec.name) \(podspec.version) passed lint")
275+
return true
276+
}
277+
278+
print("[warn] \(podspec.name) \(podspec.version) lint failed with exit code \(exitCode)")
279+
return false
280+
}
281+
256282
func publish(_ podspec: Podspec, options: Options) throws -> Bool {
257283
let isPublished = try trunkHasVersion(name: podspec.name, version: podspec.version)
258284

@@ -318,6 +344,28 @@ do {
318344

319345
printPlan(orderedPodspecs)
320346

347+
if options.shouldLint {
348+
var failedLintPodspecs: [String] = []
349+
for podspec in orderedPodspecs {
350+
if !(try lint(podspec)) {
351+
failedLintPodspecs.append("\(podspec.name) \(podspec.version)")
352+
}
353+
}
354+
355+
if !failedLintPodspecs.isEmpty {
356+
print("Failed podspec lint validations:")
357+
for failedPodspec in failedLintPodspecs {
358+
print("- \(failedPodspec)")
359+
}
360+
exit(1)
361+
}
362+
363+
print("All podspecs passed lint.")
364+
if !options.shouldPublish {
365+
exit(0)
366+
}
367+
}
368+
321369
var failedPodspecs: [String] = []
322370
for podspec in orderedPodspecs {
323371
if !(try publish(podspec, options: options)) {

0 commit comments

Comments
 (0)