def update_project()

in fix_android_dependencies.py [0:0]


def update_project(project_path, toml_path):
    """Runs through all build configuration files and performs replacements for individual android project."""
    replacements = {}
    replacements.update(get_android_replacements())
    # Open the Gradle Version Catalog file and fetch its dependencies
    toml_dependencies = get_toml_dependencies(toml_path)
    replacements.update(get_dep_replacements(project_path, toml_dependencies))

    # Print all updates found
    print("Dependency updates:")
    for (k, v) in iter(replacements.items()):
        print(f"{k} --> {v}")

    # Iterate through each file and replace it
    for config_file in find_configuration_files():
        print(f"Updating dependencies for: {config_file}")

        new_data = ''
        with open(config_file, 'r') as f:
            # Perform each replacement
            new_data = f.read()
            for (k, v) in iter(replacements.items()):
                new_data = re.sub(k, v, new_data)

        # Write the file
        with open(config_file, 'w') as f:
            f.write(new_data)