Przeglądaj źródła

Fix handling of BOMs

main
Sindre Stephansen 2 lat temu
rodzic
commit
9ec363949d
Podpisane przez: sindre <sindre@sindrestephansen.com> ID klucza GPG: B06FC67D17A46ADE
3 zmienionych plików z 12 dodań i 1 usunięć
  1. +2
    -0
      package-list.yaml
  2. +2
    -0
      sync/src/maven/packages.py
  3. +8
    -1
      sync/src/maven/pom.py

+ 2
- 0
package-list.yaml Wyświetl plik

@@ -35,3 +35,5 @@ configurations:
_default: ['3.3.0', '3.2.2']
koin-core: []
koin-ktor: ['default', '-3.3.0', '3.2.1']

io.ktor:ktor-bom: "latest"

+ 2
- 0
sync/src/maven/packages.py Wyświetl plik

@@ -42,9 +42,11 @@ async def get_dependencies(package: Package, mirrors: Iterable[str]) -> list[Pac

if pom := await fetch_pom(package, mirrors):
if pom.is_bom:
logger.debug(f'{package} is BOM')
try:
packages.extend(pom.dependency_management)
except PropertyMissing as e1:
logger.debug(f'{package}: Properties not found, checking parent')
parent_props = await get_parent_props(pom.parent, mirrors)
if parent_props:
pom.set_properties(parent_props)


+ 8
- 1
sync/src/maven/pom.py Wyświetl plik

@@ -44,18 +44,25 @@ class PackagePOM:

self.parent = None
if (parent_tag := self._raw_root.find('parent', ns)) is not None:
logger.debug(f'{self.name}: Found parent tag')
parent_group = pom_find_tag_text(parent_tag, 'groupId')
parent_artifact = pom_find_tag_text(parent_tag, 'artifactId')
parent_version = pom_find_tag_text(parent_tag, 'version')

if parent_group is None or parent_artifact is None or parent_version is None:
logger.warning(f'{self.name}: Could not resolve parent')
raise PackageError(f'Invalid parent {parent_group}:{parent_artifact}:{parent_version}')
else:
self.parent = Package(parent_group, parent_artifact, parent_version)
logger.debug(f'{self.name}: Parent is {self.parent}')
else:
logger.debug(f'{self.name}: No parent tag found')

if (packaging := self._raw_root.find('packaging', ns)) is not None:
if (packaging := pom_find_tag_text(self._raw_root, 'packaging')) is not None:
logger.debug(f'{self.name}: Packaging is {packaging}')
self.is_bom = packaging == 'pom'
else:
logger.debug(f'{self.name}: Could not find packaging in POM')
self.is_bom = False

self.set_properties({})


Ładowanie…
Anuluj
Zapisz