way-to-code / git-macOS

A high-level swift framework based on the GIT macOS command line utility
27 stars 9 forks source link

How to add to Package.swift? #4

Closed petershaw closed 3 years ago

petershaw commented 3 years ago

I add the repo to the dependencies: .package(url: "https://github.com/way-to-code/git-macOS.git", .branch("master")) but how to set the .target.dependencies?

I tried:

"Git"
"git-macOS"
.product(name: "Git", package: "Git"),
.product(name: "git-macOS", package: "Git"),

without any luck.

can you provide an example?

petershaw commented 3 years ago

I'll quick fixed it by naming the target Git https://github.com/petershaw/git-macOS/commit/1f6cf3c57ab485aa0952713603b2647466b927e0#diff-f913940c58e8744a2af1c68b909bb6383e49007e6c5a12fb03104a9006ae677e

way-to-code commented 3 years ago

@petershaw Hey! Thanks for reaching out.

I have updated a target name in the package file according to your feedback. And also added an example how to use this as a package dependency like this:

let package = Package(
    name: "MyPackage",

    products: [
        .library(name: "myProduct", targets: ["myTarget"]),
    ],

    dependencies: [
        .package(name: "Git",
                 url: "https://github.com/way-to-code/git-macOS.git",
                 .upToNextMajor(from: "1.0.0")),
    ],

    targets: [
        .target(name: "myTarget", dependencies: [
            .product(name: "Git", package: "Git")
        ]),
    ]
)

Hope this will help.