-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bazel] Patch rules_foreign_cc to clean build logs
Move rules_foreign_cc from the root MODULE.bazel to its own `third_party/foreign_cc` directory so that we can patch it to fix an issue that has not yet been supported upstream yet, in the same way as we do for e.g. `rules_rust`. When `rules_foreign_cc` builds using tools such as e.g. Configure+Make, output files Configure.log and BootstrapGNUMake.log are generated and emitted which contain references to the absolute path. When building inside Bazel's sandbox, this produces a non-determinstic output which changes between each run, preventing builds of openocd from being cached. The OpenOCD binary defined as an execution environment attribute, and so will be built when running tests, stopping FPGA test results from being cached when they should be. To fix this, this PR introduces a simple patch to completely remove this logging output, as it is not needed by any later steps as part of the build. Signed-off-by: Alex Jones <[email protected]>
- Loading branch information
1 parent
20c4fb3
commit 184e3b4
Showing
5 changed files
with
40 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright lowRISC contributors (OpenTitan project). | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
package(default_visibility = ["//visibility:public"]) |
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,15 @@ | ||
# Copyright lowRISC contributors (OpenTitan project). | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Dependencies: | ||
bazel_dep(name = "rules_foreign_cc", version = "0.9.0") | ||
|
||
# Overrides and patches: | ||
single_version_override( | ||
module_name = "rules_foreign_cc", | ||
patches = [ | ||
"//third_party/foreign_cc/patches:rules_foreign_cc.remove_log_output.patch", | ||
], | ||
version = "0.9.0", | ||
) |
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,5 @@ | ||
# Copyright lowRISC contributors (OpenTitan project). | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
package(default_visibility = ["//visibility:public"]) |
13 changes: 13 additions & 0 deletions
13
third_party/foreign_cc/patches/rules_foreign_cc.remove_log_output.patch
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,13 @@ | ||
diff --git foreign_cc/private/framework.bzl foreign_cc/private/framework.bzl | ||
index c84c217..f43da2c 100644 | ||
--- foreign_cc/private/framework.bzl | ||
+++ foreign_cc/private/framework.bzl | ||
@@ -561,7 +561,7 @@ def wrap_outputs(ctx, lib_name, configure_name, script_text, build_script_file = | ||
cleanup_on_success_function = create_function( | ||
ctx, | ||
"cleanup_on_success", | ||
- "rm -rf $BUILD_TMPDIR $EXT_BUILD_DEPS", | ||
+ "rm -rf $BUILD_TMPDIR $EXT_BUILD_DEPS && echo > $BUILD_LOG", | ||
) | ||
cleanup_on_failure_function = create_function( | ||
ctx, |