Skip to content

Add Package.swift support for tuist edit - #5751

Merged
danieleformichelli merged 4 commits into
mainfrom
edit/package-dependencies
Jan 2, 2024
Merged

Add Package.swift support for tuist edit#5751
danieleformichelli merged 4 commits into
mainfrom
edit/package-dependencies

Conversation

@fortmarek

Copy link
Copy Markdown
Member

Resolves #5537

Short description 📝

Add Package.swift support for tuist edit.

The implementation more-or-less copies the business logic for Dependencies.swift. But apart from having a new scheme Packages that includes the file Package.swift, we also needed to ensure we include the PackageDescription framework and we build it with the correct version defined by swift-tools-version comment.

That's achieved by:

  • Setting -package-description-version x.y.z for OTHER_SWIFT_FLAGS where .x.y.z can be extracted from swift package tools-version command
  • And /Applications/Xcode-x.y.z.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI SWIFT_INCLUDE_PATHS

How to test the changes locally 🧐

Run tuist edit for fixtures/app_with_spm_dependencies

Contributor checklist ✅

  • The code has been linted using run make workspace/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

/// - printOutput: When true it prints the Swift Package Manager's output.
func update(at path: AbsolutePath, printOutput: Bool) throws

/// Sets tools version of package to the given value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gets the tools version of the package at the given path

try System.shared.run(command)
}

public func getToolsVersion(at path: AbsolutePath) throws -> Version {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd add an integration test to this one.

Comment thread Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift
Comment thread Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift
@danieleformichelli
danieleformichelli merged commit 9980b39 into main Jan 2, 2024
@danieleformichelli
danieleformichelli deleted the edit/package-dependencies branch January 2, 2024 23:05
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.

Tuist/Package.swift not included in Xcode when running "tuist edit"

3 participants