Skip to content

Commit f0b26ef

Browse files
committed
use is_monorepo var, constant for google-coud-java
1 parent 73dc71f commit f0b26ef

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

library_generation/generate_composed_library.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from model.Library import Library
2424

2525
script_dir = os.path.dirname(os.path.realpath(__file__))
26+
MONOREPO_NAME = 'google-cloud-java'
2627

2728
"""
2829
Main function in charge of generating libraries composed of more than one
@@ -64,23 +65,24 @@ def generate_composed_library(
6465
print('downloading googleapis')
6566
util.sh_util(f'download_googleapis_files_and_folders "{output_folder}" "{googleapis_commitish}"')
6667

68+
is_monorepo = config.destination_path == MONOREPO_NAME
6769

6870
base_arguments = []
6971
base_arguments += util.create_argument('gapic_generator_version', config)
7072
base_arguments += util.create_argument('grpc_version', config)
7173
base_arguments += util.create_argument('protobuf_version', config)
7274

7375
destination_path = f'java-{library.api_shortname}'
74-
if config.destination_path == 'google-cloud-java':
76+
if is_monorepo:
7577
destination_path = config.destination_path + '/' + destination_path
7678

7779
versions_file = ''
78-
if 'google-cloud-java' in destination_path:
80+
if is_monorepo:
7981
print('this is a monorepo library')
8082
library_folder = destination_path.split('/')[-1]
8183
if repository_path is None:
82-
repository_path = f'{output_folder}/google-cloud-java'
83-
clone_out = util.sh_util(f'sparse_clone "https://github.com/googleapis/google-cloud-java.git" "{library_folder} google-cloud-pom-parent google-cloud-jar-parent versions.txt .github"', cwd=output_folder)
84+
repository_path = f'{output_folder}/{MONOREPO_NAME}'
85+
clone_out = util.sh_util(f'sparse_clone "https://github.com/googleapis/{MONOREPO_NAME}.git" "{library_folder} google-cloud-pom-parent google-cloud-jar-parent versions.txt .github"', cwd=output_folder)
8486
print(clone_out)
8587
versions_file = f'{repository_path}/versions.txt'
8688
else:

0 commit comments

Comments
 (0)