Using an arg file
Arg files are the standard way to add filtering with Jextract. The setup involves two steps:
- Creating the file
- Adding it to the library config in the build script
Arg Files
Section titled “Arg Files”What is an arg file?
Section titled “What is an arg file?”Jextract is a command line tool, and arg files are files containing command line arguments, separated by linebreaks. Instead of passing each of them to a shell command by hand, an arg file is passed to the CLI that reads the contained arguments. It is a configuration file to be checked into source control
This example demonstrates the format using some filtering arguments from Jextract:
# bass-includes.txt--include-function BASS_Update--include-constant
Creating a working arg file
Section titled “Creating a working arg file”Jextract can dump all symbols used in a given library into an arg file.
This file is meant to be edited and reduced to include only the needed symbols.
This plugin makes this feature available through the dumpIncludes
task.
./gradlew dumpIncludes
This will output the generated arg file to a predefined location in the build directory.
Directorylib
Directorybuild
Directoryreports
Directoryjextract
- <libname>-includes.txt
- Copy this file anywhere into your source directory.
- Modify and rinse until it includes only the needed symbols.
- Check it into source control.
Configuring Gradle
Section titled “Configuring Gradle”Lastly, the prepared arg file must be associated with its library config.
jextract.libraries { register("<libname>") { whitelist { argFile = layout.projectDirectory.file("src/main/includes/<libname>-includes.txt") } }}
jextract.libraries { register("<libname>") { whitelist { argFile = layout.projectDirectory.file("src/main/includes/<libname>-includes.txt") } }}
gradlew.bat clean build
./gradlew clean build