From 8b01fd623414356c46ef96561732cf19138c8ced Mon Sep 17 00:00:00 2001 From: Hugo GUERRIER Date: Fri, 14 Apr 2023 17:34:01 +0200 Subject: [PATCH] Install the Java bindings sources unconditionally --- langkit/emitter.py | 4 +--- langkit/libmanage.py | 23 +++++++++-------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/langkit/emitter.py b/langkit/emitter.py index 6d76efcc6..9d67d979a 100644 --- a/langkit/emitter.py +++ b/langkit/emitter.py @@ -190,7 +190,6 @@ def __init__(self, self.lib_name_low ) self.java_jni = path.join(self.java_dir, "jni") - self.java_native_config = path.join(self.java_dir, "native_image") self.lib_project = path.join(self.lib_root, f"{self.lib_name_low}.gpr") self.mains_project = path.join(self.lib_root, "mains.gpr") @@ -322,7 +321,6 @@ def setup_directories(self, ctx: CompileCtx) -> None: self.java_dir, self.java_package, self.java_jni, - self.java_native_config, ]: if not path.exists(d): os.makedirs(d) @@ -750,7 +748,7 @@ def emit_java_api(self, ctx: CompileCtx) -> None: ( "java_api/reflect_json", "reflect_config.json", - self.java_native_config, + self.java_dir, None ), ( diff --git a/langkit/libmanage.py b/langkit/libmanage.py index 1d53b795a..92c11f290 100644 --- a/langkit/libmanage.py +++ b/langkit/libmanage.py @@ -1195,6 +1195,7 @@ def do_install(self, args: argparse.Namespace) -> None: build_mode = self.build_modes[0].value lib_name = self.lib_name.lower() + lib_name_camel = lib_name.capitalize() self.gprinstall( args, @@ -1244,6 +1245,14 @@ def do_install(self, args: argparse.Namespace) -> None: os.path.join('ocaml', 'dune'), os.path.join('ocaml', 'dune-project'), os.path.join('ocaml', lib_name + '.opam'), + os.path.join('java', 'Makefile'), + os.path.join('java', 'pom.xml'), + os.path.join('java', 'reflect_config.json'), + os.path.join('java', 'jni', + f'com_adacore_{lib_name}_{lib_name_camel}_NI_LIB.h'), + os.path.join('java', 'jni', 'jni_impl.c'), + os.path.join('java', 'src', 'main', 'java', 'com', 'adacore', + lib_name, f'{lib_name_camel}.java'), ]: install_path = os.path.dirname(self.dirs.install_dir(fpath)) if not path.isdir(install_path): @@ -1254,20 +1263,6 @@ def do_install(self, args: argparse.Namespace) -> None: f, os.path.join(install_path, os.path.basename(f)) ) - # If Java is enabled, install using Maven - if args.enable_java: - # Install the Java bindings in the Maven repository - self.maven_command(['install'], args) - - # Put the bindings JAR in the installation folder - jar_name = f'{lib_name}.jar' - jar_file = self.dirs.build_dir('java', 'target', jar_name) - install_file = self.dirs.install_dir('java', jar_name) - install_path = os.path.dirname(install_file) - if not path.isdir(install_path): - os.makedirs(install_path) - shutil.copyfile(jar_file, install_file) - def do_setenv(self, args: argparse.Namespace) -> None: """ Unless --json is passed, display Bourne shell commands that setup