-
Notifications
You must be signed in to change notification settings - Fork 6
Processor Options
JniGen settings not tied to a particular class can be customized via processor options. The following describes available options and their results. Note that if you inspect source code there might be additional options not documented here. These should be considered unstable and subject to change at any time.
The options are set by passing command line options in the form -Aname=value
to Java compiler. How to set them depends on your build system.
The path where generated files will be put. This directory will be created if it does not exist. It is recommended to use a designated directory not shared with any other files. This allows cleanup of stale files left over from generation from previous versions of Java code. This option is the only one that is required. All other options have sensible defaults.
Set to string "true" to tell the processor that it "owns" the destination directory. By default it is not set for backward compatibility.
If this option is set processor will delete any files it hasn't generated in it after each run. This will prevent your C++ code from accidentally using obsolete headers left in that directory. Using this flag and having a dedicated directory for JniGen output is strongly recommended.
If for some reason you do not want a dedicated directory and have JniGen
put its output in a directory mixed with other content you will have to
clean up stale content yourself (perhaps by reading outputs.txt
file)
A semicolon separated list of names of additional classes to expose (as if they were annotated with @ExposeToNative
). This is the only way to handle external classes that are not part of your code.
The name of a generated file that will contain a list of all other generated files. This file is useful for 2 purposes
- As a dependency marker for build system - you can set it as output of compilation task and input of any other task that needs to be rebuilt when generation changes happen. Since you cannot predict names of other generated files having a single file with a known name makes this easy
- As a list of files that can be compared to the current contents of the generated files directory. If any file is present in the directory but not in this file then it is 'stale' and must be removed.
By default the name of this file is
outputs.txt
The C++ name for Java constructors. By default it is ctor
but you can set it to whatever you like via this option
The name of the header file that will contain all the declaration of Java object types (jFoo, jBar etc.). By default it is type_mapping.h
The name of the header file that will include all the class type headers and declare JNIGEN_ALL_GENERATED_CLASSES
macro. By default it is all_classes.h
- Building
-
User's Guide
Declaring Java Types
Accessing Methods and Fields
Representing Java Classes
Implementing Native Methods
Smart References
Error Handling
Obtaining JNIEnv
Initialization
Strings
Arrays
Direct Buffers
Booleans
Sizes -
JniGen Code Generator
Integrating JniGen
Annotations
Processor Options