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

Add xcodePackage target dependency with better local package support #6060

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fortmarek
Copy link
Member

@fortmarek fortmarek commented Mar 9, 2024

Short description πŸ“

This PR adds a new TargetDependency:

public enum PackageSource: Hashable, Codable {
  case local(Path)
  case external
}

case xcodePackage(product: String, source: PackageSource = .external, condition: PlatformCondition? = nil)

This new type should eventually replace the current external dependency. I am not deprecating that case just yet until we stabilise the new API.

The primary purpose of the new API is to make it easier to link to local packages from existing Project.swift.

Before, users had to link all their local packages in the Tuist/Package.swift. Additionally, these local packages were missing the autogenerated schemes that one would expect for local targets.

The new API allows developers to directly link to local packages. It doesn't come without tradeoffs – primarily, remote dependencies in local packages still need to be defined in Tuist/Package.swift. However, local packages can link to remote dependencies via .byName (or a pure String) as long as the dependency is resolved with the Tuist/Package.swift.

We believe this will bring better ergonomics of migrating to Tuist when coming from SPM-based modularization and make Package.swift a first-class manifest.

How to test the changes locally 🧐

Play with app_with_spm_dependencies where we're using the new integration for local packages.

Contributor checklist βœ…

  • The code has been linted using run mise run lint:fix
  • The change is tested via unit testing or acceptance testing, or both
  • The title of the PR is formulated in a way that is usable as a changelog entry
  • In case the PR introduces changes that affect users, the documentation has been updated

Reviewer checklist βœ…

  • The code architecture and patterns are consistent with the rest of the codebase
  • Reviewer has checked that, if needed, the PR includes the label changelog:added, changelog:fixed, or changelog:changed, and the title is usable as a changelog entry

@fortmarek fortmarek marked this pull request as ready for review March 9, 2024 21:32
@fortmarek fortmarek added the changelog:added PR will be listed in the Added section of CHANGELOG label Mar 9, 2024
@mihaicris-adoreme
Copy link
Contributor

mihaicris-adoreme commented Mar 10, 2024

Is it possible to add also an API to Package type
https://docs.tuist.io/documentation/tuist/package
like
case xcodePackage(product: String)
so we can add Project Packages (Xcode SPM integration) with packages defined in Tuist/Package.swift by name, also for migration from legacy dependency integration style?
This would help in having the external urls and requirements for dependencies in only one place (Tuist/Package.swift).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:added PR will be listed in the Added section of CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants