Skip to content

Commit

Permalink
auto-generate JNI headers
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jun 26, 2024
1 parent 250451b commit c898b97
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.cxx/
/src/main/native/auto/

# Ignore Gradle's project-specific cache directory:
/.gradle/
Expand Down
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ ext {

sourceSets.main.java {
srcDir 'src/main/java'
srcDir 'src/main/native' // for IDE access (no Java there)
}

// Regenerate all JNI header files before compiling any C++ source code.
tasks.withType(CppCompile) {
dependsOn('classes', 'compileTestJava')
}

java {
Expand All @@ -25,5 +31,15 @@ tasks.withType(JavaCompile) { // Java compile-time options:
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true // to provide detailed deprecation warnings
options.encoding = 'UTF-8'
options.headerOutputDirectory = new File('src/main/native/auto')
}

javadoc.dependsOn('compileTestJava')

// Register cleanup tasks:

clean.dependsOn('cleanAutoHeaders')

tasks.register('cleanAutoHeaders', Delete) { // auto-generated JNI headers
delete 'src/main/native/auto'
}

0 comments on commit c898b97

Please sign in to comment.