Swift module layout uniformity

I was looking at the current state of the swiftmodule layout in the toolchain. The current layout appears to be:

Linux and Windows:

└─ Toolchains
    └─ ...
        └─ usr
            └─ lib
                └─ swift
                    └─ [os]
                        └─ [arch]
                            ├─ [module].swiftdoc
                            ├─ [module].swiftinterface
                            └─ [module].swiftmodule

On Darwin:

└─ Toolchains
    └─ ...
        └─ usr
            └─ lib
                └─ swift
                    └─ [os]
                        └─ [module].swiftmodule
                            ├─ [arch].swiftdoc
                            ├─ [arch].swiftinterface
                            └─ [arch].swiftmodule

There is something to be said for the structure in the Darwin case. It actually makes it easier to find the module in the list, it makes it easier to support multiple architectures, and it would make the directory structure uniform across the platforms. It would also allow us to simplify a bit of logic since the compiler would only need a single path.

I was wondering if there is a strong reason to not switch over the Linux (and Windows) platforms to that directory structure.

CC: @drexin

6 Likes

@compnerd I am fine with this overall. But I don't really have a sense of if this is good or bad and I don't have strong opinions.

@DaveZ @Douglas_Gregor Any thoughts?

I think being more consistent with Darwin makes sense.

I also think this makes a lot of sense. Does anyone know why this difference exists?

This was introduced around Swift 5. At the time, the old path already existed, and this was deemed to be better for fat libraries and needed on Darwin targets, so only the Darwin target was altered. It's purely an artifact of evolution.

1 Like