[swift-server-dev] Prototype of the discussed HTTP API Spec

Helge Heß me at helgehess.eu
Wed May 31 05:56:08 CDT 2017


On 31. May 2017, at 12:48, Alex Blewitt <alblue at apple.com> wrote:
>> On 30 May 2017, at 16:20, Carl Brown via swift-server-dev <swift-server-dev at swift.org> wrote:
>> 
>>> On May 30, 2017, at 5:53 AM, Helge Heß via swift-server-dev <swift-server-dev at swift.org> wrote:
>>> 2)
>>> The other thing that would be nice is a demo tool in the Sources directory, again similar to what Johannes showed (his tiny echod sample).
>> 
>> I have several of those (Echo, HelloWorld, etc) that I use for end-to-end testing, but since they're not part of the API, they're under `Tests/` not `Sources/`.  See https://github.com/carlbrown/HTTPSketch/tree/master/Tests/HTTPSketchTests/Helpers 
>> 
>> I'm happy to move them to `Sources/`if that would be easier.
> 
> I would recommend against that. The problem is that if you have such helpers/demos in the Sources, then they not only get built for your project but also in every project that depends on that project as well.

I thought this is going away with that products feature in SwiftPM4? But fair enough.

> So you can be building your production app, and you'll still get Echo, HelloWorld built -- and if you are building with an Xcode generated project, that will lead to other (unnecessary) targets being built for your project.
> 
> If you have demos, I would suggest moving them into a different repository and then have that depend on the implementation repository through Swift PM. You can then guarantee that the same examples compile and behave correctly across different versions of your libraries.

Fine with me, another option is to move them into a different subdirectory and do the same thing. E.g. this is what I do in Noze.io:

  HTTPSketch
    Package.swift
    Sources
      HTTPSketch
    Samples
      echozd
        Package.swift - I think this can even refer to the ../.. git?
      otherdemo
        Package.swift

or
    Samples
      Package.swift
      Sources
        echozd
        otherdemo

Hh



More information about the swift-server-dev mailing list