Closed liblit closed 6 years ago
You need to apply the cpp
plugin as well.
Basically, the standard Gradle plugin style recommends not directly applying external project, and instead depending on the users applying themselves.
Thanks for the speedy reply, @ThadHouse. Unfortunately, adding apply plugin: 'cpp'
did not help, or at least was not sufficient. Model-related tasks still fail as before.
Ok. I didn't realize I hadn't pushed the update that fixed that bug.
I pushed update 0.2.1. Also, I would recommend declaring all of your plugins like below, rather then the way you had it.
plugins {
id 'edu.wpi.first.GradleJni' version '0.2.1'
id 'application'
id 'cpp'
}
Plugin version 0.2.1 fixed this problem. Excellent! Thank you for your super-speedy help, @ThadHouse.
Thanks as well for the style advice on loading plugins. I have become the main build system wrangler for WALA, a large Java research project. This is the same project in which I hope to eventually put your Gradle JNI plugin to real use. WALA has roughly 1,300 lines of Gradle build infrastructure, and I learned most of whatʼs in there by trial and error. The native compilation parts were especially tricky to figure out. I expect there are many things that I could be doing better if I knew more about idiomatic Gradle style. Of course, if someone with more Gradle experience wanted to look at what we are doing in WALA, and maybe contribute pull requests for any Gradle improvements, I know that the WALA maintainers are very welcoming to outside contributors.... :wink:
I created a minimal example project in which to experiment with the Gradle JNI plugin. Unfortunately, native compilation tasks such as
components
ormodel
fail due to some problem resolvingJniNativeLibrarySpec
. For example,./gradlew model
reports:Note: the JNI pluginʼs instructions refer to
version '0.1.6'
, but the latest version available from the main Gradle plugins repository is version 0.1.5, so the latter is what my minimal example project uses. Perhaps that version mismatch is the cause of the problem? ShouldJniNativeLibrarySpec
exist in release 0.1.5, or was that not added until later? Should a newer plugin release be made available in the official Gradle plugins repository?Also on the topic of versions, I am using the latest official Gradle release: version 4.7. Is this plugin known to work with Gradle 4.7?
For the record, I am aware that my minimal example project is actually incomplete: it declares a native method but provides no native implementation thereof. That is OK for now. I am learning as I go, and wanted to start with simply declaring the native model as per the JNI pluginʼs instructions.