Skip to content

swift pacakage update --dry-run should not update the package #9339

@bkhouri

Description

@bkhouri

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

The swift package update --help is as follows

❯ swift package update --help                                                           
OVERVIEW: Update package dependencies.

USAGE: swift package update [--dry-run] [<packages> ...]

ARGUMENTS:
  <packages>              The packages to update.

OPTIONS:
  -n, --dry-run           Display the list of dependencies that can be updated.
  --version               Show the version.
  -h, -help, --help       Show help information.

The --dry-run option indicates Display the list of dependencies that can be updated.. I expect that using the --dry-run option does not actually update the package, or perform any changes to the swiftpm checkouts. When running swift package update --dry-run on the Swift Package manager repository, the output gave the impression that packages were updated.

Expected behavior

The command output does not contains any test related to Updating <repository>.... Instead, it should indicated: Would update..., or something similar.

Actual behavior

When running swift package update --dry-run on the Swift Package manager repository, the output gave the impression that packages were updated.

❯ swift package update --dry-run
Updating https://github.com/swiftlang/swift-llbuild.git
Updated https://github.com/swiftlang/swift-llbuild.git (0.49s)
Updating https://github.com/swiftlang/swift-syntax.git
Updated https://github.com/swiftlang/swift-syntax.git (0.50s)
Updating https://github.com/apple/swift-argument-parser.git
Updated https://github.com/apple/swift-argument-parser.git (0.26s)
Updating https://github.com/apple/swift-crypto.git
Updated https://github.com/apple/swift-crypto.git (0.38s)
Updating https://github.com/apple/swift-system.git
Updated https://github.com/apple/swift-system.git (0.32s)
Updating https://github.com/apple/swift-collections.git
Updated https://github.com/apple/swift-collections.git (0.26s)
Updating https://github.com/apple/swift-certificates.git
Updated https://github.com/apple/swift-certificates.git (0.22s)
Updating https://github.com/swiftlang/swift-toolchain-sqlite.git
Updated https://github.com/swiftlang/swift-toolchain-sqlite.git (0.21s)
Updating https://github.com/swiftlang/swift-tools-support-core.git
Updated https://github.com/swiftlang/swift-tools-support-core.git (0.38s)
Updating https://github.com/swiftlang/swift-driver.git
Updated https://github.com/swiftlang/swift-driver.git (0.54s)
Updating https://github.com/swiftlang/swift-build.git
Updated https://github.com/swiftlang/swift-build.git (0.53s)
Updating https://github.com/apple/swift-asn1.git
Updating https://github.com/swiftlang/swift-docc-plugin
Updated https://github.com/swiftlang/swift-docc-plugin (0.23s)
Updated https://github.com/apple/swift-asn1.git (0.23s)
Computing version for https://github.com/apple/swift-asn1.git
Computed https://github.com/apple/swift-asn1.git at 1.5.0 (0.97s)
Computing version for https://github.com/swiftlang/swift-docc-plugin
Computed https://github.com/swiftlang/swift-docc-plugin at 1.4.5 (0.54s)
Updating https://github.com/swiftlang/swift-docc-symbolkit
Updated https://github.com/swiftlang/swift-docc-symbolkit (0.38s)
Computing version for https://github.com/swiftlang/swift-docc-symbolkit
Computed https://github.com/swiftlang/swift-docc-symbolkit at 1.0.0 (1.10s)
2 dependencies have changed:
~ swift-driver main -> swift-driver Revision(identifier: "09dadbf525bfecc258aafcb92ec31547a48fe26d") main
~ swift-build main -> swift-build Revision(identifier: "4f60486f02817e2b828c24fa66a5ba9b6c87d481") main

Steps to reproduce

  1. Clone a repository
  2. Run swift package update
  3. Modify the Package.swift such that a package dependency is modified, and ensure the project compiles with said dependency
  4. Run swift package update --dry-run and inspect the output.

Swift Package Manager version/commit hash

Swift Package Manager - Swift 6.2.0-dev

Swift & OS version (output of swift --version ; uname -a)

Swift Toolchain:

❯ swift --version        
Apple Swift version 6.2 (swift-6.2-RELEASE)
Target: arm64-apple-macosx26.0
Build config: +assertions

Host:

❯ uname -a
Darwin BKs-Work-MBP-M4-Pro.local 25.2.0 Darwin Kernel Version 25.2.0: Fri Oct 24 23:25:15 PDT 2025; root:xnu_development-12377.60.50.0.2~12/DEVELOPMENT_ARM64_T6041 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions