Skip to content

Commit

Permalink
Register the Installer as a component.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdedic authored and gilles-duboscq committed Apr 16, 2018
1 parent 7146768 commit 8f88ab0
Show file tree
Hide file tree
Showing 97 changed files with 11,864 additions and 4 deletions.
14 changes: 13 additions & 1 deletion vm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ Graal VM is an ecosystem for compiling and running applications written in most
* **Native**: Ahead-of-time (AOT) compiled native images improve application start-up time and reduce memory footprint.
* **Tooling**: Graal VM takes advantage of JVM-based tooling and provides a common set of tools, such as debugging and profiling, that you can use for all your code.

## Using Graal VM Components
Some components (languages) of Graal VM are distributed separately: R and Ruby. If you need these languages, you have to download their distribution packages from
> **TBD**
and install them yourself. Installable component packages are provided separately for individual OS and architectures.

Graal VM provides a simple installation utility, `bin/installer`, which allows to **install** package files to their appropriate locations and
can **uninstall** them.
Use
>`bin/installer --help`
for brief help.

## Using Graal VM
You can use Graal VM like a Java Development Kit (JDK) in your IDE.

32 changes: 32 additions & 0 deletions vm/mx.vm/gu
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

source="${BASH_SOURCE[0]}"
while [ -h "$source" ] ; do
prev_source="$source"
source="$(readlink "$source")";
if [[ "$source" != /* ]]; then
# if the link was relative, it was relative to where it came from
dir="$( cd -P "$( dirname "$prev_source" )" && pwd )"
source="$dir/$source"
fi
done
bin_dir="$( cd -P "$( dirname "$source" )" && pwd )"
installer_jar="${bin_dir}/../installer.jar"
root_dir="${bin_dir}/../../../.."
java_exe=${root_dir}/bin/java

JAVA_ARGS=()
PROGRAM_ARGS=()
for opt in "${@:1}"
do
case $opt in
-J:*|--jvm*)
opt=${opt:3}
JAVA_ARGS+=("$opt") ;;
*)
PROGRAM_ARGS+=("$opt") ;;
esac
done


exec ${java_exe} "${JAVA_ARGS[@]}" -DGRAAL_HOME="${root_dir}" -jar "${installer_jar}" "${PROGRAM_ARGS[@]}"
21 changes: 19 additions & 2 deletions vm/mx.vm/mx_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
_suite = mx.suite('vm')
""":type: mx.SourceSuite | mx.Suite"""

mx_sdk.register_component(mx_sdk.GraalVmJreComponent(
name='Component installer',
id='installer',
documentation_files=[],
license_files=[],
third_party_license_files=[],
jre_lib_files=['extracted-dependency:vm:INSTALLER_GRAALVM_SUPPORT'],
provided_executables=['link:<support>/bin/gu'],
))


class BaseGraalVmLayoutDistribution(mx.LayoutTARDistribution):
def __init__(self, suite, name, deps, components, include_jdk, exclLibs, platformDependent, theLicense,
Expand All @@ -60,8 +70,15 @@ def _get_jdk_base():
return _jdk_base

def _get_support(comp=None, start=None, **kwargs):
# this only
return relpath(join('jre', _get_languages_or_tool(comp=comp), _get_component_id(comp=comp)), start=start)
if isinstance(comp, mx_sdk.GraalVmTruffleComponent):
_base_location = join('jre', _get_languages_or_tool(comp=comp))
elif isinstance(comp, mx_sdk.GraalVmJdkComponent):
_base_location = join('lib')
elif isinstance(comp, mx_sdk.GraalVmJreComponent):
_base_location = join('jre', 'lib')
else:
mx.abort('The \'<support>\' substitution is not available for component \'{}\' of type \'{}\''.format(_component.name), type(_component))
return relpath(join(_base_location, _get_component_id(comp=comp)), start=start)

path_substitutions = mx_subst.SubstitutionEngine(mx_subst.path_substitutions)
path_substitutions.register_no_arg('jdk_base', _get_jdk_base)
Expand Down
43 changes: 42 additions & 1 deletion vm/mx.vm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@
"checkstyle": "org.graalvm.word",
"license": "GPLv2-CPE",
},
"org.graalvm.component.installer" : {
"subDir" : "src",
"sourceDirs" : ["src"],
"javaCompliance" : "1.8",
"license" : "GPLv2-CPE",
},
"org.graalvm.component.installer.test" : {
"subDir" : "src",
"sourceDirs" : ["src"],
"dependencies": [
"mx:JUNIT",
"org.graalvm.component.installer"
],
"javaCompliance" : "1.8",
"license" : "GPLv2-CPE",
"workingSets" : "Tools",
},
"polyglot.launcher": {
"class": "GraalVmPolyglotLauncher",
"launcherConfig": {
Expand Down Expand Up @@ -93,13 +110,37 @@
},
},
},

},
"LOCATOR": {
"dependencies": ["com.oracle.graalvm.locator"],
"distDependencies": [
"truffle:TRUFFLE_API",
],
},
"INSTALLER": {
"subDir" : "src",
"mainClass" : "org.graalvm.component.installer.ComponentInstaller",
"dependencies": ["org.graalvm.component.installer"],
},
"INSTALLER_TESTS": {
"subDir" : "src",
"dependencies": ["org.graalvm.component.installer.test"],
"exclude": [
"mx:HAMCREST",
"mx:JUNIT",
],
"distDependencies": [
"INSTALLER",
],
},
"INSTALLER_GRAALVM_SUPPORT" : {
"native" : True,
"platformDependent" : True,
"description" : "GraalVM Installer support distribution for the GraalVM",
"layout" : {
"./" : "dependency:vm:INSTALLER",
"bin/" : "file:mx.vm/gu",
},
},
},
}
Loading

0 comments on commit 8f88ab0

Please sign in to comment.