mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-12 18:45:33 -10:00
Nine PBXFileReference entries named files that are not in the tree:
RetroArch_Metal bitmap.h, stb_unicode.c, d3d10_common.c,
glslang_util_cxx.cpp, opaque.cg.h
RetroArch_iOS13 zconf.h, zlib.h
RetroArch_iOS11_Metal zconf.h, zlib.h
None was in a Sources or Resources build phase, so nothing was failing
to build - they show as missing files in Xcode's navigator and
nowhere else, which is why they survived so long. bitmap.h and
stb_unicode.c have successors that are already listed separately
(bitmapfont.h, stb.c); the other three are features that were removed.
Also fixes a reference this series broke: bitmapfont.c moved from
gfx/drivers_font_renderer/ to gfx/, so its entry moves from the
drivers_font_renderer group to the parent gfx group, which resolves to
the right place. bitmapfont.h is listed alongside it, reusing the
object id freed by bitmap.h.
The Sources build phases of all three projects are byte-identical
before and after, and the assertions the Apple workflow makes about
griffin_objc.m still hold.
tools/xcode_stale_refs.py is the check that found these. It compares
each reference's basename against the tree; it does not resolve group
paths, so a file that still exists but has moved will not be flagged,
and absolute paths are skipped as being the SDK or build products.
52 lines
2.1 KiB
Python
Executable File
52 lines
2.1 KiB
Python
Executable File
"""Report Xcode file references naming files that no longer exist.
|
|
|
|
Run from the repository root:
|
|
|
|
tools/xcode_stale_refs.py [-v]
|
|
|
|
Every PBXFileReference with sourceTree "<group>" names a file that
|
|
should be somewhere in the tree. This checks by basename, so it finds
|
|
references to files that were deleted or renamed, which is how
|
|
bitmap.h, stb_unicode.c, d3d10_common.c, glslang_util_cxx.cpp,
|
|
opaque.cg.h, zconf.h and zlib.h were found still listed after the
|
|
files themselves had gone.
|
|
|
|
Two limits worth knowing. It does not resolve the group path, so a
|
|
reference that names a file which still exists but has moved to a
|
|
different directory will not be flagged. And absolute paths, and paths
|
|
climbing out of the tree, are skipped: those are the SDK, Homebrew and
|
|
build products, none of which are ours to resolve."""
|
|
import re,os,glob,sys
|
|
from collections import defaultdict
|
|
|
|
present=defaultdict(list)
|
|
for root,dirs,fs in os.walk('.'):
|
|
if '.git' in root.split(os.sep): continue
|
|
for f in fs + dirs: # bundles/xcassets are directories
|
|
present[f].append(os.path.join(root,f))
|
|
|
|
tot=0
|
|
for pb in sorted(glob.glob('pkg/apple/*.xcodeproj/project.pbxproj')):
|
|
s=open(pb,encoding='utf-8',errors='surrogateescape').read()
|
|
miss=[]
|
|
for m in re.finditer(r'\{isa = PBXFileReference;(.*?)\};', s, re.S):
|
|
b=m.group(1)
|
|
st=re.search(r'sourceTree = ("[^"]*"|[^;]*);', b)
|
|
st=(st.group(1).strip('"') if st else '')
|
|
if st!='<group>': continue # SDK, build products, source root
|
|
p=re.search(r'\bpath = ("[^"]*"|[^;]*);', b)
|
|
if not p: continue
|
|
path=p.group(1).strip('"')
|
|
# absolute paths and paths climbing out of the tree are the
|
|
# SDK, Homebrew or build products - not ours to resolve
|
|
if path.startswith('/') or path.startswith('../../../'):
|
|
continue
|
|
base=os.path.basename(path)
|
|
if base not in present:
|
|
miss.append(path)
|
|
tot+=len(miss)
|
|
print("%-42s stale=%d" % (pb.split('/')[-2], len(miss)))
|
|
if miss and '-v' in sys.argv:
|
|
for x in sorted(set(miss)): print(" ", x)
|
|
print("\ntotal stale references:", tot)
|