Skip to content

Swift Scripting: error: unknown package 'Apollo' in dependencies of target 'Codegen' #1102

@alexandrethsilva

Description

@alexandrethsilva

Hi @designatednerd!
First of all, thanks for the great effort on this script. It's really great to have someone looking into how to improve the existing process and making it better.

I'm not sure what may be up as I'm relatively new to Swift and Xcode development in general, but there's a problem when doing the setup described in the docs that is really cryptic as I can't find much about it somewhere else.

As for the setup, I'm currently on Xcode Version 11.4 (11E146) and therefore swift-tools 5.2.

When getting to the step 4 in the process (Update the dependencies section to grab the Apollo iOS library), I get the following message on the sidebar:

Showing All Messages: dependency 'Apollo' is not used by any target

Okay, makes sense, since I didn't add the target dependency yet. So I go ahead and do it. But then, immediately after adding it, I get the following:

unknown package 'Apollo' in dependencies of target 'Codegen'

My Package.swift currently looks like this:

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

import PackageDescription

let package = Package(
    name: "Codegen",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(url: "https://github.com/apollographql/apollo-ios.git",
        from: "0.22.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 which this package depends on.
        .target(name: "Codegen",
            dependencies: [
            .product(name: "ApolloCodegenLib", package: "Apollo")
            ]),
        .testTarget(
            name: "CodegenTests",
            dependencies: ["Codegen"]),
    ]
)

As a sidenote, if I comment the dependency out, Xcode downloads the package from github and adds the deps to the sidebar, like here:

image

But when I add it:

image

I'm afraid I'm missing something rather simple, but then again, I couldn't get the process to work on Xcode 11.3.1 either as it was showing a similar error. I thought updating it would give me better chances, but no luck.

Do you think you have any tips on this?

Thanks again for the help! Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions