Repository Public MIT
1#!/usr/bin/env bash2# ORIX Calc3# File: Scripts/generate.sh4# Description: Generates ORIXCalc.xcodeproj with XcodeGen. Feature packages that are not present yet are left out so the app still builds.5#6# Author: Simon-Pierre Boucher7# Contact: contact@spboucher.ai8set -euo pipefail9cd "$(dirname "$0")/.."10spec="$(mktemp -t orix-project).yml"11python3 - "$spec" <<'PY'12import os, re, sys13lines = open('project.yml').read().split('\n')14missing = set()15for line in lines:16 m = re.match(r'\s+(\w+): \{ path: (Packages/\w+) \}', line)17 if m and not os.path.exists(os.path.join(m.group(2), 'Package.swift')):18 missing.add(m.group(1))19# ORIX_EXCLUDE="ORIXGraph ORIXFeatureGraph" leaves packages out on purpose (useful while one of them is being reworked)20missing |= set(os.environ.get('ORIX_EXCLUDE', '').split())21out = [l for l in lines if not any(re.match(rf'\s+{name}: \{{ path', l) or l.strip() == f'- package: {name}' for name in missing)]22features = ['Financial', 'Convert', 'Graph', 'Math', 'Statistics', 'Workspace']23flags = ' '.join('ORIX_HAS_' + f.upper() for f in features if 'ORIXFeature' + f not in missing)24open(sys.argv[1], 'w').write('\n'.join(out).replace('__ORIX_FEATURE_FLAGS__', flags))25if missing: print('left out (not present):', ', '.join(sorted(missing)))26PY27cp "$spec" .project.generated.yml28xcodegen generate --spec .project.generated.yml --project . --quiet29rm -f .project.generated.yml "$spec"30echo "generated ORIXCalc.xcodeproj"31