diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-08-17 12:37:21 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-08-18 11:58:45 -0700 |
commit | 035df5369e34fdb7bda954601800cd00b8d8ef8e (patch) | |
tree | ee8cb9aa9db265009bb8ae964bac0b51d7e7cbfe /mesonbuild/scripts | |
parent | a216de4898cc7b9aafaecf6ebbe19d79d1c5aea3 (diff) | |
download | meson-035df5369e34fdb7bda954601800cd00b8d8ef8e.zip meson-035df5369e34fdb7bda954601800cd00b8d8ef8e.tar.gz meson-035df5369e34fdb7bda954601800cd00b8d8ef8e.tar.bz2 |
backends/ninja: write depscan input files to json
Currently, we write each file to the command line, but this can result in
situations where the number of files passed exceeds OS imposed command
line limits. For compilers, we solve this with response files. For
depscan I've chosen to use a JSON list instead. JSON has several
advantages in that it's standardized, there's a built-in python module
for it, and it's familiar. I've also chosen to always use the JSON file
instead of having a heuristic to decide between JSON and not JSON,
while there may be a small performance trade off here, keeping the
implementation simple with only one path is wort it.
Fixes #9129
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r-- | mesonbuild/scripts/depscan.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mesonbuild/scripts/depscan.py b/mesonbuild/scripts/depscan.py index 9fc435b..68e7dc4 100644 --- a/mesonbuild/scripts/depscan.py +++ b/mesonbuild/scripts/depscan.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json +import os import pathlib import pickle import re -import os import sys import typing as T @@ -194,8 +195,9 @@ class DependencyScanner: return 0 def run(args: T.List[str]) -> int: - pickle_file = args[0] - outfile = args[1] - sources = args[2:] + assert len(args) == 3, 'got wrong number of arguments!' + pickle_file, outfile, jsonfile = args + with open(jsonfile, 'r', encoding='utf-8') as f: + sources = json.load(f) scanner = DependencyScanner(pickle_file, outfile, sources) return scanner.scan() |