From 035df5369e34fdb7bda954601800cd00b8d8ef8e Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 17 Aug 2021 12:37:21 -0700 Subject: 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 --- mesonbuild/scripts/depscan.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'mesonbuild/scripts/depscan.py') diff --git a/mesonbuild/scripts/depscan.py b/mesonbuild/scripts/depscan.py index 9fc435b5d..68e7dc49d 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() -- cgit v1.2.3