-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aspect): support toolchain feature external_include_paths
When this feature is active, some include paths in `CompilationContext` are automatically moved to `external_includes`. This allows Bazel to pass them to the compiler via `-isystem` to silence compiler warnings for external headers. Resolves: #299
- Loading branch information
Showing
8 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
test/aspect/complex_includes/test_feature_external_include_paths.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from expected_result import ExpectedResult | ||
from test_case import CompatibleVersions, TestCaseBase | ||
|
||
from test.support.result import Result | ||
|
||
|
||
class TestCase(TestCaseBase): | ||
@property | ||
def compatible_bazel_versions(self) -> CompatibleVersions: | ||
""" | ||
The 'external_include_paths' feature exists for Bazel < 7.0.0. But the corresponding information was not added | ||
to CompilationContext, which hides it from an aspect. This information was added in Bazel 7.0.0. | ||
""" | ||
return CompatibleVersions(minimum="7.0.0") | ||
|
||
def execute_test_logic(self) -> Result: | ||
""" | ||
The 'external_include_paths' toolchain feature automatically moves some include paths in the Bazel | ||
CompilationContext to the 'external_includes' list so they can be provided to the compiler via '-isystem'. | ||
This allows silencing compiler warnings originating from those external headers. | ||
""" | ||
expected = ExpectedResult(success=True) | ||
actual = self._run_dwyu( | ||
target=["//complex_includes:all", "@complex_includes_test_repo//..."], | ||
extra_args=["--features=external_include_paths"], | ||
aspect=self.default_aspect, | ||
) | ||
|
||
return self._check_result(actual=actual, expected=expected) |