515dc189be
Currently, the Bazel build output directory format differs from legacy build.sh in that it replaces underscores directory name to hyphens. This behavior is undesirable, so refactor the output directory name logic to be consistent with legacy build.sh: out/msm-kernel-<target>-<variant> where words in the target and variant are underscore-delimited. Change-Id: Ia60076dd613fc034888703f10d5dc836b34c317b Signed-off-by: John Moon <quic_johmoo@quicinc.com>
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
def define_top_level_config(target):
|
|
"""Define common top-level variables in build.config"""
|
|
rule_name = "{}_top_level_config".format(target)
|
|
native.genrule(
|
|
name = rule_name,
|
|
srcs = [],
|
|
outs = ["build.config.bazel.top.level.{}".format(target)],
|
|
cmd_bash = """
|
|
cat << 'EOF' > "$@"
|
|
# === define_top_level_config ===
|
|
BUILDING_WITH_BAZEL=true
|
|
# === end define_top_level_config ===
|
|
EOF
|
|
""",
|
|
)
|
|
|
|
return ":{}".format(rule_name)
|
|
|
|
def gen_config_without_source_lines(build_config, target):
|
|
"""Replace "." or "source" lines in build.config files with shell null operator"""
|
|
rule_name = "{}.{}".format(target, build_config)
|
|
out_file_name = rule_name + ".generated"
|
|
native.genrule(
|
|
name = rule_name,
|
|
srcs = [build_config],
|
|
outs = [out_file_name],
|
|
cmd_bash = """
|
|
sed -e 's/^ *\\. /: # &/' \
|
|
-e 's/^ *source /: # &/' \
|
|
$(location {}) > "$@"
|
|
""".format(build_config),
|
|
)
|
|
|
|
return ":" + rule_name
|
|
|
|
def get_out_dir(msm_target, variant):
|
|
return "out/msm-kernel-{}-{}".format(msm_target.replace("-", "_"), variant.replace("-", "_"))
|