Repository navigation
Fix rst to trlc parser #464
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
Open
rmaddikery
wants to merge
5
commits into
main
Choose a base branch
from
rama_fix_rst_to_trlc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2d80267
plumb package attr to all public macros
rmaddikery 123a1a5
Fix declare_file(sibling=src) for cross repo .rst labels
rmaddikery 4ebcf08
Fixes rst_to_trlc parser
rmaddikery 8f0484d
fix(rst_to_trlc): avoid output path collision for same-named RST sources
rmaddikery 51745b1
Address review comments
rmaddikery File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
22 changes: 22 additions & 0 deletions
22
bazel/rules/rules_score/test/fixtures/rst_collision/a/req.rst
This file contains hidden or 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,22 @@ | ||
| .. | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| Collision Fixture A | ||
| ==================== | ||
|
|
||
| .. comp_req:: From A | ||
| :id: comp_req__collision_test__a | ||
| :safety: QM | ||
|
|
||
| Requirement sourced from a/req.rst. |
22 changes: 22 additions & 0 deletions
22
bazel/rules/rules_score/test/fixtures/rst_collision/b/req.rst
This file contains hidden or 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,22 @@ | ||
| .. | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| Collision Fixture B | ||
| ==================== | ||
|
|
||
| .. comp_req:: From B | ||
| :id: comp_req__collision_test__b | ||
| :safety: QM | ||
|
|
||
| Requirement sourced from b/req.rst. |
64 changes: 64 additions & 0 deletions
64
bazel/rules/rules_score/test/requirements_package_test.bzl
This file contains hidden or 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,64 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
| """Tests for the ``package`` attr and the rst_to_trlc output-path fix.""" | ||
|
|
||
| load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") | ||
|
|
||
| # ============================================================================ | ||
| # assumed_system_requirements(package = ...) forwards to rst_to_trlc | ||
| # ============================================================================ | ||
|
|
||
| def _asr_package_forwarded_test_impl(ctx): | ||
| env = analysistest.begin(ctx) | ||
| actions = analysistest.target_actions(env) | ||
| rst_actions = [a for a in actions if a.mnemonic == "RstToTrlc"] | ||
|
|
||
| asserts.true(env, len(rst_actions) == 1, "expected exactly one RstToTrlc action") | ||
| if rst_actions: | ||
| argv = rst_actions[0].argv | ||
| asserts.true(env, "--package" in argv, "expected --package in RstToTrlc argv") | ||
| asserts.equals(env, "CustomAsrPackage", argv[argv.index("--package") + 1]) | ||
|
|
||
| return analysistest.end(env) | ||
|
|
||
| asr_package_forwarded_test = analysistest.make(_asr_package_forwarded_test_impl) | ||
|
|
||
| # ============================================================================ | ||
| # rst_to_trlc: same-basename srcs in one target must not collide | ||
| # ============================================================================ | ||
|
|
||
| def _rst_to_trlc_no_collision_test_impl(ctx): | ||
| env = analysistest.begin(ctx) | ||
| target_under_test = analysistest.target_under_test(env) | ||
| outs = target_under_test[DefaultInfo].files.to_list() | ||
|
|
||
| asserts.equals(env, 2, len(outs)) | ||
| asserts.true(env, outs[0].path != outs[1].path, "same-basename srcs must produce distinct output paths") | ||
|
|
||
| return analysistest.end(env) | ||
|
|
||
| rst_to_trlc_no_collision_test = analysistest.make(_rst_to_trlc_no_collision_test_impl) | ||
|
|
||
| # ============================================================================ | ||
| # Test Suite | ||
| # ============================================================================ | ||
|
|
||
| def requirements_package_test_suite(name): | ||
| """Register the package-forwarding and output-collision tests.""" | ||
| native.test_suite( | ||
| name = name, | ||
| tests = [ | ||
| ":asr_package_forwarded_test", | ||
| ":rst_to_trlc_no_collision_test", | ||
| ], | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tests for starlark changes