Skip to content

Commit 163979e

Browse files
authored
Sparse checkout service directories not individual library directories (Azure#29048)
* Sparse checkout service directories not individual library directories * output environment variable names so they're in the logs * couple of minor fixes for feedback
1 parent 2bff49b commit 163979e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

eng/scripts/generate_from_source_pom.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,18 @@ def create_from_source_pom(project_list: str, set_pipeline_variable: str, set_sk
130130
fromSourcePom.write(pom_file_end)
131131

132132
if set_pipeline_variable:
133-
checkout_paths = list(set(sorted([p.directory_path for p in source_projects])))
133+
# The directory_path is too granular. There are build rules for some libraries that
134+
# create empty sources/javadocs jars using the README.md. Not every library
135+
# has a README.md and, in these cases, it uses the README.md from the root service
136+
# directory. This will also trim the number of paths down considerably.
137+
service_directories: Set[str] = set()
138+
for p in source_projects:
139+
# get the service directory, which is one level up from the library's directory
140+
service_directory = '/'.join(p.directory_path.split('/')[0:-1])
141+
service_directories.add(service_directory)
142+
143+
checkout_paths = list(sorted(service_directories))
144+
print('setting env variable {} = {}'.format(set_pipeline_variable, checkout_paths))
134145
print('##vso[task.setvariable variable={};]{}'.format(set_pipeline_variable, json.dumps(checkout_paths)))
135146

136147
# Sets the DevOps variable that is used to skip certain projects during linting validation.
@@ -139,7 +150,7 @@ def create_from_source_pom(project_list: str, set_pipeline_variable: str, set_sk
139150
for maven_identifier in sorted([p.identifier for p in source_projects]):
140151
if not project_uses_client_parent(projects.get(maven_identifier), projects):
141152
skip_linting_projects.append('!' + maven_identifier)
142-
153+
print('setting env variable {} = {}'.format(set_skip_linting_projects, skip_linting_projects))
143154
print('##vso[task.setvariable variable={};]{}'.format(set_skip_linting_projects, ','.join(list(set(skip_linting_projects)))))
144155

145156

0 commit comments

Comments
 (0)