Frederick C. Lee
Frederick C. Lee

Reputation: 9513

Swift Package build failure. Remedy?

Background:
This code is based on dated PM example written by Mattt years ago.

Goal: I'm trying to get importing to work, so I created a basic package; based on Mattt's working package. His example works flawlessly. Hence attempting to recreate from scratch.

Scenario:

  1. I've created a basic package.
  2. I've added a Dependency.
  3. I've added an 'import <Dependency' in package source but I'm getting the following build failure:

enter image description here

Here's the actual code:

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "RicPackage",
    products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "RicPackage",
            targets: ["RicPackage"]),
    ],
    dependencies: [
        .package(name: "PlayingCard", url: "https://github.com/apple/example-package-playingcard.git", from: "3.0.0")
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
        .target(
            name: "RicPackage",
            dependencies: ["PlayingCard"]),
        .testTarget(
            name: "RicPackageTests",
            dependencies: ["RicPackage"]),
    ]
)

Question: Why is this happening?
What am I missing?

Upvotes: 2

Views: 210

Answers (1)

Frederick C. Lee
Frederick C. Lee

Reputation: 9513

Gremlins?

I played around with the package header to notice changes in syntax acceptance. Then I reverted to the latest and did a recompile.

This time it SUCCEEDED.

I did a Xcode restart just to be sure this is true. I rebuild... again SUCCEEDED.

Note: be sure to be aware of the package header the says the version of the package. The package syntax (amongst other things) change/version.

Upvotes: 1

Related Questions