Fixed provider name which was violating naming conventions (#620)

This commit is contained in:
UebelAndre 2021-04-23 10:11:13 -07:00 committed by GitHub
parent 11e971d78b
commit a2ec6c0d26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 39 deletions

View File

@ -1,8 +1,8 @@
# buildifier: disable=module-docstring
load("//foreign_cc/private/shell_toolchain/toolchains:commands.bzl", "PLATFORM_COMMANDS")
load(":function_and_call.bzl", "FunctionAndCall")
load(":function_and_call.bzl", "FunctionAndCallInfo")
_function_and_call_type = type(FunctionAndCall(text = ""))
_function_and_call_type = type(FunctionAndCallInfo(text = ""))
def create_context(ctx):
return struct(
@ -16,7 +16,7 @@ def create_context(ctx):
def call_shell(shell_context, method_, *args):
"""Calls the 'method_' shell command from the toolchain.
Checks the number and types of passed arguments.
If the command returns the resulting text wrapped into FunctionAndCall provider,
If the command returns the resulting text wrapped into FunctionAndCallInfo provider,
puts the text of the function into the 'prelude' dictionary in the 'shell_context',
and returns only the call of that function.
"""

View File

@ -1,6 +1,5 @@
# buildifier: disable=module-docstring
# buildifier: disable=name-conventions
FunctionAndCall = provider(
FunctionAndCallInfo = provider(
doc = "Wrapper to pass function definition and (if custom) function call",
fields = {
"call": "How to call defined function, if different from <function-name> <arg1> ...<argn>",

View File

@ -1,5 +1,5 @@
# buildifier: disable=module-docstring
load("@rules_foreign_cc//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCall")
load("@rules_foreign_cc//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCallInfo")
_REPLACE_VALUE = "\\${EXT_BUILD_DEPS}"
@ -52,7 +52,7 @@ def define_function(name, text):
return "\n".join(lines)
def replace_in_files(dir, from_, to_):
return FunctionAndCall(
return FunctionAndCallInfo(
text = """\
if [ -d "$1" ]; then
find -L $1 -type f \\( -name "*.pc" -or -name "*.la" -or -name "*-config" -or -name "*.cmake" \\) -exec sed -i 's@'"$2"'@'"$3"'@g' {} ';'
@ -85,7 +85,7 @@ elif [[ -d "$1" ]]; then
done
fi
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def symlink_to_dir(source, target):
text = """\
@ -111,7 +111,7 @@ else
echo "Can not copy $1"
fi
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def script_prelude():
return "set -euo pipefail"
@ -125,7 +125,7 @@ for child in $children; do
return
done
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def cat(filepath):
return "cat \"{}\"".format(filepath)
@ -145,7 +145,7 @@ def cleanup_function(on_success, on_failure):
on_failure,
"fi",
])
return FunctionAndCall(text = text, call = "trap \"cleanup_function\" EXIT")
return FunctionAndCallInfo(text = text, call = "trap \"cleanup_function\" EXIT")
def children_to_path(dir_):
text = """\
@ -158,7 +158,7 @@ if [ -d {dir_} ]; then
fi
done
fi""".format(dir_ = dir_)
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def define_absolute_paths(dir_, abs_path):
return "##replace_in_files## {dir_} {REPLACE_VALUE} {abs_path}".format(

View File

@ -1,5 +1,5 @@
# buildifier: disable=module-docstring
load("@rules_foreign_cc//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCall")
load("@rules_foreign_cc//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCallInfo")
_REPLACE_VALUE = "\\${EXT_BUILD_DEPS}"
@ -52,7 +52,7 @@ def define_function(name, text):
return "\n".join(lines)
def replace_in_files(dir, from_, to_):
return FunctionAndCall(
return FunctionAndCallInfo(
text = """\
if [ -d "$1" ]; then
find -L $1 -type f \\( -name "*.pc" -or -name "*.la" -or -name "*-config" -or -name "*.cmake" \\) -exec sed -i 's@'"$2"'@'"$3"'@g' {} ';'
@ -85,7 +85,7 @@ elif [[ -d "$1" ]]; then
done
fi
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def symlink_to_dir(source, target):
text = """\
@ -111,7 +111,7 @@ else
echo "Can not copy $1"
fi
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def script_prelude():
return "set -euo pipefail"
@ -125,7 +125,7 @@ for child in $children; do
return
done
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def cat(filepath):
return "cat \"{}\"".format(filepath)
@ -145,7 +145,7 @@ def cleanup_function(on_success, on_failure):
on_failure,
"fi",
])
return FunctionAndCall(text = text, call = "trap \"cleanup_function\" EXIT")
return FunctionAndCallInfo(text = text, call = "trap \"cleanup_function\" EXIT")
def children_to_path(dir_):
text = """\
@ -158,7 +158,7 @@ if [ -d {dir_} ]; then
fi
done
fi""".format(dir_ = dir_)
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def define_absolute_paths(dir_, abs_path):
return "##replace_in_files## {dir_} {REPLACE_VALUE} {abs_path}".format(

View File

@ -1,5 +1,5 @@
# buildifier: disable=module-docstring
load("@rules_foreign_cc//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCall")
load("@rules_foreign_cc//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCallInfo")
_REPLACE_VALUE = "\\${EXT_BUILD_DEPS}"
@ -52,7 +52,7 @@ def define_function(name, text):
return "\n".join(lines)
def replace_in_files(dir, from_, to_):
return FunctionAndCall(
return FunctionAndCallInfo(
text = """\
if [ -d "$1" ]; then
find -L -f $1 \\( -name "*.pc" -or -name "*.la" -or -name "*-config" -or -name "*.cmake" \\) -exec sed -i '' -e 's@'"$2"'@'"$3"'@g' {} ';'
@ -87,7 +87,7 @@ for child in "${children[@]:-}"; do
fi
done
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def symlink_contents_to_dir(source, target):
text = """\
@ -108,7 +108,7 @@ elif [[ -d "$1" ]]; then
done
fi
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def symlink_to_dir(source, target):
text = """\
@ -134,7 +134,7 @@ else
echo "Can not copy $1"
fi
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def script_prelude():
return "set -euo pipefail"
@ -148,7 +148,7 @@ for child in $children; do
return
done
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def cat(filepath):
return "cat \"{}\"".format(filepath)
@ -168,7 +168,7 @@ def cleanup_function(on_success, on_failure):
on_failure,
"fi",
])
return FunctionAndCall(text = text, call = "trap \"cleanup_function\" EXIT")
return FunctionAndCallInfo(text = text, call = "trap \"cleanup_function\" EXIT")
def children_to_path(dir_):
text = """\
@ -181,7 +181,7 @@ if [ -d {dir_} ]; then
fi
done
fi""".format(dir_ = dir_)
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def define_absolute_paths(dir_, abs_path):
return "##replace_in_files## {dir_} {REPLACE_VALUE} {abs_path}".format(

View File

@ -1,5 +1,5 @@
# buildifier: disable=module-docstring
load("@rules_foreign_cc//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCall")
load("@rules_foreign_cc//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCallInfo")
_REPLACE_VALUE = "\\${EXT_BUILD_DEPS}"
@ -52,7 +52,7 @@ def define_function(name, text):
return "\n".join(lines)
def replace_in_files(dir, from_, to_):
return FunctionAndCall(
return FunctionAndCallInfo(
text = """\
if [ -d "$1" ]; then
$REAL_FIND -L $1 -type f \\( -name "*.pc" -or -name "*.la" -or -name "*-config" -or -name "*.cmake" \\) -exec sed -i 's@'"$2"'@'"$3"'@g' {} ';'
@ -85,7 +85,7 @@ elif [[ -d "$1" ]]; then
done
fi
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def symlink_to_dir(source, target):
text = """\
@ -111,7 +111,7 @@ else
echo "Can not copy $1"
fi
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def script_prelude():
return """\
@ -135,7 +135,7 @@ for child in $children; do
return
done
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def cat(filepath):
return "cat \"{}\"".format(filepath)
@ -155,7 +155,7 @@ def cleanup_function(on_success, on_failure):
on_failure,
"fi",
])
return FunctionAndCall(text = text, call = "trap \"cleanup_function\" EXIT")
return FunctionAndCallInfo(text = text, call = "trap \"cleanup_function\" EXIT")
def children_to_path(dir_):
text = """\
@ -168,7 +168,7 @@ if [ -d {dir_} ]; then
fi
done
fi""".format(dir_ = dir_)
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def define_absolute_paths(dir_, abs_path):
return "##replace_in_files## {dir_} {REPLACE_VALUE} {abs_path}".format(

View File

@ -12,7 +12,7 @@ load(
)
# buildifier: disable=bzl-visibility
load("//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCall")
load("//foreign_cc/private/shell_toolchain/toolchains:function_and_call.bzl", "FunctionAndCallInfo")
def _use_var_linux(varname):
return "$" + varname
@ -134,7 +134,7 @@ def _do_function_call_test(ctx):
def _touch(path):
text = "call_touch $1"
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def _define_function(name, text):
return "function " + name + "() {\n " + text + "\n}"
@ -156,7 +156,7 @@ def _cleanup_function(message_cleaning, message_keeping):
"echo \"\"",
"fi",
])
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def _do_function_call_with_body_test(ctx):
env = unittest.begin(ctx)
@ -210,7 +210,7 @@ for child in $children; do
##symlink_to_dir## $child $target
done
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def _symlink_to_dir(source, target):
text = """local target="$2"
@ -226,7 +226,7 @@ else
echo "Can not copy $1"
fi
"""
return FunctionAndCall(text = text)
return FunctionAndCallInfo(text = text)
def _script_conversion_test(ctx):
env = unittest.begin(ctx)