Multiple executables

Hi all,

I’m working on a server app and would like to be able to provide a utility executable to create certain things (source files) or do certain things (like migrate a database). My package only creates the one executable and for me to start another package - well, it seems like it would entail a lot more work than I want to do at this point (it’s so early in the dev stage).

Does anyone have any experience yet doing these sorts of things?

I was just thinking, I suppose my main could look for env parameters and doing my things if those are present or start the server if they are not. That might be the way to go.

Any thoughts appreciated, thanks.

- jason

Packages can have multiple executable targets. You just need to subdivide your sources appropriately:
Sources/SomeLibrary/...
Sources/server/main.swift
Sourcers/upgrade-tool/main.swift
...

- Daniel

···

On Jan 23, 2016, at 2:54 PM, Jason Lee via swift-users <swift-users@swift.org> wrote:

Hi all,

I’m working on a server app and would like to be able to provide a utility executable to create certain things (source files) or do certain things (like migrate a database). My package only creates the one executable and for me to start another package - well, it seems like it would entail a lot more work than I want to do at this point (it’s so early in the dev stage).

Does anyone have any experience yet doing these sorts of things?

I was just thinking, I suppose my main could look for env parameters and doing my things if those are present or start the server if they are not. That might be the way to go.

Any thoughts appreciated, thanks.

- jason
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Thanks for the reply Daniel. Your suggestion worked. Now I have to
re-structure my whole project. :)

···

On Sat, Jan 23, 2016 at 8:23 PM, Daniel Dunbar <daniel_dunbar@apple.com> wrote:

Packages can have multiple executable targets. You just need to subdivide
your sources appropriately:
Sources/SomeLibrary/...
Sources/server/main.swift
Sourcers/upgrade-tool/main.swift
...

- Daniel

> On Jan 23, 2016, at 2:54 PM, Jason Lee via swift-users < > swift-users@swift.org> wrote:
>
> Hi all,
>
> I’m working on a server app and would like to be able to provide a
utility executable to create certain things (source files) or do certain
things (like migrate a database). My package only creates the one
executable and for me to start another package - well, it seems like it
would entail a lot more work than I want to do at this point (it’s so early
in the dev stage).
>
> Does anyone have any experience yet doing these sorts of things?
>
> I was just thinking, I suppose my main could look for env parameters and
doing my things if those are present or start the server if they are not.
That might be the way to go.
>
> Any thoughts appreciated, thanks.
>
> - jason
> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users