Skip to content

Commit

Permalink
Fix generation of stage1 macros for libpolyglot.
Browse files Browse the repository at this point in the history
  • Loading branch information
ansalond committed Mar 16, 2020
1 parent cc6b2d6 commit 6881239
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions sdk/mx.sdk/mx_sdk_vm_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,21 @@ def add_dependencies(dependencies, excludes=True):
if component not in components_to_build and not (excludes and is_excluded(component)):
components_to_build.append(component)
components.extend(component.direct_dependencies())
if not stage1:
libpoly_build_args.extend(component.polyglot_lib_build_args)
libpoly_jar_dependencies.extend(component.polyglot_lib_jar_dependencies)
libpoly_build_dependencies.extend(component.polyglot_lib_build_dependencies)
if component.has_polyglot_lib_entrypoints:
libpoly_has_entrypoints.append(component.name)
libpoly_build_args.extend(component.polyglot_lib_build_args)
libpoly_jar_dependencies.extend(component.polyglot_lib_jar_dependencies)
libpoly_build_dependencies.extend(component.polyglot_lib_build_dependencies)
if component.has_polyglot_lib_entrypoints:
libpoly_has_entrypoints.append(component.name)

# Expand dependencies
add_dependencies([mx_sdk.graalvm_component_by_name(name) for name in default_components], excludes=True)
add_dependencies(components_include_list, excludes=True)

if not stage1:
if _with_polyglot_launcher_project():
registered_components_short_names = [c.short_name for c in mx_sdk_vm.graalvm_components()]
if _with_polyglot_launcher_project():
if 'poly' in registered_components_short_names:
polyglot_component = mx_sdk_vm.graalvm_component_by_name('poly')
else:
polyglot_component = mx_sdk_vm.GraalVmJreComponent(
suite=_suite,
name='Polyglot Launcher',
Expand All @@ -220,9 +222,12 @@ def add_dependencies(dependencies, excludes=True):
)],
)
mx_sdk_vm.register_graalvm_component(polyglot_component)
add_dependencies([polyglot_component])
add_dependencies([polyglot_component])

if _with_polyglot_lib_project() and libpoly_has_entrypoints and _get_svm_support().is_supported():
if _with_polyglot_lib_project() and libpoly_has_entrypoints:
if 'libpoly' in registered_components_short_names:
libpolyglot_component = mx_sdk_vm.graalvm_component_by_name('libpoly')
else:
libpolyglot_component = mx_sdk_vm.GraalVmJreComponent(
suite=_suite,
name='Polyglot Library',
Expand All @@ -243,10 +248,10 @@ def add_dependencies(dependencies, excludes=True):
)],
)
mx_sdk_vm.register_graalvm_component(libpolyglot_component)
add_dependencies([libpolyglot_component])
add_dependencies([libpolyglot_component])

if libpoly_build_dependencies:
mx.warn("Ignoring build dependency '{}' of '{}'. It should be already part of stage 1.".format(libpoly_build_dependencies, libpolyglot_component.name))
if libpoly_build_dependencies:
mx.warn("Ignoring build dependency '{}' of '{}'. It should be already part of stage 1.".format(libpoly_build_dependencies, libpolyglot_component.name))

# If we are going to build native launchers or libraries, i.e., if SubstrateVM is included,
# we need native-image in stage1 to build them, even if the Native Image component is excluded.
Expand Down Expand Up @@ -2178,8 +2183,8 @@ def get_standalone_distribution(comp_dir_name):

def has_svm_polyglot_lib():
libraries = [p for p in _suite.projects if isinstance(p, GraalVmLibrary) and p.component.name == 'Polyglot Library']
assert not libraries or len(libraries) == 1
return libraries and not libraries[0].is_skipped()
assert len(libraries) <= 1
return len(libraries) == 1 and not libraries[0].is_skipped()


_native_image_configs = {}
Expand Down Expand Up @@ -2531,7 +2536,6 @@ def graalvm_show(args):
else:
print("No standalone")


def _get_dists(dist_class):
"""
:type dist_class: mx.Distribution
Expand Down

0 comments on commit 6881239

Please sign in to comment.