<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi there,<div class=""><br class=""></div><div class="">This is what happened as I was trying out the Swift Package Manager for another project similar to the one shown below:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">~ $ mkdir example</font></div><div class=""><font face="Menlo" class="">~ $ cd example/</font></div><div class=""><font face="Menlo" class="">example $ touch Package.swift</font></div><div class=""><font face="Menlo" class="">example $ mkdir Sources</font></div></div><div class=""><div class=""><font face="Menlo" class="">example $ vi Sources/Example.swift</font></div><div class=""><font face="Menlo" class="">example $ cat Sources/Example.swift</font></div><div class=""><font face="Menlo" class="">func printOther() {</font></div><div class=""><font face="Menlo" class=""> print("other")</font></div><div class=""><font face="Menlo" class="">}</font></div></div><div class=""><div class=""><font face="Menlo" class="">example $ vi Sources/Main.swift</font></div><div class=""><font face="Menlo" class="">example $ cat Sources/Main.swift</font></div><div class=""><font face="Menlo" class="">print("Hello World")</font></div><div class=""><font face="Menlo" class="">printOther()</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><div class=""><font face="Menlo" class="">example $ swift build</font></div><div class=""><font face="Menlo" class="">Compile Swift Module 'example' (2 sources)</font></div><div class=""><font face="Menlo" class="">/</font><span style="font-family: Menlo;" class="">PATH</span><font face="Menlo" class="">/example/Sources/Main.swift:1:1: error: expressions are not allowed at the top level</font></div><div class=""><font face="Menlo" class="">print("Hello World")</font></div><div class=""><font face="Menlo" class="">^</font></div><div class=""><font face="Menlo" class="">/</font><span style="font-family: Menlo;" class="">PATH</span><font face="Menlo" class="">/example/Sources/Main.swift:2:1: error: expressions are not allowed at the top level</font></div><div class=""><font face="Menlo" class="">printOther()</font></div><div class=""><font face="Menlo" class="">^</font></div><div class=""><font face="Menlo" class="">/</font><span style="font-family: Menlo;" class="">PATH</span><font face="Menlo" class="">/example/Sources/Main.swift:1:1: error: expressions are not allowed at the top level</font></div><div class=""><font face="Menlo" class="">print("Hello World")</font></div><div class=""><font face="Menlo" class="">^</font></div><div class=""><font face="Menlo" class="">/</font><span style="font-family: Menlo;" class="">PATH</span><font face="Menlo" class="">/example/Sources/Main.swift:2:1: error: expressions are not allowed at the top level</font></div><div class=""><font face="Menlo" class="">printOther()</font></div><div class=""><font face="Menlo" class="">^</font></div><div class=""><font face="Menlo" class=""><unknown>:0: error: build had 1 command failures</font></div><div class=""><font face="Menlo" class="">error: exit(1): /PATH-SWIFT/usr/bin/swift-build-tool -f /PATH/example/.build/debug.yaml</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" color="#e32400" class="">example $ mv Sources/Main.swift Sources/main.swift</font></div><div class=""><div class=""><span style="font-family: Menlo;" class="">example $ swift build</span></div><div class=""><font face="Menlo" class="">Compile Swift Module 'example' (2 sources)</font></div><div class=""><font face="Menlo" class="">Linking .build/debug/example</font></div><div class=""><font face="Menlo" class="">example $ .build/debug/example</font></div><div class=""><font face="Menlo" class="">Hello World</font></div><div class=""><font face="Menlo" class="">other</font></div><div class=""><font face="Menlo" class="">example $</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class="">I had to rename <font face="Menlo" class="">Main.swift</font> to <font face="Menlo" class="">main.swift</font>. Is there a design decision on why the filename for the main swift file has to be lowercase or is this a bug?</div><div class=""><br class=""></div><div class="">If it’s a design decision, why are directory names for source files allowed to have variations like <span style="font-family: Menlo;" class="">Sources</span>, <font face="Menlo" class="">Source</font>, <font face="Menlo" class="">src</font> and <font face="Menlo" class="">srcs</font> as stated <a href="https://github.com/apple/swift-package-manager/blob/master/Documentation/SourceLayouts.md#other-rules" class="">here</a> but not the main swift file?</div><div class=""><br class=""></div><div class="">I’d be ok if only <span style="font-family: Menlo;" class="">Main.swift</span> and <font face="Menlo" class="">main.swift</font> are allowed since other files in the <span style="font-family: Menlo;" class="">Sources</span> directory are commonly UpperCamelCase due to the Type naming conventions e.g. <a href="https://github.com/apple/example-package-playingcard/tree/master/Sources" class="">example-package-playingcard/Sources</a>.</div><div class=""><br class=""></div><div class="">Or maybe I’m just being pedantic?</div><div class=""><br class=""></div><div class="">p.s. even <font face="Menlo" class="">Package.swift</font> is capitalized and not <font face="Menlo" class="">package.swift</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""><div class="">$ swift --version</div><div class="">Swift version 3.0-dev (LLVM 752e1430fc, Clang 1e6cba3ce3, Swift 56052cfe61)</div><div class="">Target: x86_64-unknown-linux-gnu</div></font></div><div class=""><br class=""></div></body></html>