2019-08-01 07:45:02 +03:00
|
|
|
#!/usr/bin/env python3
|
2017-04-27 19:44:46 +03:00
|
|
|
|
|
|
|
import json
|
|
|
|
|
2018-05-22 00:58:19 +03:00
|
|
|
|
2019-09-05 17:24:21 +03:00
|
|
|
def generate(output, *input_paths):
|
2017-04-27 19:44:46 +03:00
|
|
|
"""
|
|
|
|
This file generates a ThirdPartyPaths.cpp file from the ThirdPartyPaths.txt
|
|
|
|
file in /tools/rewriting, which is used by the Clang Plugin to help identify
|
|
|
|
sources which should be ignored.
|
|
|
|
"""
|
|
|
|
tpp_list = []
|
2019-09-05 17:24:21 +03:00
|
|
|
lines = set()
|
|
|
|
|
|
|
|
for path in input_paths:
|
|
|
|
with open(path) as f:
|
|
|
|
lines.update(f.readlines())
|
|
|
|
|
|
|
|
for line in lines:
|
|
|
|
line = line.strip()
|
|
|
|
if line.endswith('/'):
|
|
|
|
line = line[:-1]
|
|
|
|
tpp_list.append(line)
|
2020-02-21 14:04:12 +03:00
|
|
|
tpp_strings = ',\n '.join([json.dumps(tpp) for tpp in sorted(tpp_list)])
|
2017-04-27 19:44:46 +03:00
|
|
|
|
|
|
|
output.write("""\
|
|
|
|
/* THIS FILE IS GENERATED BY ThirdPartyPaths.py - DO NOT EDIT */
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
const char* MOZ_THIRD_PARTY_PATHS[] = {
|
|
|
|
%s
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const uint32_t MOZ_THIRD_PARTY_PATHS_COUNT = %d;
|
|
|
|
|
|
|
|
""" % (tpp_strings, len(tpp_list)))
|