swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.71k stars 1.33k forks source link

[SR-12210] [5.2] Target depends on an unknown package #4593

Open swift-ci opened 4 years ago

swift-ci commented 4 years ago
Previous ID SR-12210
Radar rdar://problem/59496049
Original Reporter tannernelson (JIRA User)
Type Bug
Environment Apple Swift version 5.2 (swiftlang-1103.0.22 clang-1103.0.22) Target: x86_64-apple-darwin19.2.0 Version 11.4 beta (11N111s) Toolchain: Swift 5.2 Snapshot 2020-02-14 (a) macOS 10.15.2
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 2 | |Component/s | Package Manager | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 8ed4f7d56eceb94fbbf6b4ed97820af7

Issue Description:

I'm getting the following error when upgrading my `swift-tools-version` from 5.1 to 5.2:

/Users/tanner/dev/vapor/fluent-kit/Package.swift: manifest parse error: target 'FluentKit' depends on an unknown package 'NIO'

Here's the Package.swift file:

// swift-tools-version:5.2
import PackageDescription

let package = Package(
    name: "fluent-kit",
    platforms: [
       .macOS(.v10_14)
    ],
    products: [
        .library(name: "FluentKit", targets: ["FluentKit"]),
        .library(name: "FluentBenchmark", targets: ["FluentBenchmark"]),
        .library(name: "FluentSQL", targets: ["FluentSQL"]),
    ],
    dependencies: [
        .package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0"),
        .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
        .package(url: "https://github.com/vapor/sql-kit.git", from: "3.0.0-beta.6.1"),
    ],
    targets: [
        .target(name: "FluentKit", dependencies: ["NIO", "Logging"]),
        .target(name: "FluentBenchmark", dependencies: ["FluentKit", "FluentSQL"]),
        .target(name: "FluentSQL", dependencies: ["FluentKit", "SQLKit"]),
        .testTarget(name: "FluentKitTests", dependencies: ["FluentBenchmark", "FluentSQL"]),
    ]
)
beccadax commented 4 years ago

@swift-ci create

aciidgh commented 4 years ago

Can you try with the latest snapshot? We've fixed some bugs in this area and improved the diagnostics.

swift-ci commented 4 years ago

Comment by Jonny (JIRA)

Im also getting this with 5.2 but slightly different package:

import PackageDescription
let package = Package(
     name: "app",
     platforms: [
         .macOS(.v10_14)
     ],
      products: [
         .executable(name: "Run", targets: ["Run"]),
         .library(name: "App", targets: ["App"]),
     ],
     dependencies: [
         // � A server-side Swift web framework.
         .package(url: "https://github.com/vapor/vapor.git", from: "4.0.0-beta.2"),
         .package(url: "https://github.com/vapor/fluent.git", from: "4.0.0-beta.2"),
         .package(url: "https://github.com/vapor/fluent-postgres-driver.git", from: "2.0.0-beta.3"),
     ],
     targets: [
         .target(name: "App", dependencies: ["Fluent", "FluentPostgresDriver", "Vapor"]),
          .target(name: "Run", dependencies: ["App"]),
          .testTarget(name: "AppTests", dependencies: ["App", "XCTVapor"])
     ]
 )

manifest parse error: Unknown package 'Fluent' in dependencies of target 'App'

I don't think anything is mis-configured as it builds with 5.1 tools. This is using 11.4 beta 2 (11N123K) 🙂

swift-ci commented 4 years ago

Comment by Ellen Shapiro (JIRA)

This is still happening on the final released version of Swift 5.2 in Xcode 11.4.

Swift forums thread: https://forums.swift.org/t/package-names-in-swift-5-2/34886

Bug on my library: https://github.com/apollographql/apollo-ios/issues/1102

I attempted to change the `name` of the package on a branch, and while the `Package.resolved` picked up that name, I'm still getting the `unknown package in dependencies of target` error message