Skip to content

Add dependencies of tools from toolchain to runfiles - #274

Open
furtib wants to merge 1 commit into
Ericsson:mainfrom
furtib:toolchain-provide-runfiles
Open

Add dependencies of tools from toolchain to runfiles#274
furtib wants to merge 1 commit into
Ericsson:mainfrom
furtib:toolchain-provide-runfiles

Conversation

@furtib

@furtib furtib commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Why:
We currently only provide the single entry-script/binary to tools defined with our toolchain. (In CodeCheckers' case, this means only the entry script is available in the sandbox, not the entire installation of CodeChecker.)
This can cause trouble when users are trying to use the toolchain with their custom Bazel-provided CodeChecker versions.

What:

  • Have the toolchain provide the necessary run_files for each target it was defined for. (So in the case of CodeChecker, every file of the project.)

Addresses:
none

Test: #277

@furtib
furtib requested a review from Szelethus August 10, 2026 13:51
@furtib furtib self-assigned this Aug 10, 2026
@furtib furtib added the enhancement New feature or request label Aug 10, 2026
@nettle

nettle commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Right thinking @furtib!
But again, I think we better have some evidences of possible troubles.

Comment on lines +24 to +31
transitive = [
# We also collect files necessary for these programs to run.
# Those files should be declared with `data = [...]`
# in the executable's target.
ctx.attr.codechecker[DefaultInfo].data_runfiles.files,
ctx.attr.clangsa[DefaultInfo].data_runfiles.files,
ctx.attr.clang_tidy[DefaultInfo].data_runfiles.files,
],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wonder what dependencies we see here?
Can/should we add a test for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeChecker is not a single executable, so we mainly expect its files to be here.
I will try to mock something up using skylib.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is - I think it has no sense to add/change something that does not work.
My question is - if this works what exact dependencies we actually missing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current state of the toolchain, it only captures the entry script of a standalone codechecker tar.gz (CodeChecker/bin/CodeChecker). Any other file (e.g., CodeChecker/bin/subcmd/CodeChecker-main which is called by the entry script) is not captured by the toolchain.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it has no sense to add/change something that does not work.

What do you mean specifically?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, do you see CodeChecker/bin/subcmd/CodeChecker-main in transitive dependencies? To be honest I have some doubts that transitive works here, it would be really interesting to see...

Comment thread src/codechecker.bzl
config_file,
] + source_files,
),
tools = [info.runfiles],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much nicer!

@furtib
furtib force-pushed the toolchain-provide-runfiles branch from 1ddc6cc to 0e9307e Compare August 13, 2026 09:41

@Szelethus Szelethus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that we are following standard Bazel idioms here, but they might not be that obvious, especially how we expect the data field of the toolchain to be populated. Lets document how to add a custom toolchain in README.

I know that we will need to split README up eventually -- but until thats done, throw it there.

Comment on lines +24 to +31
transitive = [
# We also collect files necessary for these programs to run.
# Those files should be declared with `data = [...]`
# in the executable's target.
ctx.attr.codechecker[DefaultInfo].data_runfiles.files,
ctx.attr.clangsa[DefaultInfo].data_runfiles.files,
ctx.attr.clang_tidy[DefaultInfo].data_runfiles.files,
],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it has no sense to add/change something that does not work.

What do you mean specifically?

@Szelethus Szelethus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a cheap review, but please create an issue. You can likely reproduce with CodeChecker's standalone_package target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants