summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnermolaev <[email protected]>2025-07-16 06:51:24 +0300
committersnermolaev <[email protected]>2025-07-16 07:07:11 +0300
commit8592a01d07e6070ee00afdf6f09d59ee35145afb (patch)
tree0c57fe8a94ae2594768746feedfd4b37b2def456
parent532483114946405240dc983cc9ec6fd3bd55bd1d (diff)
temporarily switch pom and ssqls parsers to ones implemented in ymake module
commit_hash:9328f3b8d6388246a45c3e6bca329ddda71839d6
-rw-r--r--build/plugins/java.py33
1 files changed, 21 insertions, 12 deletions
diff --git a/build/plugins/java.py b/build/plugins/java.py
index a15aaafeb52..baf48cadb44 100644
--- a/build/plugins/java.py
+++ b/build/plugins/java.py
@@ -325,19 +325,28 @@ def _maven_coords_for_project(unit, project_dir):
pom_path = unit.resolve(os.path.join('$S', project_dir, 'pom.xml'))
if os.path.exists(pom_path):
- import xml.etree.ElementTree as et
-
try:
- with open(pom_path, 'rb') as f:
- root = et.fromstring(f.read())
- for xpath in ('./{http://maven.apache.org/POM/4.0.0}artifactId', './artifactId'):
- artifact = root.find(xpath)
- if artifact is not None:
- artifact = artifact.text
- if a != artifact and a.startswith(artifact):
- c = a[len(artifact) :].lstrip('-_')
- a = artifact
- break
+ # TODO(YMAKE-1694): xml is not currenly ready for Python subinterpreters, so we temporarily switch to parser implemented in ymake module
+ if hasattr(ymake, 'ymake.get_artifact_id_from_pom_xml'):
+ with open(pom_path, 'rb') as f:
+ artifact = ymake.get_artifact_id_from_pom_xml(f.read())
+ if artifact is not None:
+ if a != artifact and a.startswith(artifact):
+ c = a[len(artifact) :].lstrip('-_')
+ a = artifact
+ else:
+ import xml.etree.ElementTree as et
+
+ with open(pom_path, 'rb') as f:
+ root = et.fromstring(f.read())
+ for xpath in ('./{http://maven.apache.org/POM/4.0.0}artifactId', './artifactId'):
+ artifact = root.find(xpath)
+ if artifact is not None:
+ artifact = artifact.text
+ if a != artifact and a.startswith(artifact):
+ c = a[len(artifact) :].lstrip('-_')
+ a = artifact
+ break
except Exception as e:
raise Exception(f"Can't parse {pom_path}: {str(e)}") from None