mirror of
https://github.com/mesonbuild/meson.git
synced 2026-08-09 17:18:25 +00:00
After implementing a much more extensive Java native module than what currently exists in the tests, I found shortcomings. 1. You need to be able to pass multiple Java files. 2. Meson needs more information to better track the generated native headers. 3. Meson wasn't tracking the header files generated from inner classes. This new function should fix all the issues the old function had with room to grow should more functionality need to be added. What I implemented here in this new function is essentially what I have done in the Heterogeneous-Memory Storage Engine's Java bindings.
1.4 KiB
1.4 KiB
Java Module
(added in 0.60.0)
Functions
generate_native_header()
(deprecated in 0.62.0, use generate_native_headers())
This function will generate a header file for use in Java native module
development by reading the supplied Java file for native method declarations.
Keyword arguments:
package: The package of the file. If left empty, Meson will assume that there is no package.
generate_native_headers()
(added in 0.62.0)
This function will generate native header files for use in Java native module
development by reading the supplied Java files for native method declarations.
Keyword arguments:
-
classes: The list of class names relative to thepackage, if it exists, which containnativemethod declarations. Use.separated class names. -
package: The package of the file. If left empty, Meson will assume that there is no package.
Example:
// Outer.java
package com.mesonbuild;
public class Outer {
private static native void outer();
public static class Inner {
private static native void inner();
}
}
With the above file, an invocation would look like the following:
java = import('java')
native_headers = java.generate_native_headers(
'Outer.java',
package: 'com.mesonbuild',
classes: ['Outer', 'Outer.Inner']
)