I have a Swift library with a core module plus optional bonus modules. I would like to use the following directory layout, mapping to exported Swift package names as shown:
Core/ → import Taco
Toppings/ → import TacoToppings
SideDishes/ → import TacoSideDishes
There is not currently a clean way to do this, but it seems like a reasonable request. I recommend filing an enhancement request at http://bugs.swift.org for it.
There is one "hacky" way you can do this:
Create your sources in the desired internal layout:
Add additional symbolic links for the desired module names:
ln -s Core Sources/Taco ln -s Toppings Sources/TacoToppings
exclude directive to the manifest to ignore the non-desired module name:
let package = Package( name: "Taco", exclude: ["Sources/Core", "Sources/Toppings"] )
is it possible to make the Core, Toppings, and SideDishes modules internal to the project, and export them all to the world as one big Taco module?
No, unfortunately there is no way to do this currently, and it requires substantial compiler work to be able to support.