Skip to content
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

Split derived files generation errors in incremental mode #835

Open
codeman9 opened this issue May 31, 2022 · 3 comments
Open

Split derived files generation errors in incremental mode #835

codeman9 opened this issue May 31, 2022 · 3 comments

Comments

@codeman9
Copy link
Contributor

The documentation for swift.split_derived_files_generation mentions whole module optimization, so this feature may only be applicable to that compilation mode:

# If enabled and whole module optimisation is being used, the `*.swiftdoc`,
# `*.swiftmodule` and `*-Swift.h` are generated with a separate action
# rather than as part of the compilation.
SWIFT_FEATURE_SPLIT_DERIVED_FILES_GENERATION = "swift.split_derived_files_generation"

When this feature is enabled and incremental mode is used, then the following error is seen:

error: merge-module command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: error opening input file '/var/folders/ws/gbr_5dz97rncvmckbmzl4h7r0000gn/T/TemporaryDirectory.xeR92j/I18N-1.swiftmodule' (No such file or directory)

Can this feature be used for incremental mode? If this feature is only relevant for whole module optimization, then would it be possible to output an error to that effect?

@brentleyjones
Copy link
Collaborator

brentleyjones commented May 31, 2022

I know swift does a form of split compilation in incremental mode. I also added code into the worker to make sure it copied files correctly. It might need this change: #699

In the same vein, in order to support split modules with incremental builds, we need to use this flag (though we could choose to use this version only with incremental + split modules, if we decide it's not worth the above regressions).

@codeman9
Copy link
Contributor Author

codeman9 commented Jun 9, 2022

I tried adding #699 to no change in effect. I'm noticing, also, that the .derived_output_file_map.json file is always {} even while using whole module optimization. It is written here: https://github.com/bazelbuild/rules_swift/blob/def553123dc56449ef7e1fa7ae8ed3440aec7a73/swift/internal/compiling.bzl#L2684-L2688 but is always empty. It used to contain the partial swiftmodule path, but that has since been removed:

if split_derived_file_generation:
derived_files_output_map[src.path] = {"swiftmodule": partial_module.path}
else:

I'm not entirely sure what sorts of things should go in this file.

@brentleyjones
Copy link
Collaborator

You'll minimally need #699. It's not enough on its own to unlock incremental split mode. I would look to see how Xcode 14 is doing this, as now does incremental split mode. From it's commands you'll be able to piece together what rules_swift should do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants