-
Notifications
You must be signed in to change notification settings - Fork 7
Update Public API #281
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?
Update Public API #281
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,47 @@ | ||
| load("@buildifier_prebuilt//:rules.bzl", "buildifier_test") | ||
|
|
||
| buildifier_test( | ||
| name = "buildifier", | ||
| exclude_patterns = [ | ||
| "./.ci/*", | ||
| "./.git/*", | ||
| ], | ||
| lint_mode = "warn", | ||
| lint_warnings = ["all"], | ||
| mode = "diff", | ||
| no_sandbox = True, | ||
| verbose = True, | ||
| workspace = "//:MODULE.bazel", | ||
| # Copyright 2026 Ericsson AB | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| load("//src:codechecker_toolchain.bzl", "codechecker_toolchain") | ||
|
|
||
| # The public labels of rules_codechecker live here, | ||
| # the implementation is in //src | ||
| # | ||
| # NOTE: only load from packages visible to our consumers here, | ||
| # this package is loaded by everyone who resolves //:default_toolchain | ||
|
|
||
| # Repository root marker, used by the buildifier test to find the workspace | ||
| exports_files( | ||
| ["MODULE.bazel"], | ||
| visibility = ["//test/buildifier:__pkg__"], | ||
| ) | ||
|
|
||
| # Named by convention | ||
| # https://bazel.build/extending/toolchains#writing-rules-toolchains | ||
| toolchain_type( | ||
| name = "toolchain_type", | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| # Tools found on PATH, provisioned by the default_codechecker_tools extension | ||
| codechecker_toolchain( | ||
| name = "default_tools", | ||
| clang_tidy = "@default_codechecker_tools//:clang_tidy", | ||
| clangsa = "@default_codechecker_tools//:clang", | ||
| codechecker = "@default_codechecker_tools//:CodeChecker", | ||
| ) | ||
|
|
||
| toolchain( | ||
| name = "default_toolchain", | ||
| toolchain = ":default_tools", | ||
| toolchain_type = ":toolchain_type", | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,7 +192,7 @@ def _per_file_impl(ctx): | |
| _create_wrapper_script(ctx, options, compile_commands, config_file) | ||
|
|
||
| # TODO: Consider using aliases so we don't have to type //src: everywhere. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to preserve this comment if this PR lands.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point! |
||
| info = ctx.toolchains["//src:toolchain_type"].codecheckerinfo | ||
| info = ctx.toolchains["//:toolchain_type"].codecheckerinfo | ||
| for target in ctx.attr.targets: | ||
| if not CcInfo in target: | ||
| continue | ||
|
|
@@ -284,5 +284,5 @@ per_file_test = rule( | |
| "test_script": "%{name}/test_script.sh", | ||
| }, | ||
| test = True, | ||
| toolchains = ["//src:toolchain_type"], | ||
| toolchains = ["//:toolchain_type"], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Copyright 2026 Ericsson AB | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving Buildifier into testing is outside the scope of a Public API patch.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, I've created a separate PR: #289 |
||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| load("@buildifier_prebuilt//:rules.bzl", "buildifier_test") | ||
|
|
||
| # Patches applied to buildifier_prebuilt, see MODULE.bazel | ||
| exports_files([ | ||
| "prune.patch", | ||
| "template.patch", | ||
| ]) | ||
|
|
||
| # The linter is declared here, and not in the root package, because | ||
| # buildifier_prebuilt is a dev dependency and therefore not visible to our | ||
| # consumers, while the root package is loaded by everyone who resolves | ||
| # //:default_toolchain. The whole repository is still checked, no_sandbox | ||
| # and the workspace attribute make the test run from the repository root. | ||
| buildifier_test( | ||
| name = "buildifier", | ||
| exclude_patterns = [ | ||
| "./.ci/*", | ||
| "./.git/*", | ||
| ], | ||
| lint_mode = "warn", | ||
| lint_warnings = ["all"], | ||
| mode = "diff", | ||
| no_sandbox = True, | ||
| verbose = True, | ||
| workspace = "//:MODULE.bazel", | ||
| ) | ||
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 name does not communicate that this toolchain cannot be used with remote executors!
This toolchain is specific to a user's local environment.
We could rename it to something like this.
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.
Well... "local" is actually kinda misleading and wrong here.
Local to what? Besides, should this be default forever?
Default tools are being taken from the environment currently, which is totally wrong!
Later default_tools should became real default, not local.