summaryrefslogtreecommitdiffstats
path: root/bin/find-files-not-referenced-by-makefile.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /bin/find-files-not-referenced-by-makefile.py
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bin/find-files-not-referenced-by-makefile.py')
-rwxr-xr-xbin/find-files-not-referenced-by-makefile.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/bin/find-files-not-referenced-by-makefile.py b/bin/find-files-not-referenced-by-makefile.py
new file mode 100755
index 0000000000..0b5c648bf6
--- /dev/null
+++ b/bin/find-files-not-referenced-by-makefile.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python3
+
+# Look for CXX files that are not referenced by any makefile
+
+import subprocess
+import sys
+
+sourceFiles = set()
+
+a = subprocess.Popen("git ls-files", stdout=subprocess.PIPE, shell=True, encoding='utf8')
+with a.stdout as txt:
+ for filename in txt:
+ if filename.find(".cxx") != -1 \
+ and filename.find("precompiled") == -1 \
+ and filename.find("/workben") == -1 \
+ and not filename.startswith("odk/examples/") \
+ and not filename.startswith("bridges/") \
+ and not filename.startswith("compilerplugins/") \
+ and filename.find("/qa/") == -1 \
+ and filename.find("/test/") == -1 \
+ and not filename.startswith("testtools/") \
+ and not filename.startswith("vcl/") \
+ and not filename.startswith("cli_ure/"):
+ sourceFiles.add(filename.strip())
+
+a = subprocess.Popen("git ls-files */*.mk", stdout=subprocess.PIPE, shell=True, encoding='utf8')
+with a.stdout as txt:
+ for makefilename in txt:
+ makefilename = makefilename.strip()
+ with open(makefilename, "r") as makefile:
+ moduleName = makefilename[:makefilename.find("/")]
+ state = 0
+ for line in makefile:
+ line = line.strip()
+ if state == 0 and "_add_exception_objects" in line:
+ state = 1
+ elif state == 1 and line != "))":
+ s = line.replace("\\","").replace(")", "").strip()
+ # parse line like: $(call gb_Helper_optional,AVMEDIA,svx/source/sidebar/media/MediaPlaybackPanel) \
+ idx = s.rfind(",")
+ if idx != -1:
+ s = s[idx+1:].strip()
+ sourceFiles.discard(s + ".cxx")
+ elif state == 1:
+ state = 0
+
+
+
+
+print("files not listed in makefile")
+print("----------------------------")
+for x in sorted(sourceFiles):
+ print(x)