INNER CODE UNIT · Python
fingerprint
alper-han/CrossMacro · scripts/ci/nuget-cache.py:14
def fingerprint(root, profile, platform):
tracked = subprocess.check_output(['git', 'ls-files', '-z'], cwd=root).decode().split('\0')
projects = {p for p in tracked if p.endswith('.csproj')}
if profile == 'publish':
host = {'Linux': 'Linux', 'Windows': 'Windows', 'macOS': 'MacOS'}[platform]
pending = [f'src/CrossMacro.UI.{host}/CrossMacro.UI.{host}.csproj']
if platform == 'Linux':
pending.append('src/CrossMacro.Daemon/CrossMacro.Daemon.csproj')
selected = set()
while pending:
name = pending.pop()
if name in selected:
continue
selected.add(name)
for ref in ET.parse(root / name).getroot().iter('ProjectReference'):
value = ref.get('Include', '').replace('\\', '/')
if not value or any(c in value for c in '$*;'):
# Dynamic references cannot safely narrow the restore graph.