forked from aspect-build/toolchains_protoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: ensure we don't try to compile any C++ code (aspect-build#16)
* chore: ensure we don't try to compile any C++ code We don't have any C++ code in this repo, and want to make sure that our examples don't transitively depend on building protoc from source. * Update MODULE.bazel Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im> * Disable CGo (aspect-build#17) * chore: buildifier --------- Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
- Loading branch information
Showing
5 changed files
with
69 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,8 @@ | ||
load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS") | ||
|
||
platform( | ||
name = "no_cgo_host_platform", | ||
constraint_values = HOST_CONSTRAINTS + [ | ||
"@rules_go//go/toolchain:cgo_off", | ||
], | ||
) |
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,31 @@ | ||
"""Define a non-functional cc toolchain. | ||
To fail-fast in cases where we are forced to compile third-party C++ code, | ||
define a cc toolchain that doesn't work, by using 'false' as the compiler. | ||
See https://bazel.build/tutorials/ccp-toolchain-config | ||
""" | ||
|
||
load("defs.bzl", "cc_toolchain_config") | ||
|
||
filegroup(name = "empty") | ||
|
||
cc_toolchain_config(name = "noop_toolchain_config") | ||
|
||
cc_toolchain( | ||
name = "noop_toolchain", | ||
all_files = ":empty", | ||
compiler_files = ":empty", | ||
dwp_files = ":empty", | ||
linker_files = ":empty", | ||
objcopy_files = ":empty", | ||
strip_files = ":empty", | ||
supports_param_files = 0, | ||
toolchain_config = ":noop_toolchain_config", | ||
toolchain_identifier = "noop-toolchain", | ||
) | ||
|
||
toolchain( | ||
name = "cc_toolchain", | ||
toolchain = ":noop_toolchain", | ||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", | ||
) |
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,20 @@ | ||
"Configure a cc toolchain to call 'false' if used." | ||
|
||
def _impl(ctx): | ||
return cc_common.create_cc_toolchain_config_info( | ||
ctx = ctx, | ||
toolchain_identifier = "noop-toolchain", | ||
host_system_name = "local", | ||
target_system_name = "local", | ||
target_cpu = "k8", | ||
target_libc = "unknown", | ||
compiler = "false", | ||
abi_version = "unknown", | ||
abi_libc_version = "unknown", | ||
) | ||
|
||
cc_toolchain_config = rule( | ||
implementation = _impl, | ||
attrs = {}, | ||
provides = [CcToolchainConfigInfo], | ||
) |