-
Notifications
You must be signed in to change notification settings - Fork 20
Source links as Bazel target #358
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
base: main
Are you sure you want to change the base?
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run //src:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
| import sys | ||
| from pathlib import Path | ||
|
|
||
| from src.extensions.score_source_code_linker.generate_source_code_links_json import ( |
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.
Might need to either make this function public or make a public counterpart.
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.
I'm not sure yet. Eventually, we should be able to extract it from the Sphinx extension, because the extension shall only consume the json files.
| for file_path in args.files: | ||
| abs_file_path = file_path.resolve() | ||
| if abs_file_path.exists(): | ||
| references = _extract_references_from_file( | ||
| abs_file_path.parent, Path(abs_file_path.name) | ||
| ) | ||
| all_need_references.extend(references) |
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.
I think due to '_extract_ref...' it will skip the 'bazel-' stuff and other things anyway?
Or was that before and we have to explicitly skip them here?
I would say it would make sense to skip them, as we don't want to go through all of those directories, binary files etc.
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.
The idea is that all source files are explicitly included via Bazel (see all the new filegroup targets). No need for filtering in Python.
| filegroup( | ||
| name = "all_sources", | ||
| srcs = glob(["*.py"]), | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| py_library( | ||
| name = "score_draw_uml_funcs", | ||
| srcs = glob( | ||
| ["*.py"], | ||
| ), | ||
| srcs = [":all_sources"], |
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.
Don't quiet understand this change. What's the meaning behind it?
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.
This "list of py files" is needed for py_library and also in the collection of all sources. See src/BUILD. This is why we need separate filegroup targets everywhere.
| @@ -0,0 +1,72 @@ | |||
| # ******************************************************************************* | |||
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.
How would we best test this?
MaximilianSoerenPollak
left a comment
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.
Overall looks great from my side.
Script part is simple and concise.
Just had some questions regarding some of the things done as I don't understand them.
Currently, we are not using it yet, but this commit adds the Bazel scaffolding to make the json data available.
| } | ||
|
|
||
| scl_cache_json = get_cache_filename( | ||
| app.outdir, "score_source_code_linker_cache.json" |
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.
Interesting. There already seems to be a mechanism to store the source links in a JSON file.
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.
Yes, it already stores the links inside the _build file in 3 json files.
One for the tests, one for the source links and one for the combine one.
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.
This is mainly used as a 'cache' currently and not exported. But could be easily done so.
Though still need the extra script as at the moment it only runs after extension is activated / called upon.
5dd326c to
e2bfbf7
Compare
d781b67 to
529deb8
Compare
📌 Description
Provides a Bazel command for source links to make source dependency explicit.
Use this target in
docs()instead of implicitly scanning the git repo.This allows to have source links even for other modules.
🚨 Impact Analysis
✅ Checklist