INNER CODE UNIT · Python

update_ios_project_version

blokadaorg/blokada · scripts/version.py:39

def update_ios_project_version(xcodeproj_file, version_name, version_code):
    """
    Update the Xcode project file (.pbxproj) by replacing:
      - CURRENT_PROJECT_VERSION with version_code
      - MARKETING_VERSION with version_name
    """
    try:
        with open(xcodeproj_file, "r") as f:
            content = f.read()
    except Exception as e:
        sys.exit(f"Error reading Xcode project file {xcodeproj_file}: {e}")

    # Update CURRENT_PROJECT_VERSION (a numeric value)
    content, count1 = re.subn(
        r'(CURRENT_PROJECT_VERSION\s*=\s*)(\d+)(\s*;)',
        lambda m: f"{m.group(1)}{version_code}{m.group(3)}",
        content
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…