| 1 |
# Java Module |
| 2 |
|
| 3 |
*(added in 0.60.0)* |
| 4 |
|
| 5 |
## Functions |
| 6 |
|
| 7 |
### `generate_native_header()` |
| 8 |
|
| 9 |
*(deprecated in 0.62.0, use `generate_native_headers()`)* |
| 10 |
*(removed in 1.0.0)* |
| 11 |
|
| 12 |
This function will generate a header file for use in Java native module |
| 13 |
development by reading the supplied Java file for `native` method declarations. |
| 14 |
|
| 15 |
Keyword arguments: |
| 16 |
|
| 17 |
- `package`: The [package](https://en.wikipedia.org/wiki/Java_package) of the |
| 18 |
file. If left empty, Meson will assume that there is no package. |
| 19 |
|
| 20 |
### `generate_native_headers()` |
| 21 |
|
| 22 |
*(added in 0.62.0)* |
| 23 |
*(deprecated in 1.0.0, use `native_headers()`)* |
| 24 |
|
| 25 |
This function will generate native header files for use in Java native module |
| 26 |
development by reading the supplied Java files for `native` method declarations. |
| 27 |
|
| 28 |
Keyword arguments: |
| 29 |
|
| 30 |
- `classes`: The list of class names relative to the `package`, if it exists, |
| 31 |
which contain `native` method declarations. Use `.` separated class names. |
| 32 |
|
| 33 |
- `package`: The [package](https://en.wikipedia.org/wiki/Java_package) of the |
| 34 |
file. If left empty, Meson will assume that there is no package. |
| 35 |
|
| 36 |
Example: |
| 37 |
|
| 38 |
```java |
| 39 |
// Outer.java |
| 40 |
|
| 41 |
package com.mesonbuild; |
| 42 |
|
| 43 |
public class Outer { |
| 44 |
private static native void outer(); |
| 45 |
|
| 46 |
public static class Inner { |
| 47 |
private static native void inner(); |
| 48 |
} |
| 49 |
} |
| 50 |
``` |
| 51 |
|
| 52 |
With the above file, an invocation would look like the following: |
| 53 |
|
| 54 |
```meson |
| 55 |
java = import('java') |
| 56 |
|
| 57 |
native_headers = java.generate_native_headers( |
| 58 |
'Outer.java', |
| 59 |
package: 'com.mesonbuild', |
| 60 |
classes: ['Outer', 'Outer.Inner'] |
| 61 |
) |
| 62 |
``` |
| 63 |
|
| 64 |
### `native_headers()` |
| 65 |
|
| 66 |
*(added in 1.0.0)* |
| 67 |
|
| 68 |
This function will generate native header files for use in Java native module |
| 69 |
development by reading the supplied Java files for `native` method declarations. |
| 70 |
|
| 71 |
Keyword arguments: |
| 72 |
|
| 73 |
- `classes`: The list of class names relative to the `package`, if it exists, |
| 74 |
which contain `native` method declarations. Use `.` separated class names. |
| 75 |
|
| 76 |
- `package`: The [package](https://en.wikipedia.org/wiki/Java_package) of the |
| 77 |
file. If left empty, Meson will assume that there is no package. |
| 78 |
|
| 79 |
Example: |
| 80 |
|
| 81 |
```java |
| 82 |
// Outer.java |
| 83 |
|
| 84 |
package com.mesonbuild; |
| 85 |
|
| 86 |
public class Outer { |
| 87 |
private static native void outer(); |
| 88 |
|
| 89 |
public static class Inner { |
| 90 |
private static native void inner(); |
| 91 |
} |
| 92 |
} |
| 93 |
``` |
| 94 |
|
| 95 |
With the above file, an invocation would look like the following: |
| 96 |
|
| 97 |
```meson |
| 98 |
java = import('java') |
| 99 |
|
| 100 |
native_headers = java.generate_native_headers( |
| 101 |
'Outer.java', |
| 102 |
package: 'com.mesonbuild', |
| 103 |
classes: ['Outer', 'Outer.Inner'] |
| 104 |
) |
| 105 |
``` |