swiftlang / swift-org-website

Swift.org website
https://swift.org
Other
477 stars 188 forks source link

Clarify that package manifests must be located at the root of the repository in the Conceptual Overview section of the SwiftPM page #756

Closed daveverwer closed 4 months ago

daveverwer commented 4 months ago

Motivation:

We recently had an issue raised with SPI where someone thought the rule that Package.swift manifests must be located at the root of the package repository was something that SPI was enforcing rather than a SwftPM requirement.

I thought (and subsequently double-checked) that it was a SwiftPM requirement for library packages, but my first step in those checks was to search the web and this page was the first official source that came up. It struck me that this would be a good place to make this requirement clear.

Modifications:

Clarified the Creating a Library Package section of the SwiftPM page to make this clear.

Result:

Screenshot 2024-07-15 at 13 09 04@2x

tayloraswift commented 4 months ago

i don’t think this is universally correct, Package.swift can and often does occur in places that are not the root of a git repository. for example, benchmarks and examples often live in nested directories. it’s only the case that SwiftPM can use a package as a dependency if that package’s manifest lives at the root of the repository.

perhaps clarify that this only applies to packages that are intended to be used as version-controlled dependencies of other packages?

daveverwer commented 4 months ago

perhaps clarify that this only applies to packages that are intended to be used as version-controlled dependencies of other packages?

Thanks @tayloraswift, and of course you're correct that this is only for dependencies. I think given that , a better place for this might be in the "Creating a Library Package" section, around the file tree diagram. I just pushed an update to move it to there.

shahmishal commented 4 months ago

cc: @bnbarham

daveverwer commented 4 months ago

@swift-ci please test