зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1745115 - Allow to give multiple configs to build-clang.py. r=firefox-build-system-reviewers,andi
And merge them. This will allow to deduplicate and uniformize them. Differential Revision: https://phabricator.services.mozilla.com/D133316
This commit is contained in:
Родитель
7c80050538
Коммит
8c429c53cc
|
@ -599,6 +599,7 @@ if __name__ == "__main__":
|
|||
parser.add_argument(
|
||||
"-c",
|
||||
"--config",
|
||||
action="append",
|
||||
required=True,
|
||||
type=argparse.FileType("r"),
|
||||
help="Clang configuration file",
|
||||
|
@ -650,11 +651,35 @@ if __name__ == "__main__":
|
|||
cc_name = "clang-cl"
|
||||
cxx_name = "clang-cl"
|
||||
|
||||
config_dir = os.path.dirname(args.config.name)
|
||||
config = json.load(args.config)
|
||||
patches = config.get("patches")
|
||||
if patches:
|
||||
config["patches"] = [os.path.join(this_config_dir, p) for p in patches]
|
||||
config = {}
|
||||
# Merge all the configs we got from the command line.
|
||||
for c in args.config:
|
||||
this_config_dir = os.path.dirname(c.name)
|
||||
this_config = json.load(c)
|
||||
patches = this_config.get("patches")
|
||||
if patches:
|
||||
this_config["patches"] = [os.path.join(this_config_dir, p) for p in patches]
|
||||
for key, value in this_config.items():
|
||||
old_value = config.get(key)
|
||||
if old_value is None:
|
||||
config[key] = value
|
||||
elif value is None:
|
||||
if key in config:
|
||||
del config[key]
|
||||
elif type(old_value) != type(value):
|
||||
raise Exception(
|
||||
"{} is overriding `{}` with a value of the wrong type".format(
|
||||
c.name, key
|
||||
)
|
||||
)
|
||||
elif isinstance(old_value, list):
|
||||
for v in value:
|
||||
if v not in old_value:
|
||||
old_value.append(v)
|
||||
elif isinstance(old_value, dict):
|
||||
raise Exception("{} is setting `{}` to a dict?".format(c.name, key))
|
||||
else:
|
||||
config[key] = value
|
||||
|
||||
stages = 2
|
||||
if "stages" in config:
|
||||
|
|
|
@ -4,7 +4,7 @@ set -x -e -v
|
|||
# This script is for building clang.
|
||||
|
||||
ORIGPWD="$PWD"
|
||||
JSON_CONFIG="$1"
|
||||
CONFIGS=$(for c; do echo -n " -c $GECKO_PATH/$c"; done)
|
||||
|
||||
cd $GECKO_PATH
|
||||
|
||||
|
@ -16,7 +16,7 @@ if [ -d "$MOZ_FETCHES_DIR/binutils/bin" ]; then
|
|||
export PATH="$MOZ_FETCHES_DIR/binutils/bin:$PATH"
|
||||
fi
|
||||
|
||||
case "$JSON_CONFIG" in
|
||||
case "$CONFIGS" in
|
||||
*macosx64*)
|
||||
# these variables are used in build-clang.py
|
||||
export CROSS_CCTOOLS_PATH=$MOZ_FETCHES_DIR/cctools
|
||||
|
@ -38,7 +38,7 @@ case "$JSON_CONFIG" in
|
|||
*linux64*|*android*)
|
||||
;;
|
||||
*)
|
||||
echo Cannot figure out build configuration for $JSON_CONFIG
|
||||
echo Cannot figure out build configuration for $CONFIGS
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -47,7 +47,7 @@ esac
|
|||
set +x
|
||||
|
||||
cd $MOZ_FETCHES_DIR/llvm-project
|
||||
python3 $GECKO_PATH/build/build-clang/build-clang.py -c $GECKO_PATH/$1
|
||||
python3 $GECKO_PATH/build/build-clang/build-clang.py $CONFIGS
|
||||
|
||||
set -x
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче