Build specific Target instead of all


(Stefan Bürk) #1

This feature is not there yet (sorry, SwiftPM is super young still), but you can invoke swift-build-tool manually:

     swift-build-tool -f .build/debug/llbuild.yaml TARGETNAME

Open up the file to figure out the target name.

I'm tried your suggestion, but that is no "working" solution to build just specific targets. ( Although and can be done under some cirumstances ).

First of all, if there is a "name":"ProjectName" in the Package.swift the command to invoke must be called in this way:

swift-build-tool -f .build/debug/ProjectName/llbuild.yaml TARGETNAME

And the second issue with this is, that to run this command there must be a full build before. (swift build). Otherwise there will not be and filed in the .build/ folder.

So this is no solution to checkout the source and just build the one or other target instead of all XXX targets all togheter, if we need to build all to build one specific.

Okay, maybe it could be a solution to checkin the llbuild.yaml (and maybe other needed files) into a seperate folder in the git repository. But that seems to be so hacky and a even worse solution, so we discarded the way to provider several indepentent small util binaries.

Instead of that we changed to one binard which could be symlinked on the target machine, checking the symlink name from which the binary was invoked, and instancing indivudial "BinaryInstance" classes which do the argument/work splitting. The result is a binary with all stuff into it. This was for us the best way currently.

This feature is not there yet (sorry, SwiftPM is super young still), but you can invoke swift-build-tool manually:

It's a known fact thet the SwiftPM is a young project, so i'm not require that it should do all needed things just yet.
You mentioned this feature is not there yet .. but i think this feature would be a very common used feature. So where is the correct place to look if this feature is maybe on the roadmap or start a discussion about this feature ?

Another nice to have feature could be another ( not found it, but maybe it exists ):

Currently with involing

swift build

it reads the Package.swift (recursivly), checking out the Package git repositories and build all at once. A feature to just do that git repository checkout WITHOUT involing a build in one run would be nice.

ex. swift fetch or swift build --fetch

stefan


(Max Howell) #2

It's a known fact thet the SwiftPM is a young project, so i'm not require that it should do all needed things just yet.
You mentioned this feature is not there yet .. but i think this feature would be a very common used feature. So where is the correct place to look if this feature is maybe on the roadmap or start a discussion about this feature ?

Feel free to submit a PR, I don’t think we need to discuss it in detail here. I agree it would be really great to get this feature built.

Another nice to have feature could be another ( not found it, but maybe it exists ):

Currently with involing

swift build

it reads the Package.swift (recursivly), checking out the Package git repositories and build all at once. A feature to just do that git repository checkout WITHOUT involing a build in one run would be nice.

ex. swift fetch or swift build —fetch

We have a PR open for this:

https://github.com/apple/swift-package-manager/pull/114