How to build a SPM project without cloning it first?

Hi!

How can I tell SPM to just build a project from Github?

Specifically, I want to generate an Xcode file for Vapor, so I can include it as a dependency in a different Xcode project.

I've managed to generate the Xcode file by cloning the Vapor repo, and running "swift package generate-xcodeproj --output /path/to/xcode/file"

However, I'd actually prefer not to have to bother with cloning the Vapor repo in the first place. Can I somehow tell SPM to do the cloning of the project itself, just like it does for dependencies?

I've attempted to write a package.swift manifest that has only a single dependency (Vapor) and nothing else, but when I call "swift package generate-xcodeproj" it complains that it can't find the sources of my project.

Is there some way to tell the package manager that I just want it to build dependencies?

Is it clear what I am attempting to do?

Hello, please move this post to "Using Swift" section.

Why not just make Vapor a dependency in the project where you are trying to use it?

Is it clear what I am attempting to do?

To me, not fully.

I tried to follow your description, no complains about the sources.

$ mkdir TestVapor
$ cd TestVapor/
$ swift package --init empty
$ vim Package.swift 

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

import PackageDescription

let package = Package(
    name: "TestVapor",
    dependencies: [
         .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
    ]
)
$ swift package generate-xcodeproj
generated: ./TestVapor.xcodeproj
warning: dependency 'Vapor' is not used by any target

Something like this should work. You have to add a single (empty allowed) swift file to the directory.

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "Dependencies",
    products: [
        .library(
            name: "Dependencies",
            targets: ["Dependencies"]),
    ],
    dependencies: [
        .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
    ],
    targets: [
        .target(name: "Dependencies", dependencies: ["Vapor"], path: "."),
    ]
)