Skip to content

Commit

Permalink
Set dock:name on macOS
Browse files Browse the repository at this point in the history
and refactor mx_trufflesqueak.py
  • Loading branch information
fniephaus committed Apr 21, 2021
1 parent 2cd105e commit e0cee52
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions mx.trufflesqueak/mx_trufflesqueak.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@
import mx_truffle
import mx_unittest

_SUITE = mx.suite('trufflesqueak')

LANGUAGE_ID = 'smalltalk'
PACKAGE_NAME = 'de.hpi.swa.trufflesqueak'
BASE_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
BASE_VM_ARGS = [
# Tweak Runtime
'-Xss64M', # Increase stack size (`-XX:ThreadStackSize=64M` not working)

# Tweak GraalVM Engine
'-Dpolyglot.engine.Mode=latency',
]

if mx.is_darwin():
BASE_VM_ARGS.append('-Xdock:name=TruffleSqueak %s' % _SUITE.release_version())

BASE_VM_ARGS_TESTING = BASE_VM_ARGS[:]
BASE_VM_ARGS_TESTING.extend([
# Tweak GC for GitHub Actions
Expand All @@ -53,13 +55,15 @@
BASE_VM_ARGS.append('-XX:NewSize=1G') # Initial new generation size
BASE_VM_ARGS.append('-XX:MetaspaceSize=32M') # Initial size of Metaspaces

_suite = mx.suite('trufflesqueak')
_compiler = mx.suite('compiler', fatalIfMissing=False)
_svm = mx.suite('substratevm', fatalIfMissing=False)
_COMPILER = mx.suite('compiler', fatalIfMissing=False)
_SVM = mx.suite('substratevm', fatalIfMissing=False)

if _compiler:
BASE_VM_ARGS_TESTING.append('-Dpolyglot.engine.CompilationFailureAction=Diagnose')
if _COMPILER:
# Tweak GraalVM Engine
BASE_VM_ARGS.append('-Dpolyglot.engine.Mode=latency')
BASE_VM_ARGS_TESTING.append('-Dpolyglot.engine.Mode=latency')

BASE_VM_ARGS_TESTING.append('-Dpolyglot.engine.CompilationFailureAction=Diagnose')

def _graal_vm_args(args):
graal_args = ['-Dpolyglot.engine.AllowExperimentalOptions=true']
Expand Down Expand Up @@ -297,7 +301,7 @@ def _squeak(args, extra_vm_args=None, env=None, jdk=None, **kwargs):

vm_args = BASE_VM_ARGS + _get_runtime_jvm_args(jdk)

if _compiler:
if _COMPILER:
vm_args += _graal_vm_args(parsed_args)

# default: assertion checking is enabled
Expand Down Expand Up @@ -370,7 +374,7 @@ def _squeak(args, extra_vm_args=None, env=None, jdk=None, **kwargs):
squeak_arguments.extend(parsed_args.image_arguments)

if not jdk:
jdk = mx.get_jdk(tag='jvmci' if _compiler else None)
jdk = mx.get_jdk(tag='jvmci' if _COMPILER else None)

return mx.run_java(vm_args + squeak_arguments, jdk=jdk, **kwargs)

Expand Down Expand Up @@ -546,7 +550,7 @@ def patched_init(self, *args, **kw_args):


mx_sdk.register_graalvm_component(mx_sdk.GraalVmLanguage(
suite=_suite,
suite=_SUITE,
name='TruffleSqueak',
short_name='st',
dir_name=LANGUAGE_ID,
Expand All @@ -573,7 +577,7 @@ def patched_init(self, *args, **kw_args):
],
)
],
post_install_msg=(None if not _svm else "\nNOTES:\n---------------\n" +
post_install_msg=(None if not _SVM else "\nNOTES:\n---------------\n" +
"TruffleSqueak (SVM) requires SDL2 to be installed on your system:\n" +
"- On Debian/Ubuntu, you can install SDL2 via `sudo apt-get install libsdl2-2.0`.\n" +
"- On macOS, you can install SDL2 with Homebrew: `brew install sdl2`.\n\n" +
Expand All @@ -582,12 +586,12 @@ def patched_init(self, *args, **kw_args):
))


mx.update_commands(_suite, {
mx.update_commands(_SUITE, {
'squeak': [_squeak, '[options]'],
'squeak-gvm': [_squeak_graalvm_launcher, '[options]'],
})

mx_gate.add_gate_runner(_suite, _trufflesqueak_gate_runner)
mx_gate.add_gate_runner(_SUITE, _trufflesqueak_gate_runner)

if mx.is_windows():
# This patch works around "SSL: CERTIFICATE_VERIFY_FAILED" errors (See
Expand Down

0 comments on commit e0cee52

Please sign in to comment.