2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-28 08:43:26 +00:00

Fix building without sandboxing (#769)

Since 466c32c70f any changes you made
while testing rules_foreign_cc, or changes to those rules, would not
invalidate the CMakeCache.txt and lead to build issues. It wasn't the
case before that because new temp dirs were used each time.
This commit is contained in:
Keith Smiley 2021-08-20 01:33:10 -07:00 committed by GitHub
parent be72696944
commit 4ee863c1fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 0 deletions

View file

@ -63,6 +63,9 @@ def built_tool_rule_impl(ctx, script_lines, out_dir, mnemonic):
"export EXT_BUILD_ROOT=##pwd##",
"export INSTALLDIR=$$EXT_BUILD_ROOT$$/{}".format(out_dir.path),
"export BUILD_TMPDIR=$$INSTALLDIR$$.build_tmpdir",
"##rm_rf## $$INSTALLDIR$$",
"##rm_rf## $$BUILD_TMPDIR$$",
"##mkdirs## $$INSTALLDIR$$",
"##mkdirs## $$BUILD_TMPDIR$$",
"##copy_dir_contents_to_dir## ./{} $$BUILD_TMPDIR$$".format(root),
"cd $$BUILD_TMPDIR$$",

View file

@ -396,6 +396,8 @@ def cc_external_rule_impl(ctx, attrs):
"##script_prelude##",
] + env_prelude + [
"##path## $$EXT_BUILD_ROOT$$",
"##rm_rf## $$BUILD_TMPDIR$$",
"##rm_rf## $$EXT_BUILD_DEPS$$",
"##mkdirs## $$INSTALLDIR$$",
"##mkdirs## $$BUILD_TMPDIR$$",
"##mkdirs## $$EXT_BUILD_DEPS$$",

View file

@ -203,6 +203,10 @@ PLATFORM_COMMANDS = {
"Replace the target symlink with resolved file it points to if `file` is a symlink"
),
),
"rm_rf": _command_info(
arguments = [_argument_info(name = "path", data_type = type(""), doc = "Path to directory")],
doc = "Recursively removes the given path",
),
"script_extension": _command_info(
arguments = [],
doc = "Return the extension for the current set of commands (`.sh` for bash, `.ps1` for powershell)",

View file

@ -41,6 +41,9 @@ def disable_tracing():
def mkdirs(path):
return "mkdir -p " + path
def rm_rf(path):
return "rm -rf " + path
def if_else(condition, if_text, else_text):
return """
if [ {condition} ]; then

View file

@ -41,6 +41,9 @@ def disable_tracing():
def mkdirs(path):
return "mkdir -p " + path
def rm_rf(path):
return "rm -rf " + path
def if_else(condition, if_text, else_text):
return """\
if [ {condition} ]; then

View file

@ -41,6 +41,9 @@ def disable_tracing():
def mkdirs(path):
return "mkdir -p " + path
def rm_rf(path):
return "rm -rf " + path
def if_else(condition, if_text, else_text):
return """\
if [ {condition} ]; then