Skip to content

Commit 3f22c4b

Browse files
authored
fix: use repo-root-relative paths in Swift podspec (#737)
* fix: use repo-root-relative paths in Swift podspec source_files and license file paths in a podspec are resolved relative to the repo root (defined by s.source), not relative to the podspec file location. The existing paths only worked for local pod references and broke on `pod trunk push`. - source_files: Sources/**/*.swift -> mParticle-Apple-SDK-Swift/Sources/**/*.swift - license file: ../LICENSE -> LICENSE * fix: move Swift podspec to repo root for consistent path resolution pod lib lint resolves paths relative to the podspec file's directory, while pod trunk push resolves relative to the repo root. With the podspec in a subdirectory, these two tools are incompatible. Moving the podspec to the repo root makes both commands resolve paths the same way. Update all workflow, doc, and CI references accordingly.
1 parent 442e506 commit 3f22c4b

7 files changed

Lines changed: 10 additions & 10 deletions

File tree

.github/workflows/build-and-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: find . -path '*.podspec' -exec perl -pi -e 's/.+\.social_media_url.+//' {} \;
3939

4040
- name: Lint with CocoaPods
41-
run: pod lib lint mParticle-Apple-SDK.podspec --include-podspecs="{mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec,mParticle-Apple-SDK-ObjC.podspec,mParticle-Apple-SDK.podspec}"
41+
run: pod lib lint mParticle-Apple-SDK.podspec --include-podspecs="{mParticle-Apple-SDK-Swift.podspec,mParticle-Apple-SDK-ObjC.podspec,mParticle-Apple-SDK.podspec}"
4242

4343
- name: Undo twitter change to podspec
4444
run: git checkout *.podspec

.github/workflows/build-kits.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ jobs:
4444
# is published to CocoaPods CDN.
4545
sed -i '' 's/s\.version[[:space:]]*=.*/s.version = "9.0.0"/' mParticle-Apple-SDK.podspec
4646
sed -i '' 's/s\.version[[:space:]]*=.*/s.version = "9.0.0"/' mParticle-Apple-SDK-ObjC.podspec
47-
sed -i '' 's/s\.version[[:space:]]*=.*/s.version = "9.0.0"/' mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec
47+
sed -i '' 's/s\.version[[:space:]]*=.*/s.version = "9.0.0"/' mParticle-Apple-SDK-Swift.podspec
4848
4949
echo "Linting: ${{ matrix.kit.podspec }}"
5050
for attempt in 1 2 3; do
5151
pod lib lint "${{ matrix.kit.podspec }}" \
5252
--allow-warnings \
5353
--skip-import-validation \
54-
--include-podspecs="{mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec,mParticle-Apple-SDK-ObjC.podspec,mParticle-Apple-SDK.podspec}" \
54+
--include-podspecs="{mParticle-Apple-SDK-Swift.podspec,mParticle-Apple-SDK-ObjC.podspec,mParticle-Apple-SDK.podspec}" \
5555
&& break
5656
[ $attempt -lt 3 ] && echo "Attempt $attempt failed, retrying in 60s..." && sleep 60 || exit 1
5757
done

.github/workflows/release-draft.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
PODSPECS=(
7373
"mParticle-Apple-SDK.podspec"
7474
"mParticle-Apple-SDK-ObjC.podspec"
75-
"mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec"
75+
"mParticle-Apple-SDK-Swift.podspec"
7676
)
7777
while IFS= read -r spec; do
7878
PODSPECS+=("$spec")
@@ -128,7 +128,7 @@ jobs:
128128
Framework/Info.plist \
129129
mParticle-Apple-SDK.podspec \
130130
mParticle-Apple-SDK-ObjC.podspec \
131-
mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec \
131+
mParticle-Apple-SDK-Swift.podspec \
132132
mParticle-Apple-SDK/MPIConstants.m \
133133
IntegrationTests/wiremock-recordings/mappings/*.json \
134134
Kits/

.github/workflows/release-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
set -euo pipefail
9898
PUSH_FLAGS=(--allow-warnings --synchronous)
9999
# Order matters: Swift pod → ObjC core (depends on Swift) → umbrella Swift (depends on ObjC).
100-
pod trunk push mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec "${PUSH_FLAGS[@]}"
100+
pod trunk push mParticle-Apple-SDK-Swift.podspec "${PUSH_FLAGS[@]}"
101101
pod trunk push mParticle-Apple-SDK-ObjC.podspec "${PUSH_FLAGS[@]}"
102102
pod trunk push mParticle-Apple-SDK.podspec "${PUSH_FLAGS[@]}"
103103

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ You are a senior iOS SDK engineer specializing in customer data platform (CDP) S
4343
- Build: via Xcode scheme or `xcodebuild`.
4444
- Run unit tests: `Rokt_WidgetTests/` or via Xcode (Command + U).
4545
- Lint: `trunk check` (primary enforcement tool).
46-
- Pod lint: `pod lib lint mParticle-Apple-SDK.podspec --include-podspecs="{mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec,mParticle-Apple-SDK-ObjC.podspec,mParticle-Apple-SDK.podspec}"` (same as CI).
46+
- Pod lint: `pod lib lint mParticle-Apple-SDK.podspec --include-podspecs="{mParticle-Apple-SDK-Swift.podspec,mParticle-Apple-SDK-ObjC.podspec,mParticle-Apple-SDK.podspec}"` (same as CI).
4747
- Size report: Check binary size impact via CI workflow.
4848
- Always validate changes with the full sequence in "Code style, quality, and validation" below before proposing or committing.
4949

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Review and merge the PR. On merge, the **Release – Publish** workflow runs aut
3535
> The Swift SDK podspec (`mParticle-Apple-SDK-Swift`) is not yet published automatically — push it manually before the core SDK if required:
3636
>
3737
> ```bash
38-
> pod trunk push mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec --allow-warnings
38+
> pod trunk push mParticle-Apple-SDK-Swift.podspec --allow-warnings
3939
> ```
4040
4141
## Post-release verification

mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec renamed to mParticle-Apple-SDK-Swift.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Pod::Spec.new do |s|
99
DESC
1010

1111
s.homepage = "https://www.mparticle.com"
12-
s.license = { :type => 'Apache 2.0', :file => '../LICENSE'}
12+
s.license = { :type => 'Apache 2.0', :file => 'LICENSE'}
1313
s.author = { "mParticle" => "support@mparticle.com" }
1414
s.source = { :git => "https://github.com/mParticle/mparticle-apple-sdk.git", :tag => "v" + s.version.to_s }
1515
s.documentation_url = "https://docs.mparticle.com/developers/sdk/ios/"
@@ -19,5 +19,5 @@ Pod::Spec.new do |s|
1919
s.tvos.deployment_target = "15.6"
2020
s.swift_versions = ["5.0"]
2121

22-
s.source_files = 'Sources/**/*.swift'
22+
s.source_files = 'mParticle-Apple-SDK-Swift/Sources/**/*.swift'
2323
end

0 commit comments

Comments
 (0)