Giter Site home page Giter Site logo

Comments (4)

mxcl avatar mxcl commented on May 22, 2024
.target(dependencies[.product(name: "Path", package: "Path")])

Is not valid Swift, nor is it the correct syntax, I suggest letting Xcode do the completion for you.

.target(name: "Foo:", dependencies: [.product(name: "Path", package: "Path")])

from path.swift.

vkuznet avatar vkuznet commented on May 22, 2024

This is exactly what I have in my Package.swift (among other things):

        .target(
            name: "SwiftMLExample",
            dependencies: [
                "Just",
                .product(name: "Path", package: "Path"),
                .product(name: "ArgumentParser", package: "swift-argument-parser")
            ])

and, swift build throws this error:

/Users/vk/Work/Languages/Swift/SwiftMLExample: error: unknown package 'Path' in dependencies of target 'SwiftMLExample'

And, XCode is not universally available, e.g. there is no Xcode on Linux. So, I want to learn how to do it by hand. All other packages I used are working and Path some how does not.

Here is how to reproduce the problem with fresh environment:

  1. create new package with
swift package init --type executable
Creating executable package: TestPathVanila
Creating Package.swift
Creating README.md
Creating .gitignore
Creating Sources/
Creating Sources/TestPathVanila/main.swift
Creating Tests/
Creating Tests/LinuxMain.swift
Creating Tests/TestPathVanilaTests/
Creating Tests/TestPathVanilaTests/TestPathVanilaTests.swift
Creating Tests/TestPathVanilaTests/XCTestManifests.swift
  1. Add Path to dependencies, see my Package.swift
// 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: "TestPathVanila",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(url: "https://github.com/mxcl/Path.swift", from: "1.2.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: "TestPathVanila",
            dependencies: [.product(name: "Path", package: "Path")]),
        .testTarget(
            name: "TestPathVanilaTests",
            dependencies: ["TestPathVanila"]),
    ]
)
  1. build package
swift build
/Users/vk/Work/Languages/Swift/tmp/TestPathVanila: error: unknown package 'Path' in dependencies of target 'TestPathVanila'

from path.swift.

mxcl avatar mxcl commented on May 22, 2024
.product(name: "Path", package: "Path.swift")

from path.swift.

vkuznet avatar vkuznet commented on May 22, 2024

This works!
Thanks.

from path.swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.