summaryrefslogtreecommitdiffstats
path: root/build/clang-plugin/ThirdPartyPaths.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /build/clang-plugin/ThirdPartyPaths.py
parentInitial commit. (diff)
downloadfirefox-e51783d008170d9ab27d25da98ca3a38b0a41b67.tar.xz
firefox-e51783d008170d9ab27d25da98ca3a38b0a41b67.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/clang-plugin/ThirdPartyPaths.py')
-rw-r--r--build/clang-plugin/ThirdPartyPaths.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/build/clang-plugin/ThirdPartyPaths.py b/build/clang-plugin/ThirdPartyPaths.py
new file mode 100644
index 0000000000..caaa919d43
--- /dev/null
+++ b/build/clang-plugin/ThirdPartyPaths.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+
+import json
+
+
+def generate(output, *input_paths):
+ """
+ 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 = []
+ 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)
+ tpp_strings = ",\n ".join([json.dumps(tpp) for tpp in sorted(tpp_list)])
+
+ 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))
+ )