C Plugin exportedHeaders - what does it do?

Hi, I’m pretty new to Gradle, and even newer to the C plugin.

I have a static JNI library project which I’m migrating from Maven (with nar plugin) to Gradle (with c plugin).

My Gradle version generates a .lib and a .jar, which both get published to Artifactory - so far, so good. The .jar seems to get picked up automatically by the artifactory plugin, which is great, and the .lib gets there because I have

artifacts {
 archives file("${buildDir}/binaries/myLibStaticLibrary/windows_x86/MyLib.lib")
}
  artifactoryPublish {
 publishConfigs('archives')
}

The Maven/nar version also publishes a MyLib-x.y-SNAPSHOT-noarch.nar, which contains all my exported headers, for use by downstream projects. (Some are under version control, others are auto-generated by javah - I don’t know how relevant that is.)

In build.gradle, I have

sources {
 MyLib {
  c {
   source {
    srcDir "src/main/c"
    include "win/*.c"
    include "*.c"
   }
   exportedHeaders {
    srcDirs "src/main/include/", "build/generated/"
   }
  }
 }
}

and when I build, it checks out headers from SCM into src/main/include and generates the JNI headers into build/generated.

The problem now is that I don’t know the best practice for publishing my exported headers. Also, although I think I know what ‘exportedHeaders’ is intended to mean, I’m not sure what it actually does. Presumably I should I use it somehow to produce another artifact for artifactoryPublish, but I can’t seem to find the right syntax. I’m not even sure what the artifact should sensibly be - a zip, or something else.

Does anyone who’s done this sort of thing before have any tips?

At this time, there is no support for publishing/resolving a native library from an external repository. This is something we are actively working on. So you’re not missing something: it’s just that the functionality is not yet complete.

Hi Daz,

Thanks for the response. I got round it in the end by writing some ad-hoc glue code. Not my finest work, but it does the job.

I’ll keep tuned for future developments.

Paul.