Skip to content

Commit ccf8711

Browse files
committed
Merge branch 'topic/install_java_sources' into 'master'
Install the Java bindings sources unconditionally Closes AdaCore#654 See merge request eng/libadalang/langkit!834
2 parents 4ad4929 + 8b01fd6 commit ccf8711

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

langkit/emitter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ def __init__(self,
190190
self.lib_name_low
191191
)
192192
self.java_jni = path.join(self.java_dir, "jni")
193-
self.java_native_config = path.join(self.java_dir, "native_image")
194193

195194
self.lib_project = path.join(self.lib_root, f"{self.lib_name_low}.gpr")
196195
self.mains_project = path.join(self.lib_root, "mains.gpr")
@@ -322,7 +321,6 @@ def setup_directories(self, ctx: CompileCtx) -> None:
322321
self.java_dir,
323322
self.java_package,
324323
self.java_jni,
325-
self.java_native_config,
326324
]:
327325
if not path.exists(d):
328326
os.makedirs(d)
@@ -750,7 +748,7 @@ def emit_java_api(self, ctx: CompileCtx) -> None:
750748
(
751749
"java_api/reflect_json",
752750
"reflect_config.json",
753-
self.java_native_config,
751+
self.java_dir,
754752
None
755753
),
756754
(

langkit/libmanage.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,7 @@ def do_install(self, args: argparse.Namespace) -> None:
11951195
build_mode = self.build_modes[0].value
11961196

11971197
lib_name = self.lib_name.lower()
1198+
lib_name_camel = lib_name.capitalize()
11981199

11991200
self.gprinstall(
12001201
args,
@@ -1244,6 +1245,14 @@ def do_install(self, args: argparse.Namespace) -> None:
12441245
os.path.join('ocaml', 'dune'),
12451246
os.path.join('ocaml', 'dune-project'),
12461247
os.path.join('ocaml', lib_name + '.opam'),
1248+
os.path.join('java', 'Makefile'),
1249+
os.path.join('java', 'pom.xml'),
1250+
os.path.join('java', 'reflect_config.json'),
1251+
os.path.join('java', 'jni',
1252+
f'com_adacore_{lib_name}_{lib_name_camel}_NI_LIB.h'),
1253+
os.path.join('java', 'jni', 'jni_impl.c'),
1254+
os.path.join('java', 'src', 'main', 'java', 'com', 'adacore',
1255+
lib_name, f'{lib_name_camel}.java'),
12471256
]:
12481257
install_path = os.path.dirname(self.dirs.install_dir(fpath))
12491258
if not path.isdir(install_path):
@@ -1254,20 +1263,6 @@ def do_install(self, args: argparse.Namespace) -> None:
12541263
f, os.path.join(install_path, os.path.basename(f))
12551264
)
12561265

1257-
# If Java is enabled, install using Maven
1258-
if args.enable_java:
1259-
# Install the Java bindings in the Maven repository
1260-
self.maven_command(['install'], args)
1261-
1262-
# Put the bindings JAR in the installation folder
1263-
jar_name = f'{lib_name}.jar'
1264-
jar_file = self.dirs.build_dir('java', 'target', jar_name)
1265-
install_file = self.dirs.install_dir('java', jar_name)
1266-
install_path = os.path.dirname(install_file)
1267-
if not path.isdir(install_path):
1268-
os.makedirs(install_path)
1269-
shutil.copyfile(jar_file, install_file)
1270-
12711266
def do_setenv(self, args: argparse.Namespace) -> None:
12721267
"""
12731268
Unless --json is passed, display Bourne shell commands that setup

0 commit comments

Comments
 (0)