Skip to content

Commit

Permalink
Upgrade mx configuration and environments.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Sep 20, 2023
1 parent ed7f8b4 commit 49739af
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 44 deletions.
70 changes: 41 additions & 29 deletions mx.trufflesqueak/mx_trufflesqueak.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,33 +180,45 @@ def patched_init(self, *args, **kw_args):
def _copy_macro_and_language_jars():
staged_dist = mx_sdk_vm_impl.get_stage1_graalvm_distribution()
staged_graalvm_home = os.path.join(staged_dist.output, staged_dist.jdk_base)
# Copy macro
macro_src_dir = os.path.join(staged_graalvm_home, 'lib', 'svm', 'macros', 'smalltalkvm-library')
macro_target_dir = os.path.join(extra_graalvm_home, 'lib', 'svm', 'macros', 'smalltalkvm-library')
if not os.path.exists(macro_src_dir):
mx.abort(f'Unable to locate macro at "{macro_src_dir}".')
if not os.path.exists(macro_target_dir):
shutil.copytree(macro_src_dir, macro_target_dir)
# Copy macros
for macro_dir_name in ['smalltalkvm-library', 'truffle']:
macro_src_dir = os.path.join(staged_graalvm_home, 'lib', 'svm', 'macros', macro_dir_name)
macro_target_dir = os.path.join(extra_graalvm_home, 'lib', 'svm', 'macros', macro_dir_name)
if not os.path.exists(macro_src_dir):
mx.abort(f'Unable to locate macro at "{macro_src_dir}".')
if not os.path.exists(macro_target_dir):
shutil.copytree(macro_src_dir, macro_target_dir)
else:
mx.warn(f'Macros already copied to "{macro_target_dir}".')
# Copy language directories
for language_dir_name in ['smalltalk', 'nfi']:
language_src_dir = os.path.join(staged_graalvm_home, 'languages', language_dir_name)
language_target_dir = os.path.join(extra_graalvm_home, 'languages', language_dir_name)
if not os.path.exists(language_src_dir):
mx.abort(f'Unable to locate language JARs at "{language_src_dir}".')
if not os.path.exists(language_target_dir):
shutil.copytree(language_src_dir, language_target_dir)
else:
mx.warn(f'Language JARs already copied to "{language_target_dir}".')
# Copy Truffle JARs
truffle_src_dir = os.path.join(staged_graalvm_home, 'lib', 'truffle')
truffle_target_dir = os.path.join(extra_graalvm_home, 'lib', 'truffle')
if not os.path.exists(truffle_src_dir):
mx.abort(f'Unable to locate Truffle JARs at "{truffle_src_dir}".')
if not os.path.exists(truffle_target_dir):
shutil.copytree(truffle_src_dir, truffle_target_dir)
else:
mx.warn(f'Macros already copied to "{macro_target_dir}".')
# Copy language JARs
language_src_dir = os.path.join(staged_graalvm_home, 'languages', 'smalltalk')
language_target_dir = os.path.join(extra_graalvm_home, 'languages', 'smalltalk')
if not os.path.exists(language_src_dir):
mx.abort(f'Unable to locate language JARs at "{language_src_dir}".')
if not os.path.exists(language_target_dir):
shutil.copytree(language_src_dir, language_target_dir)
else:
mx.warn(f'Language JARs already copied to "{language_target_dir}".')
# Copy launcher JAR
launcher_src_dir = os.path.join(staged_graalvm_home, 'lib', 'graalvm', 'trufflesqueak-launcher.jar')
launcher_target_dir = os.path.join(extra_graalvm_home, 'lib', 'graalvm', 'trufflesqueak-launcher.jar')
if not os.path.exists(launcher_src_dir):
mx.abort(f'Unable to locate launcher JAR at "{launcher_src_dir}".')
if not os.path.exists(launcher_target_dir):
shutil.copyfile(launcher_src_dir, launcher_target_dir)
else:
mx.warn(f'Launcher JAR already copied to "{launcher_target_dir}".')
mx.warn(f'Truffle JARs already copied to "{language_target_dir}".')
# Copy additional JARs
for jar_name in ['trufflesqueak-launcher.jar', 'launcher-common.jar', 'jline3.jar']:
launcher_src_dir = os.path.join(staged_graalvm_home, 'lib', 'graalvm', jar_name)
launcher_target_dir = os.path.join(extra_graalvm_home, 'lib', 'graalvm', jar_name)
if not os.path.exists(launcher_src_dir):
mx.abort(f'Unable to locate JAR at "{launcher_src_dir}".')
if not os.path.exists(launcher_target_dir):
shutil.copyfile(launcher_src_dir, launcher_target_dir)
else:
mx.warn(f'JAR already copied to "{launcher_target_dir}".')


def _use_different_graalvm_home_for_native_image(extra_graalvm_home):
Expand All @@ -233,9 +245,9 @@ def patched_native_image(self, build_args, output_file, allow_server=False, nonZ
_use_different_graalvm_home_for_native_image(extra_graalvm_home)


mx_sdk_vm.register_vm_config('trufflesqueak-jar', ['sdk', 'st', 'tfl'],
mx_sdk_vm.register_vm_config('trufflesqueak-jar', ['cov', 'dap', 'ins', 'insight', 'insightheap', 'lsp', 'nfi', 'nfi-libffi', 'pro', 'sdk', 'sdkc', 'sdkni', 'sdkl', 'st', 'tfl', 'tfla', 'tflc', 'truffle-json'],
_SUITE, env_file='trufflesqueak-jar')
mx_sdk_vm.register_vm_config('trufflesqueak-standalone', ['cmp', 'nfi', 'nfi-libffi', 'sdk', 'st', 'tfl'],
mx_sdk_vm.register_vm_config('trufflesqueak-standalone', ['cmp', 'cov', 'dap', 'ins', 'insight', 'insightheap', 'lsp', 'nfi', 'nfi-libffi', 'pro', 'sdk', 'sdkc', 'sdkl', 'sdkni', 'st', 'svm', 'svmsl', 'svmt', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'],
_SUITE, env_file='trufflesqueak-standalone')


Expand All @@ -261,7 +273,7 @@ def patched_native_image(self, build_args, output_file, allow_server=False, nonZ
standalone_dir_name='trufflesqueak-<version>-<graalvm_os>-<arch>',
license_files=[], # already included in `TRUFFLESQUEAK_HOME`.
third_party_license_files=[],
dependencies=['Truffle'],
dependencies=['Truffle', 'Truffle NFI', 'Truffle NFI LIBFFI'],
standalone_dependencies={},
truffle_jars=[
'trufflesqueak:TRUFFLESQUEAK',
Expand Down
39 changes: 31 additions & 8 deletions mx.trufflesqueak/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,21 +214,21 @@
# ==========================================================================
"distributions": {
"TRUFFLESQUEAK": {
"description": "TruffleSqueak engine",
"description": "TruffleSqueak virtual machine",
"maven": {
"artifactId": "smalltalk-language",
"groupId": "de.hpi.swa.trufflesqueak",
"tag": ["default", "public"],
},
"noMavenJavadoc": True,
"moduleInfo": {
"name": "de.hpi.swa.trufflesqueak",
"exports": [
"de.hpi.swa.trufflesqueak to org.graalvm.truffle",
],
"requires": [
"jdk.unsupported" # sun.misc.Unsafe
"jdk.unsupported", # sun.misc.Unsafe
],
"requiresConcealed": {
"org.graalvm.truffle": [
"com.oracle.truffle.api",
"com.oracle.truffle.api.instrumentation",
],
},
},
"dependencies": [
"de.hpi.swa.trufflesqueak",
Expand All @@ -237,6 +237,7 @@
"TRUFFLESQUEAK_SHARED",
"truffle:TRUFFLE_API",
"truffle:TRUFFLE_NFI",
"truffle:TRUFFLE_NFI_LIBFFI",
],
"exclude": [
"BOUNCYCASTLE-PROVIDER",
Expand All @@ -246,6 +247,7 @@
"javaProperties": {
"org.graalvm.language.smalltalk.home": "<path:TRUFFLESQUEAK_HOME>",
},
"useModulePath": True,
},

"TRUFFLESQUEAK_HOME": {
Expand All @@ -263,9 +265,18 @@

"TRUFFLESQUEAK_LAUNCHER": {
"description": "TruffleSqueak launcher",
"maven": {
"groupId": "de.hpi.swa.trufflesqueak",
"artifactId": "smalltalk-launcher",
"tag": ["default", "public"],
},
"moduleInfo": {
"name": "de.hpi.swa.trufflesqueak.launcher",
"exports": [
"de.hpi.swa.trufflesqueak.launcher to org.graalvm.launcher",
],
},
"useModulePath": True,
"dependencies": [
"de.hpi.swa.trufflesqueak.launcher",
],
Expand All @@ -289,6 +300,9 @@
"description": "TruffleSqueak shared distribution",
"moduleInfo": {
"name": "de.hpi.swa.trufflesqueak.shared",
"exports": [
"de.hpi.swa.trufflesqueak.shared",
],
},
"dependencies": [
"de.hpi.swa.trufflesqueak.shared",
Expand Down Expand Up @@ -317,13 +331,22 @@

"TRUFFLESQUEAK_TEST": {
"description": "TruffleSqueak JUnit and SUnit tests",
"moduleInfo": {
"name": "de.hpi.swa.trufflesqueak.test",
"exports": [
# Export everything to junit and dependent test distributions.
"de.hpi.swa.trufflesqueak.test*",
],
},
"javaCompliance": "17+",
"dependencies": [
"de.hpi.swa.trufflesqueak.test",
],
"exclude": ["mx:JUNIT", "mx:HAMCREST"],
"distDependencies": ["TRUFFLESQUEAK"],
"testDistribution": True,
"maven" : False,
"useModulePath": False,
},
},
}
8 changes: 5 additions & 3 deletions mx.trufflesqueak/trufflesqueak-jar
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
COMPONENTS=TruffleSqueak
DEFAULT_DYNAMIC_IMPORTS=/trufflesqueak,/vm
DISABLE_INSTALLABLES=false
COMPONENTS=TruffleSqueak,suite:tools
DEFAULT_DYNAMIC_IMPORTS=/tools,/vm
INSTALLABLES=TruffleSqueak
BUILD_TARGETS=GRAALVM
GRAALVM_SKIP_ARCHIVE=true
11 changes: 7 additions & 4 deletions mx.trufflesqueak/trufflesqueak-standalone
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
COMPONENTS=TruffleSqueak,GraalVM compiler,Truffle NFI LIBFFI
DISABLE_INSTALLABLES=false
DYNAMIC_IMPORTS=/compiler,/substratevm,/vm
NATIVE_IMAGES=lib:smalltalkvm,trufflesqueak
COMPONENTS=TruffleSqueak,suite:tools,GraalVM compiler,SubstrateVM,Truffle Macro
INSTALLABLES=TruffleSqueak
DYNAMIC_IMPORTS=/compiler,/substratevm,/tools
NATIVE_IMAGES=lib:smalltalkvm
GENERATE_DEBUGINFO=false
BUILD_TARGETS=GRAALVM,GRAALVM_STANDALONES
GRAALVM_SKIP_ARCHIVE=true

0 comments on commit 49739af

Please sign in to comment.