Skip to content

Commit

Permalink
script: include groupId in module overview
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
mtf90 committed Nov 15, 2023
1 parent d2ebfbe commit ec6b57c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build-tools/generate-module-overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import xml.etree.ElementTree as ET

XPATH_ARTIFACT_ID = "./mvn:artifactId"
XPATH_GROUP_ID = "./mvn:groupId"
XPATH_PARENT_GROUP_ID = "./mvn:parent/mvn:groupId"
XPATH_DESCRIPTION = "./mvn:description"
XPATH_SUBMODULES = "./mvn:modules/mvn:module"
MAVEN_NAMESPACE = {'mvn': 'http://maven.apache.org/POM/4.0.0'}
Expand Down Expand Up @@ -40,9 +42,14 @@ def generate_entry(indent, project_folder):
padding = ('{:' + str(indent * 2) + '}').format(' ')

artifact = pom.find(XPATH_ARTIFACT_ID, namespaces=MAVEN_NAMESPACE)
group = pom.find(XPATH_GROUP_ID, namespaces=MAVEN_NAMESPACE)
parentGroup = pom.find(XPATH_PARENT_GROUP_ID, namespaces=MAVEN_NAMESPACE)
description = pom.find(XPATH_DESCRIPTION, namespaces=MAVEN_NAMESPACE)

print('{}* **{}**: {}'.format(padding, artifact.text, description.text))
if group is not None:
print('{}* **{}**:**{}**: {}'.format(padding, group.text, artifact.text, description.text))
else:
print('{}* **{}**:**{}**: {}'.format(padding, parentGroup.text, artifact.text, description.text))

for module in pom.findall(XPATH_SUBMODULES, namespaces=MAVEN_NAMESPACE):
generate_entry(indent + 1, os.path.join(project_folder, module.text))
Expand Down

0 comments on commit ec6b57c

Please sign in to comment.