[2/5] support C++20 Modules, add C++20 modules tools#22427
[2/5] support C++20 Modules, add C++20 modules tools#22427PikachuHyA wants to merge 7 commits intobazelbuild:masterfrom
Conversation
comius
left a comment
There was a problem hiding this comment.
Also please add tests in the same PR for the newly introduced tools.
613c5d9 to
3056ed5
Compare
|
hi @comius , I have updated this patch. please review again. In this patch, the tools |
3056ed5 to
b71f823
Compare
|
hi @comius , please review again. Changes Summary
|
|
hi @mathstuf Due to the reimplementation with C++, the previous comments regarding the Java implementation can be ignored. If possible, please help review the C++ implementation. Let's automatically replace "Java implementation" with "C++ implementation."
Since C++ does not have an official format library, we can only use stream operations for now. note: C++20 has a std::format, but bazel use C++17 now.
Because Bazel cannot properly handle source files with spaces in the path, linking will fail, so I won't address this issue for now. @comius is this a BUG or by design? Consider the following cases:
For example: The content of BUILD.bazel: Build the target The content of
I will consider supporting header units after merging the large patch. Currently, it only supports named modules, one-phase compilation for Clang, GCC, and MSVC, and two-phase compilation for Clang. as you mentioned before ( #19940 (comment) getting things working across the ecosystem as a baseline before we start up our ricer cars.getting things working across the ecosystem as a baseline before we start up our ricer cars.), as for #19940 (comment) |
|
@comius |
mathstuf
left a comment
There was a problem hiding this comment.
LGTM as far as the abstract build graph and P1689 handling is concerned.
|
@trybka ping |
46ee063 to
5d232f7
Compare
|
as #22429 (comment) mentioned I'm testing #22553 and find a bug in this patch Changes
The macOS CI failed, but it seems unrelated to this patch. |
trybka
left a comment
There was a problem hiding this comment.
I expect we're going to want to put the tools behind semantics (in a similar fashion to grep-includes here). We may not want to make this available internally yet, and that's the only way to keep from adding these dependencies otherwise.
|
hi @trybka
Regarding placing these tools under semantics, do you have any suggestions? Currently, I've introduced two new tools: |
69e4b8a to
53e3a98
Compare
53e3a98 to
d9954df
Compare
|
after rebase to the latest master branch, the CI passed. |
This is a bug, Bazel can handle source files with spaces (but not with a ":"), C++ rules are to blame.
I'd suggest exposing a dict with 2 attributes from semantics, instead of 2 |
|
hi @comius
I have updated the code. |
|
I apologize to @mathstuf for the mistake requested; I accidentally clicked the Re-request review button due to a network issue. |
|
hi @trybka , as #22429 (review) mentioned, I checked the PR again and find one unresolved comment. I marked as resolved (see #22427 (comment)). |
|
I believe @comius is working on the import. |
I split the XXL PR #19940 into several small patches.
This is the second patch of Support C++20 Modules, I add C++20 related tools
Overview
This patch contains two tools:
aggregate-ddiandgen-modmap. These tools are designed to facilitate the processing of C++20 modules information and direct dependent information (DDI). They can aggregate module information, process dependencies, and generate module maps for use in C++20 modular projects.The format of DDI
The format of DDI content is p1689.
for example,
Tools
aggregate-ddiDescription
aggregate-ddiis a tool that aggregates C++20 module information from multiple sources and processes DDI files to generate a consolidated output containing module paths and their dependencies.Usage
Command Line Arguments
-m <cpp20modules-info-file>: Path to a JSON file containing C++20 module information.-d <ddi-file> <pcm-path>: Path to a DDI file and its associated PCM path.-o <output-file>: Path to the output file where the aggregated information will be stored.Example
generate-modmapDescription
generate-modmapis a tool that generates a module map from a DDI file and C++20 modules information file. It creates two output files: one for the module map and one for the input module paths.Usage
Command Line Arguments
<ddi-file>: Path to the DDI file containing module dependencies.<cpp20modules-info-file>: Path to the JSON file containing C++20 modules information.<output-file>: Path to the output file where the module map will be stored.<compiler>: Compiler type the modmap to use. Onlyclang,gcc,msvc-clsupported.Example
This command will generate two files:
modmap: containing the module map.modmap.input: containing the module paths.