Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor install_swiftpm_dependencies to allow specifying workspace/scheme/project #105

Merged
merged 14 commits into from
Sep 6, 2024

Conversation

AliSoftware
Copy link
Contributor

@AliSoftware AliSoftware commented Aug 6, 2024

Why?

To solve issues like the one reported in Automattic/pocket-casts-ios#1990

TL;DR: the install_swiftpm_dependencies utility was calling xcodebuild -resolvePackageDependencies without the -workspace flag, thus relying on the Package.resolved from the .xcodeproj instead of the .xcworkspace by default (at least that's how that xcodebuild command seems to behave).
This led to us having multiple Package.resolved files (one in xcodeproj, one in xcworkspace, and two sources of truth that were disagreeing with each other, depending on which method we used to resolve the dependencies last (Xcode UI or xcodebuild or this a8c-ci-toolkit utility).

What?

This PR makes some changes to our install_swiftpm_dependencies utility so that:

  • The caller can specify --workspace PATH --scheme NAME explicitly to resolve dependencies based on an Xcode .xcworkspace workspace
  • Or alternatively specify --project PATH explicitly to resolve dependencies based on an Xcode lone .xcodeproj project
  • Or alternatively explicitly specify --use-spm to use swift package resolve instead of xcodebuild (typically for library repos which don't have an Xcode project and workspace and fully rely on a Package.swift file at the root)
  • Improve the logic at attempting to auto-detect the right thing to do when none of the above parameters are provided
    • If there's a single xcworkspace at the root of the repo, and no Package.swift at the root, use xcodebuild -workspace, using (arbitrarily) the first scheme found in that workspace for the -scheme parameter of xcodebuild (that is documented not to be needed but in practice errors out if not provided—there might be room for improvement here / hope for not needing this after all though).
    • Otherwise if there's no xcworkspace but there's a Package.swift file, use swift package resolve
  • Ensure that we use -workspace when resolving swift dependencies using xcodebuild and have the cache key and the dependency resolution both based on the .xcworkspace/xcshareddata/swiftpm/Package.resolved file—as opposed to incorrectly using one from a *.xcodeproj/**/Package.resolved.

WIP / Draft

Important

The changes in this PR and bash script have not been really tested. In practice I've written the logic mostly blind (i.e. without trying to run it on any repo to test it), and I'm only opening the PR as Draft so soon so I can get feedback on the code and the logic.

We should definitively take some extra time to test those changes on various repos in various setups:

  • lib repo with Package.swift, repo with .xcworkspace at repo root but .xcodeproj in subdir, repo with both .xcworkspace and .xcodeproj files at repo root, repo with multiple .xcworkspace and/or .xcodeproj files and multiple Package.resolved files, repos with no Package.resolved file at all…;
  • calling the utility with explicit --workspace/--scheme/--project/--use-spm parameters, with only --workspace and letting it guess the scheme, with no parameter, …

Compatibility / Breaking Change

Note that this is technically a breaking change for the install_swiftpm_dependencies utility, since it previously accepted 2 optional extra arguments (full custom path to Package.resolved, and build type), while the new implementation doesn't accept those optional extra arguments anymore.

This is intentional, as:

  • It would be complex (and for little benefit) to keep backwards compatibility while also making it consistent with the new flags
  • But more importantly, I think those optional arguments were not working as expected. In particular, providing a custom path for the Package.resolved as the first argument made this path used for the computation of the cache key during cache restoration and save… but that custom file was not the one used by swift package resolve or xcodebuild -resolvePackageDependencies during dependency resolution, so that would lead to inconsistencies and odd behaviors if used

Tbh though, I'm not even sure any of our repos currently calling install_swiftpm_dependencies ever passed extra parameters to it though, so those were probably never ever used in practice anyway?

Suggestion for adopting repos

Repos like PocketCasts-iOS were having issues with that utility because it was inconsistently using either podcasts.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved when calling xcodebuild -resolvePackageDependencies(without a -workspace, thus making it fallback to the .xcodeproj) during resolution while the cache was relying on podcasts.xcworkspace/xcshareddata/swiftpm/Package.resolved for the cache (or when developers resolved dependencies via Xcode and commited that file), and those two different Package.resolved files were not in sync.

I'd suggest for repos in such situations to:

  • Delete the *.xcodeproj/xcshareddata/swiftpm/Package.resolved file and remove it from git, so that only the one in the *.xcworkspace is kept around
  • Update the calls to install_swiftpm_dependencies in the .buildkite/** scripts to provide the --workspace (and --scheme) explicitly

  • I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.

bin/install_swiftpm_dependencies Outdated Show resolved Hide resolved
Comment on lines 104 to 109
if [[ -z "${SCHEME_NAME}" ]]; then
SCHEME_NAME=$(xcodebuild -workspace "${XCWORKSPACE_PATH}" -onlyUsePackageVersionsFromResolvedFile -skipPackageUpdates -list | sed -n '/Schemes:/{n;s/^ *//p;}')
echo "No \`--scheme\` parameter provided; assuming the first one found (as it shouldn't matter in practice?): \`${SCHEME_NAME}\`"
fi
echo "Using -workspace \"${XCWORKSPACE_PATH}\" -scheme \"${SCHEME_NAME}\""
xcodebuild -workspace "${XCWORKSPACE_PATH}" -scheme "${SCHEME_NAME}" -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 🤞 I'll have to do some more tests(†) to validate this, but from my quick experiments it seems that when I ran xcodebuild -workspace "${XCWORKSPACE_PATH}" -list (initially to guess a scheme to use)… xcodebuild printed "Resolve Package Graph", suggesting that it was resolving dependencies first before finally printing the list of schemes…

Which might mean that we could use this to our advantage, to just pass -list instead of having to pass an explicit -scheme NAME (i.e. xcodebuild -workspace -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile -list)… which would completely avoid the need to pass a -scheme to the command in the first place (just because of the bug of xcodebuild requiring -scheme [or -list] to be provided when -workspace is also provided… even in cases where the scheme doesn't matter, like iinm in the case of resolving dependencies)


(†) we should test this theory thoroughly though, especially with some edge cases—like deliberately have an outdated Package.resolved pointing to older versions, and/or ensuring the packages are not present yet locally, before running those commands—to check especially if the -onlyUsePackageVersionsFromResolvedFile is honored by xcodebuild (as opposed to being ignored when we use -list instead of an explicit -scheme NAME).


But if this ends up behaving like I hope, this means that we could simplify the whole code of this bash script by:

  • Removing the --scheme input parameter parsing from this utility
  • Directly invoke xcodebuild -workspace "${XCWORKSPACE_PATH}" -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile -list—in order to resolve the Swift Dependencies with xcodebuild while still ensuring it'd use the .xcworkspace and not .xcodeproj, yet without having to provide a -scheme option

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but from my quick experiments it seems that when I ran xcodebuild -workspace "${XCWORKSPACE_PATH}" -list (initially to guess a scheme to use)… xcodebuild printed "Resolve Package Graph", suggesting that it was resolving dependencies first before finally printing the list of schemes…

That's what I observe on my end, too. In Pocket Casts iOS:

➜ xcodebuild -workspace "podcasts.xcworkspace" -list
Command line invocation:
    /Applications/Xcode-16.0.0-Beta.3.app/Contents/Developer/usr/bin/xcodebuild -workspace podcasts.xcworkspace -list

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Resolve Package Graph


Resolved source packages:
  AutomatticTracksiOS: https://github.com/Automattic/Automattic-Tracks-iOS @ 3.4.2
  SwiftProtobuf: https://github.com/apple/swift-protobuf.git @ 1.22.1
  GTMAppAuth: https://github.com/google/GTMAppAuth.git @ 4.1.1
  Kingfisher: https://github.com/onevcat/Kingfisher @ 7.10.2
  TinyCSV: https://github.com/dagronf/TinyCSV @ 1.0.0
  JLRoutes: https://github.com/joeldev/JLRoutes @ 2.1.1
  Agrume: https://github.com/Automattic/Agrume @ 5.6.13
  Sentry: https://github.com/getsentry/sentry-cocoa @ 8.29.1
  SwiftSubtitles: https://github.com/dagronf/SwiftSubtitles @ 1.5.2
  DSFRegex: https://github.com/dagronf/DSFRegex @ 3.4.0
  Firebase: https://github.com/firebase/firebase-ios-sdk.git @ 10.25.0
  GoogleSignIn: https://github.com/google/GoogleSignIn-iOS @ 7.1.0
  abseil: https://github.com/google/abseil-cpp-binary.git @ 1.2024011601.1
  AppAuth: https://github.com/openid/AppAuth-iOS.git @ 1.7.5
  DifferenceKit: https://github.com/ra1028/DifferenceKit @ 1.2.0
  UIDeviceIdentifier: https://github.com/squarefrog/UIDeviceIdentifier @ 2.1.0
  AppCheck: https://github.com/google/app-check.git @ 10.19.0
  leveldb: https://github.com/firebase/leveldb.git @ 1.22.2
  GoogleAppMeasurement: https://github.com/google/GoogleAppMeasurement.git @ 10.25.0
  InteropForGoogle: https://github.com/google/interop-ios-for-google-sdks.git @ 100.0.0
  BuildkiteTestCollector: https://github.com/buildkite/test-collector-swift @ 0.1.1
  GoogleUtilities: https://github.com/google/GoogleUtilities.git @ 7.12.1
  Lottie: https://github.com/airbnb/lottie-ios.git @ 4.4.0
  Promises: https://github.com/google/promises.git @ 2.3.1
  PocketCastsServer: /Users/gio/Developer/a8c/pcios/Modules/Server
  GoogleDataTransport: https://github.com/google/GoogleDataTransport.git @ 9.3.0
  PocketCastsDataModel: /Users/gio/Developer/a8c/pcios/Modules/DataModel
  Sodium: https://github.com/jedisct1/swift-sodium @ 0.9.1
  gRPC: https://github.com/google/grpc-binary.git @ 1.62.2
  nanopb: https://github.com/firebase/nanopb.git @ 2.30909.0
  Fuse: https://github.com/krisk/fuse-swift @ 1.4.0
  FMDB: https://github.com/ccgus/fmdb.git @ 2.7.8
  GTMSessionFetcher: https://github.com/google/gtm-session-fetcher.git @ 3.4.1
  PocketCastsUtils: /Users/gio/Developer/a8c/pcios/Modules/Utils
  SwipeCellKit: https://github.com/shiftyjelly/SwipeCellKit @ 2.7.7

Information about workspace "podcasts":
    Schemes:
        BuildkiteTestCollector
        DSFRegex
        google-cast-sdk-no-bluetooth
        NotificationContent
        NotificationExtension
        Pocket Casts Prototype Build
        Pocket Casts Staging
        Pocket Casts Watch App
        pocketcasts
        PocketCastsDataModel
        PocketCastsServer
        PocketCastsUtils
        PodcastsIntents
        PodcastsIntentsUI
        Pods-PocketCastsTests
        Pods-podcasts
        PreBuildActions
        PulseCore
        PulseUI
        Screenshot Automation
        Screenshot Automation Watch
        Share Extension
        SwiftGen
        SwiftLint
        WidgetExtension

Copy link
Contributor

@mokagio mokagio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving some comments give this is a draft, still

bin/install_swiftpm_dependencies Outdated Show resolved Hide resolved
bin/install_swiftpm_dependencies Outdated Show resolved Hide resolved
bin/install_swiftpm_dependencies Outdated Show resolved Hide resolved
bin/install_swiftpm_dependencies Outdated Show resolved Hide resolved
bin/install_swiftpm_dependencies Outdated Show resolved Hide resolved
bin/install_swiftpm_dependencies Outdated Show resolved Hide resolved
Comment on lines 104 to 109
if [[ -z "${SCHEME_NAME}" ]]; then
SCHEME_NAME=$(xcodebuild -workspace "${XCWORKSPACE_PATH}" -onlyUsePackageVersionsFromResolvedFile -skipPackageUpdates -list | sed -n '/Schemes:/{n;s/^ *//p;}')
echo "No \`--scheme\` parameter provided; assuming the first one found (as it shouldn't matter in practice?): \`${SCHEME_NAME}\`"
fi
echo "Using -workspace \"${XCWORKSPACE_PATH}\" -scheme \"${SCHEME_NAME}\""
xcodebuild -workspace "${XCWORKSPACE_PATH}" -scheme "${SCHEME_NAME}" -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but from my quick experiments it seems that when I ran xcodebuild -workspace "${XCWORKSPACE_PATH}" -list (initially to guess a scheme to use)… xcodebuild printed "Resolve Package Graph", suggesting that it was resolving dependencies first before finally printing the list of schemes…

That's what I observe on my end, too. In Pocket Casts iOS:

➜ xcodebuild -workspace "podcasts.xcworkspace" -list
Command line invocation:
    /Applications/Xcode-16.0.0-Beta.3.app/Contents/Developer/usr/bin/xcodebuild -workspace podcasts.xcworkspace -list

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Resolve Package Graph


Resolved source packages:
  AutomatticTracksiOS: https://github.com/Automattic/Automattic-Tracks-iOS @ 3.4.2
  SwiftProtobuf: https://github.com/apple/swift-protobuf.git @ 1.22.1
  GTMAppAuth: https://github.com/google/GTMAppAuth.git @ 4.1.1
  Kingfisher: https://github.com/onevcat/Kingfisher @ 7.10.2
  TinyCSV: https://github.com/dagronf/TinyCSV @ 1.0.0
  JLRoutes: https://github.com/joeldev/JLRoutes @ 2.1.1
  Agrume: https://github.com/Automattic/Agrume @ 5.6.13
  Sentry: https://github.com/getsentry/sentry-cocoa @ 8.29.1
  SwiftSubtitles: https://github.com/dagronf/SwiftSubtitles @ 1.5.2
  DSFRegex: https://github.com/dagronf/DSFRegex @ 3.4.0
  Firebase: https://github.com/firebase/firebase-ios-sdk.git @ 10.25.0
  GoogleSignIn: https://github.com/google/GoogleSignIn-iOS @ 7.1.0
  abseil: https://github.com/google/abseil-cpp-binary.git @ 1.2024011601.1
  AppAuth: https://github.com/openid/AppAuth-iOS.git @ 1.7.5
  DifferenceKit: https://github.com/ra1028/DifferenceKit @ 1.2.0
  UIDeviceIdentifier: https://github.com/squarefrog/UIDeviceIdentifier @ 2.1.0
  AppCheck: https://github.com/google/app-check.git @ 10.19.0
  leveldb: https://github.com/firebase/leveldb.git @ 1.22.2
  GoogleAppMeasurement: https://github.com/google/GoogleAppMeasurement.git @ 10.25.0
  InteropForGoogle: https://github.com/google/interop-ios-for-google-sdks.git @ 100.0.0
  BuildkiteTestCollector: https://github.com/buildkite/test-collector-swift @ 0.1.1
  GoogleUtilities: https://github.com/google/GoogleUtilities.git @ 7.12.1
  Lottie: https://github.com/airbnb/lottie-ios.git @ 4.4.0
  Promises: https://github.com/google/promises.git @ 2.3.1
  PocketCastsServer: /Users/gio/Developer/a8c/pcios/Modules/Server
  GoogleDataTransport: https://github.com/google/GoogleDataTransport.git @ 9.3.0
  PocketCastsDataModel: /Users/gio/Developer/a8c/pcios/Modules/DataModel
  Sodium: https://github.com/jedisct1/swift-sodium @ 0.9.1
  gRPC: https://github.com/google/grpc-binary.git @ 1.62.2
  nanopb: https://github.com/firebase/nanopb.git @ 2.30909.0
  Fuse: https://github.com/krisk/fuse-swift @ 1.4.0
  FMDB: https://github.com/ccgus/fmdb.git @ 2.7.8
  GTMSessionFetcher: https://github.com/google/gtm-session-fetcher.git @ 3.4.1
  PocketCastsUtils: /Users/gio/Developer/a8c/pcios/Modules/Utils
  SwipeCellKit: https://github.com/shiftyjelly/SwipeCellKit @ 2.7.7

Information about workspace "podcasts":
    Schemes:
        BuildkiteTestCollector
        DSFRegex
        google-cast-sdk-no-bluetooth
        NotificationContent
        NotificationExtension
        Pocket Casts Prototype Build
        Pocket Casts Staging
        Pocket Casts Watch App
        pocketcasts
        PocketCastsDataModel
        PocketCastsServer
        PocketCastsUtils
        PodcastsIntents
        PodcastsIntentsUI
        Pods-PocketCastsTests
        Pods-podcasts
        PreBuildActions
        PulseCore
        PulseUI
        Screenshot Automation
        Screenshot Automation Watch
        Share Extension
        SwiftGen
        SwiftLint
        WidgetExtension

@mokagio
Copy link
Contributor

mokagio commented Aug 7, 2024

I took this branch for a swing in Pocket Casts iOS – for other readers reference: that's the repo that originally gave us problems because of the double Package.resolved – and the automatic resolver worked smoothly:

https://buildkite.com/automattic/pocket-casts-ios/builds/7680#01912b6b-222e-4f57-bfe5-09cdc9038bff

AliSoftware and others added 12 commits August 8, 2024 17:59
Co-authored-by: Gio Lodi <[email protected]>
 + Improve parsing by now allowing conflicting options but only parsing one
 + Adjust some wording
If path to `--workspace` or `--project` not found, still compute the `PACKAGE_RESOLVED_LOCATION` and let the test of file existence (`[[ ! -f "${PACKAGE_RESOLVED_LOCATION}" ]]` provide a better error message.

As opposed to using `-d` (`[[ -d "${XCWORKSPACE_PATH}" ]]` and `[[ -d "${XCODEPROJ_PATH}" ]]`), which would be false when that path doesn't exist and would resultin `PACKAGE_RESOLVED_LOCATION` being unassigned… and lead to a confusing error (`unable to guess path`) as a result.
@AliSoftware AliSoftware marked this pull request as ready for review August 8, 2024 21:23
@AliSoftware
Copy link
Contributor Author

@mokagio Ok I've updated the PR to address all your feedback & remove the need for --scheme, to instead directly use -list to workaround xcodebuild -workspace complaining about -scheme missing otherwise. This seems to work as expected.

What I'm unsure about now, is if not providing a -clonedSourcePackagesDirPath explicitly will work well in concert with us building the app with a custom DerivedData on CI (especially via our fastlane's build_app calls).
For example, if we call install_swiftpm_dependencies and it doesn't provide a -clonedSourcePackagesDirPath. it will clone the checkout in ~/Library/Developer/Xcode/DerivedData/{projectname}-{somestring}/SourcePackages/checkouts, the same that Xcode.app uses during "Resolve Package Dependencies"

  • But then if we call build_app from fastlane with a custom DerivedData (which ends up using xcodebuild -derivedDataPath <custompath>)… will this find the packages that were prefetched by install_swiftpm_dependencies given it's using a different DerivedData after all?
  • I haven't tested if passing -derivedDataPath to the xcodebuild -resolvePackageDependencies call of install_swiftpm_dependencies would magically make the -clonedSourcePackagesDirPath be derived from it (to <provided-DerivedDataPath>/SourcePackages?) if not provided explicitly, or if they are independent, or if one always have to explicitly provide -clonedSourcePackagesDirPath or whatnot… but wondering if all that warrants more testing in the end.

Besides, what install_swiftpm_dependencies currently zips and saves in our cache is always the content of #{SPM_CACHE_LOCATION} in practice. But I wonder if that's the right folder to cache and if it's working as expected when we end up using xcodebuild -resolvePackageDependencies as opposed to swift package resolve 🤔 Or maybe we should pass -clonedSourcePackagesDirPath "${SPM_CACHE_LOCATION}" to our call to xcodebuild? Or provide an extra option to install_swiftpm_dependencies to specify a custom --derivedDataPath (and use -clonedSourcePackagesDirPath ${DERIVED_DATA_PATH}/SourcePackages in our call to xcodebuild and zip that folder instead of SPM_CACHE_LOCATION)?!

@AliSoftware
Copy link
Contributor Author

AliSoftware commented Aug 8, 2024

Ok, looking a bit more into it, I think the checkouts/ folder was misleading me (that's what you get when trying to make your brain work very late in the day 😅 ), and what's really important and the right source of truth is probably the bare repo (i.e. what looks like the result of a git clone --bare, with the direct content of the .git/ repo with refs, objects, etc) that is cloned (in ~/Library/Developer/Xcode/DerivedData/…/SourcePackages/repositories and/or in ~/Library/Caches/org.swift.swiftpm).

Indeed I think it's likely that both swift package and xcodebuild -resolvePackageDependencies use that bare repo as source of truth and to regenerate the checkouts folders—as the original comment from @spencertransier suggests at the end of the install_swiftpm_dependencies script when he initially wrote it, where we delete checkouts and artifacts folders as they can apparently be recreated from repositories.

Doing a rm -rf ~/Library/Caches/org.swift.swiftpm + a rm -rf ~/Library/Developer/Xcode/DerivedData/pocketcasts-hlevzbwzwxgpqbfpbknqqyqkauze/ to remove both and then calling xcodebuild -workspace podcasts.xcworkspace -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile -list ends up recreating both ~/Library/Caches/org.swift.swiftpm/repositories and ~/Library/Developer/Xcode/DerivedData/pocketcasts-hlevzbwzwxgpqbfpbknqqyqkauze/SourcePackages/respositories, both with the exact same content (verified with opendiff).

Similarly, rm -rf it all again then doing xcodebuild -workspace podcasts.xcworkspace -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile -clonedSourcePackagesDirPath ./MySourcePackages -list and comparing ~/Library/Caches/org.swift.swiftpm/respositories and MySourcePackages/repositories with opendiff confirms they are identical.

Finally only rm -rf MySourcePackages but keeping ~/Library/Caches/org.swift.swiftpm untouched, and then re-running xcodebuild -workspace podcasts.xcworkspace -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile -clonedSourcePackagesDirPath ./MySourcePackages -list I can confirm that this doesn't fetch the repos from the net but uses the local cache, as proven by the fact that the operation is quite faster and that the logs don't contain Fetching from https://github.com/{org}/{repo}.git logs like they did when I removed ~/Library/Caches/org.swift.swiftpm, but only show Creating working copy of package ‘{packagename}’ and `Checking out {version} of package ‘{packagename}’ in those logs 🎉


So TL;DR I guess I just got confused by it being late here and not knowing how it was working with the difference between checkouts vs [bare] repositories, but in the end I think we're all good after all.
After all this investigation I think the caching per-se (and its goal to not have the CI fetch repositories from the web but from local cache instead) should work as expected regardless of the project using a custom DerivedData, and that we're still always zipping and storing the right $SPM_CACHE_LOCATION even for when we're using xcodebuild -resolvePackages after all 🎉

(Phew, what an adventure.)

* Add `README` for `install_swiftpm_dependencies` tests

* Add `install_swiftpm_dependencies` test for standalone package

* Add `install_swiftpm_dependencies` with `--use-spm` parameter

* Put commands in the `$PATH` for `install_swiftpm_dependencies` tests

* Rename `tests/spm_caching` to `test/install_swiftpm_dependencies`

Clearer, right?

* Move test instructions to script to correctly export `$PATH`

* Fix inverted cmds in CI

* Add test for `xcodeproj` with automatic detection

* Add test for `xcodeproj` with explicit parameter

* Add tests for `install_swiftpm_dependencies` with `xcworkspace`

* Remove backticks from group name—They don't render

* Rename `standalone_package` to `package`

* Rename `xcodeproj` to `project`

* Make `test_workspace_*` executable

* Add tests for scenario with both workspace and project in the same dir

* Fix outdated scripts names

* Add `set -o pipefail` to test scripts to avoid false positives

* Fix typo in test script path

* Move test scripts in dedicated folder to keep tidy

* Update `xcworkspace` lookup to avoid false negative

* Revert "Update `xcworkspace` lookup to avoid false negative"

This reverts commit 4e7c222.

* Remove trailing whitespaces from `install_swiftpm_dependencies`

* Use `shopt -s nullglob` to avoid false negative

* Code-generate project

* Add handling to auto-detect standalone project

* Generate `Package.resolved` for xcodegen project

* Fix path in `test_workspace_and_project_automatic.sh`

* Replace hardcode `project` with code-generated one

* Replace project in workspace+project setup with code-generated one

* Fix code-gen Buildkite script paths

* Add missing `xcodegen` in some CI tests

* Fix `pushd` not working from Makefile - Bypass it

* Streamline `.gitignore` in `workspace`

* Use `make` in `project` for consistency

* Dry Buildkite pipeline

* DRY env setup for SPM tests

* DRY `xcodebuild` call in tests

* Fix unbound TESTS_LOCATION

* Fix wrong path for `xcodebuild`

* Remove misplaced `USE_SPM` set

* Use a fixture `Package.resolved`

* Add test for `xcodeproj` without `Package.resolved`

* Make a `~~~` group print a confirmation to avoid empty logs

* Refine error logging in `test_project_no_package.sh`

* Apply suggestions from code review

* Revert change for `workspace_and_project/Makefile`

Seems the `cp` of the `project.yml` was intentional after all, as using `--spec` instead broke it on CI

---------

Co-authored-by: Olivier Halligon <[email protected]>
@AliSoftware
Copy link
Contributor Author

Now that the Integration Tests from #109 have been merged into this PR, this is now ready for a final review before auto-merge! cc @mokagio @spencertransier

@AliSoftware AliSoftware requested a review from a team September 4, 2024 17:38
@AliSoftware AliSoftware enabled auto-merge (squash) September 4, 2024 17:38
Copy link
Contributor

@mokagio mokagio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@AliSoftware AliSoftware merged commit 2fe5abf into trunk Sep 6, 2024
13 checks passed
@AliSoftware AliSoftware deleted the install_swiftpm_dependencies-improvements branch September 6, 2024 04:20
AliSoftware added a commit that referenced this pull request Sep 9, 2024
We forgot to add a CHANGELOG entry for it before merging
AliSoftware added a commit that referenced this pull request Sep 9, 2024
We forgot to add a CHANGELOG entry for it before merging
AliSoftware added a commit that referenced this pull request Sep 9, 2024
We forgot to add a CHANGELOG entry for it before merging
mokagio added a commit to Automattic/pocket-casts-ios that referenced this pull request Nov 21, 2024
We disabled this because of an issue with package resolution, see
#1990

Since then, a fix has been implemented in the command, see
Automattic/a8c-ci-toolkit-buildkite-plugin#105
so we can re-enable it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants