'Swift Package Manager dependency in a repository subdirectory

I have a Swift package in a subdirectory of a git repository inside GitHub. The tree looks something like this:

.
├── swift-package
│   ├── Package.swift
│   └── Sources
│       └── SomeLibrary
│           └── Library.swift
└── some-other-files

I want to add swift-package as a dependency to another project.

But the only way of specifying a dependency using Swift Package Manager I know is when the package is at the top level of the repository:

dependencies: [
    .package(url: "http://github.com/Some/Repository", from: "1.2.3"),
],

What I would need would be something along the lines of .package(url: "http://github.com/Some/Repository, dir: "swift-package"...).

I have no way of moving out the package to a separate repository.

Is there any way to achieve something like this using Swift Package Manager? If not, what are my options? Also, what is the best way to submit a feature request to Swift Package Manger developers?



Solution 1:[1]

Not exactly the proper answer, but I wonder if, as a workaround, we could add the corresponding repo as Git submodule, and then integrate the package as a local package from the corresponding subdirectory. We would lose the ability to update (or change the version of) the package via SPM, though. On the other hand, we would still be able to control the version of the package, by pinning the Git submodule to version tags (or branches/commits/whatever), that should be there in Git repository anyway for SPM, if I recall it correctly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Grigory Entin