Skip to content

Commit

Permalink
Do not duplicate license files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ansalond committed May 22, 2024
1 parent 29ad308 commit e028ae7
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions sdk/mx.sdk/mx_sdk_vm_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def _add_link(_dest, _target, _component=None, _dest_base_name=None):
_jvm_library_dest = _component_jvmlib_base

if _component.dir_name:
_component_base = _component_type_base + _component.dir_name + '/'
_component_base = normpath(_component_type_base + _component.dir_name) + '/'
else:
_component_base = _component_type_base

Expand Down Expand Up @@ -623,27 +623,28 @@ def _add_link(_dest, _target, _component=None, _dest_base_name=None):
else:
_jdk_jre_bin = '<jre_base>/bin/'

_licenses = _component.third_party_license_files
if not _no_licenses():
_licenses = _licenses + _component.license_files
for _license in _licenses:
if mx.is_windows() or isinstance(self, mx.AbstractJARDistribution):
if _component_base == '<jdk_base>/':
pass # already in place from the support dist
elif len(_component.support_distributions) == 1:
_support = _component.support_distributions[0]
_add(layout, '<jdk_base>/', 'extracted-dependency:{}/{}'.format(_support, _license), _component)
elif any(_license.startswith(sd + '/') for sd in _component.support_distributions):
_add(layout, '<jdk_base>/', 'extracted-dependency:{}'.format(_license), _component)
else:
mx.warn("Can not add license: " + _license)
else:
for sd in _component.support_distributions:
if _license.startswith(sd + '/'):
_add_link('<jdk_base>/', _component_base + _license[len(sd) + 1:], _component)
break
if _component_base == '<jdk_base>/':
pass # already in place from the support dist
else:
_licenses = _component.third_party_license_files
if not _no_licenses():
_licenses = _licenses + _component.license_files
for _license in _licenses:
if mx.is_windows() or isinstance(self, mx.AbstractJARDistribution):
if len(_component.support_distributions) == 1:
_support = _component.support_distributions[0]
_add(layout, '<jdk_base>/', 'extracted-dependency:{}/{}'.format(_support, _license), _component)
elif any(_license.startswith(sd + '/') for sd in _component.support_distributions):
_add(layout, '<jdk_base>/', 'extracted-dependency:{}'.format(_license), _component)
else:
mx.warn("Can not add license: " + _license)
else:
_add_link('<jdk_base>/', _component_base + _license, _component)
for sd in _component.support_distributions:
if _license.startswith(sd + '/'):
_add_link('<jdk_base>/', _component_base + _license[len(sd) + 1:], _component)
break
else:
_add_link('<jdk_base>/', _component_base + _license, _component)

_jre_bin_names = []

Expand Down

0 comments on commit e028ae7

Please sign in to comment.