aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/Java-module.md
blob: aa95f787f3ef039285fb92bcdadbfb6a36883095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Java Module

*(added in 0.60.0)*

## Functions

### `generate_native_header()`

*(deprecated in 0.62.0, use `generate_native_headers()`)*
*(removed in 1.0.0)*

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](https://en.wikipedia.org/wiki/Java_package) of the
file. If left empty, Meson will assume that there is no package.

### `generate_native_headers()`

*(added in 0.62.0)*
*(deprecated in 1.0.0, use `native_headers()`)*

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 the `package`, if it exists,
which contain `native` method declarations. Use `.` separated class names.

- `package`: The [package](https://en.wikipedia.org/wiki/Java_package) of the
file. If left empty, Meson will assume that there is no package.

Example:

```java
// 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:

```meson
java = import('java')

native_headers = java.generate_native_headers(
    'Outer.java',
    package: 'com.mesonbuild',
    classes: ['Outer', 'Outer.Inner']
)
```

### `native_headers()`

*(added in 1.0.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 the `package`, if it exists,
which contain `native` method declarations. Use `.` separated class names.

- `package`: The [package](https://en.wikipedia.org/wiki/Java_package) of the
file. If left empty, Meson will assume that there is no package.

Example:

```java
// 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:

```meson
java = import('java')

native_headers = java.generate_native_headers(
    'Outer.java',
    package: 'com.mesonbuild',
    classes: ['Outer', 'Outer.Inner']
)
```