Skip to content

Commit

Permalink
Add google repo as a first preference in iceberg build
Browse files Browse the repository at this point in the history
  • Loading branch information
vkorukanti committed Jan 22, 2025
1 parent e0614cb commit 190f587
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions icebergShaded/generate_iceberg_jars.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import argparse
import os
import glob
import re
import subprocess
import shlex
import shutil
Expand Down Expand Up @@ -65,6 +66,28 @@ def iceberg_jars_exists():
return True


def add_google_maven_repo_to_gradle_config():
with WorkingDirectory(iceberg_src_dir):
file_path = 'build.gradle'

with open(file_path, 'r') as file:
content = file.read()

# Define the old and new configurations
old_config = r'repositories {\n mavenCentral\(\)'

new_config = 'repositories {\n maven {\n ' + \
'url "https://maven-central.storage-download.googleapis.com/maven2"\n }\n ' + \
'mavenCentral()'

# Replace the old configuration with the new one
updated_content = re.sub(old_config, new_config, content, flags=re.DOTALL)

# Write the updated content back to the file
with open(file_path, 'w') as file:
file.write(updated_content)


def prepare_iceberg_source():
with WorkingDirectory(iceberg_root_dir):
print(">>> Cloning Iceberg repo")
Expand Down Expand Up @@ -92,6 +115,8 @@ def prepare_iceberg_source():
run_cmd("git add .")
run_cmd("git commit -a -m 'applied %s'" % path.basename(patch_file))

add_google_maven_repo_to_gradle_config()


def generate_iceberg_jars():
print(">>> Compiling JARs")
Expand Down

0 comments on commit 190f587

Please sign in to comment.