[swift-users] error: the package has an unsupported layout, unexpected source file(s) found: /Users/maximveksler/Project/Org/Collection/Sources/main.swift
Maxim Veksler
maxim at vekslers.org
Tue Jan 24 14:23:42 CST 2017
Thanks Daniel,
Few comments:
Error message is very confusing and doesn't provide a hint to what went
wrong.
I'd suggest to solve this by assuming default for 1 module, and if
main.swift is present then building an executable. Allowing multiple
modules in same package I think should be discouraged, because at least
intuitively for me a Package translate to a Module in a 1:1 relation.
It's also import the inconsistency between Xcode project produced by swift
package generate-xcodeproj which is able to build the mentioned layout and
the command line swift build that fails.
Thanks for the help, mv'ing the sources into a a "Collection" directory in
Sources solved the issue.
On Tue, Jan 24, 2017 at 10:00 PM Daniel Dunbar <daniel_dunbar at apple.com>
wrote:
>
> On Jan 24, 2017, at 11:57 AM, Maxim Veksler via swift-users <
> swift-users at swift.org> wrote:
>
> The most recent change I've done is add the Sources/extensions/Jay.swift,
> now I'm unable to build the project.
>
> No idea what could have gone wrong, feedback?
>
>
> ➜ Collection git:(master) ✗ find Sources
> Sources
> Sources/extensions
> Sources/extensions/Jay.swift
> Sources/main.swift
>
>
> If you want one module with both sources but some in a subdirectory, you
> need to write it as:
>
> Sources/Collection/main.swift
> Sources/Collection/extensions/Jay.swift
>
> If you want two modules then you need to lay this out as:
> Sources/extensions/Jay.swift
> and
> Sources/Collection/main.swift
>
> We know this UX is not very good and are debating how to best resolve
> this...
>
> - Daniel
>
>
> ➜ Collection git:(master) ✗ cat Package.swift
> import PackageDescription
>
> let package = Package(
> name: "Collection",
> dependencies: [
> .Package(url: "https://github.com/GraphQLSwift/GraphQL.git",
> majorVersion: 0),
> .Package(url: "https://github.com/czechboy0/Jay.git", majorVersion:
> 1)
> ]
> )
>
> ➜ Collection git:(master) ✗ swift build
> error: the package has an unsupported layout, unexpected source file(s)
> found: /Users/maximveksler/Project/Org/Collection/Sources/main.swift
> fix: move the file(s) inside a module
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170124/ce1e900a/attachment.html>
More information about the swift-users
mailing list