diff --git a/modules/java-non-isolated/Makefile b/modules/java-non-isolated/Makefile new file mode 100644 index 0000000000..d5d916eb27 --- /dev/null +++ b/modules/java-non-isolated/Makefile @@ -0,0 +1,10 @@ +# TODO: need to move compilation of $(java-targets) from the main makefile +# to here. Unfortunately, compiling with OSv header files is a big mess, +# and much easier to do it in the main OSv makefile :-( +SRC = $(shell readlink -f ../..) +module: + cd $(SRC)/java && mvn package -DskipTests=true + +clean: + cd $(SRC)/java && mvn clean + -rm -f dependency-reduced-pom.xml diff --git a/modules/java-non-isolated/module.py b/modules/java-non-isolated/module.py new file mode 100644 index 0000000000..1f5b4018d7 --- /dev/null +++ b/modules/java-non-isolated/module.py @@ -0,0 +1,28 @@ +from osv.modules.filemap import FileMap +from osv.modules import api +import os, os.path + +usr_files = FileMap() + +provides = ['java'] + +non_isolated_jvm = True + +api.require('fonts') +api.require('ca-certificates') +api.require('libz') +api.require('josvsym') +api.require('httpserver-jolokia-plugin') +api.require('httpserver-jvm-plugin') + +jdkdir = os.path.basename(os.path.expandvars('${jdkbase}')) + +usr_files.add('${jdkbase}').to('/usr/lib/jvm/java') \ + .include('lib/**') \ + .include('jre/**') \ + .exclude('jre/lib/security/cacerts') \ + .exclude('jre/lib/audio/**') + +usr_files.link('/usr/lib/jvm/' + jdkdir).to('java') +usr_files.link('/usr/lib/jvm/jre').to('java/jre') +usr_files.link('/usr/lib/jvm/java/jre/lib/security/cacerts').to('/etc/pki/java/cacerts') diff --git a/modules/java-non-isolated/usr.manifest b/modules/java-non-isolated/usr.manifest new file mode 100644 index 0000000000..63b11bc40c --- /dev/null +++ b/modules/java-non-isolated/usr.manifest @@ -0,0 +1,21 @@ +# +# Copyright (C) 2013-2014 Cloudius Systems, Ltd. +# +# This work is open source software, licensed under the terms of the +# BSD license as described in the LICENSE file in the top-level directory. +# + +[manifest] +/usr/lib/&/libexpat.so.1: %(miscbase)s/usr/lib64/& +/usr/lib/&/libjpeg.so.62: %(miscbase)s/usr/lib64/& +/usr/lib/jni/balloon.so: java/jni/balloon.so +/usr/lib/jni/monitor.so: java/jni/monitor.so +/usr/lib/&/jni/elf-loader.so: java/& +/usr/lib/&/jni/networking.so: java/& +/usr/lib/&/jni/stty.so: java/& +/usr/lib/&/jni/tracepoint.so: java/& +/usr/lib/&/jni/power.so: java/& +/java.so: java/jvm/java_non_isolated.so +/usr/lib/libosv.so: libosv.so +/usr/lib/jvm/java/jre/lib/ext/runjava.jar: ${OSV_BASE}/java/runjava/target/runjava.jar +/java/cloudius.jar: ${OSV_BASE}/java/cloudius/target/cloudius.jar diff --git a/scripts/module.py b/scripts/module.py index aede2cfb1c..19c39b5c17 100755 --- a/scripts/module.py +++ b/scripts/module.py @@ -8,7 +8,7 @@ from functools import reduce from osv.modules import api, resolve, filemap -class jvm(api.basic_app): +class isolated_jvm(api.basic_app): multimain_manifest = '/etc/javamains' apps = [] @@ -33,6 +33,21 @@ def get_launcher_args(self): def add(self, app): self.apps.append(app) + def has_any_app(self): + return self.apps + +class non_isolated_jvm(api.basic_app): + app = None + + def get_launcher_args(self): + return ['java.so'] + self.app.get_jvm_args() + self.app.get_multimain_lines() + + def add(self, app): + self.app = app + + def has_any_app(self): + return self.app + def expand(text, variables): def resolve(m): name = m.group('name') @@ -117,7 +132,11 @@ def flatten_list(elememnts): def get_basic_apps(apps): basic_apps = [] - _jvm = jvm() + java = resolve.require('java') + if hasattr(java,'non_isolated_jvm') and java.non_isolated_jvm: + _jvm = non_isolated_jvm() + else: + _jvm = isolated_jvm() for app in flatten_list(apps): if isinstance(app, api.basic_app): @@ -127,7 +146,7 @@ def get_basic_apps(apps): else: raise Exception("Unknown app type: " + str(app)) - if _jvm.apps: + if _jvm.has_any_app(): basic_apps.append(_jvm) return basic_apps