-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dependencies are not strict #344
Comments
fwiw a workaround is to have one library per package/directory. |
To verify, this fails even with sand boxing enabled? |
Also, exactly what flags do you have enabled on the build? Isn't the a feature for a side module cache, do you have that enabled and thus you might have enabled this directly? |
Yeah, as @keith mentioned, this sounds like you're building without sandboxing enabled. All libraries in the same package emit their .swiftmodules to the same bazel-bin subdirectory, and that subdirectory will be passed to swiftc as a search path, so the second build of We could make this less likely be emitting each .swiftmodule into its own target-specific subdirectory, but that would increase the overall number of search paths passed to the compiler, which would increase the number of unnecessary filesystem accesses that the compiler makes to find modules. So there would be trade-offs, and likely a performance regression. This isn't a Swift-specific issue; as another example, without sandboxing, an Objective-C source file could import headers from anywhere in the workspace, including headers that aren't in the deps of the target being compiled. |
Correct me if I'm wrong, but this is only in cases of more than one swift_library per package. Otherwise, I believe the number of search paths would by the same if there's a 1:1 library per package. |
Right, which is the case the user has above, and would be the general case since there is no requirement that a package only contains a single To flip it around, if you only have one |
You're not getting me that easily, the swift compiler did it to me. |
I'll say this though, our experience with bazel is that, time after time, correctness gets chosen over performance. I say this not to advocate one thing or another, but just to gripe 😄 |
I believe so. How do I make sure sandboxing is enabled? My bazelrc
Also tried with and without
Same result. It does bother me that the output of the build results appears to be non-deterministic. e.g. |
You can try ...which makes me wonder now, since What's not clear is how to resolve it; there's a So for now, I think you'll have to explicitly force the sandboxed strategy, which means you'll lose swiftc |
Just to circle back here and provide more context. Sandboxed does build what I need it to build and behaves appropriately. Otherwise it will add duplicate modules to the path in some circumstances. |
ok, found another problem. When using remote caching, and compiling non sandboxed, and then compiling sandboxed. The nonsandboxed builds fine, gets cached and then the sandboxed build will use the version that was cached, which really should have never compiled. |
I am also experiencing situations where I am getting duplicate modules, did adding |
On the original issue here I think the way out here is to support the new explicit module compilation mode, which will likely eliminate the pollution and the duplicate module issue |
FYI you can use |
A.swift
B.swift
C.swift
BUILD
The text was updated successfully, but these errors were encountered: