-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demonstrate usage of dev.nokee.jni-library
plugin
#154
Conversation
f46a877
to
a4bd676
Compare
Thank you very much. I guess I'll rewrite the build script in Kotlin eventually, but for now Groovy will do fine :). Some questions:
Some things not directly related to the PR specifically. I am currently encountering the problem that the dynamic library produced for macOS doesn't include the currect load commands, (see #142) which may be due to the fact that currently it is build using the |
For the name of the generated library, there isn't an official way but I can definitely add the API. There are several part to a native library name. Considering
Downloading unbuildable variants is still an open question. At the present moment, how the use case is solved within darklaf, it seems to be more a matter of workflow than addressing the root issue. I would probably stay with the current implementation see where we can evolve the requirement based on other use cases. As for the |
I only need the name of the resulting binary (e.g. for a shared library) as this would avoid the manual configuration of the fallback lookup path.
I can't say for sure that it would make a difference, but the problem I am facing is that the dynamic library produced for macOS currently doesn't have the
This flags needs to be set and have the correct |
Great point regarding the resulting binary file name. It is possible to access the As for the |
Yes exactly. Would it be feasible to enable configuration creation regardless of whether they are buildable?
I knew about the
|
Could you tell me what's the version you see when you run For unbuildable variants, it's tricky went it comes to configuration. Users may make the assumption that some model elements are always available when they work on a system where the variant is buildable then hit some strange provider errors on system where the variant is buildable. That being said, I did some experimentation when creating the Xcode IDE plugin and I believe it would be possible to lazily create all variants and realize only the one that are requested to build. It would keep a good performance while allowing to "get" all variants for decision making. I will slowly work toward this solution while progressing on iOS and ensure the feature is cross-cutting to support the same in JNI. I would suggest keeping your workaround at the moment. |
Build log:
Good to know 👍 Thank you for the effort. |
:-( That is what I thought |
As a side note, I tried the build on my machine (where my SDK version is 10.15) and it built without issue. |
Works fine now. I think I remember reading that github upped the default sdk version for their hosted runner to
Previously the SDK had an incorrect value:
Appareantly |
Other question: When configuring the linker task linkTask.configure {
linkerArgs.addAll("-lobjc", "-framework", "AppKit")
} I guess the |
Unfortunately, Objective-C compilation doesn't imply any default libraries. According to my experimentation, For
Again, the version needs to match the SDK version of the machine, it's a cross-cutting issue that will be solved for all frameworks. |
Also writing the documentation for building JNI projects, I will go ahead and change to create all variants as it's very hard to explain the current behaviour and pose more issue than what is worth: nokeedev/gradle-native#36 |
Closing due to #173. |
The Nokee plugins are a continuous effort to improve native support in Gradle. The JNI library plugins aim to offer the same quality as any Gradle core plugins but strictly aimed at native support.
This PR shows how the JNI library plugin can be used to build darklaf. Some custom logic was mixed inside the ad-hoc
jni-library
plugin which was based on a sample Paul and I worked on. I provided a reference implementation (sorry for providing it in Groovy, my Kotlin skills aren't that great) of the logic extracted out that works with the Nokee plugins. Along the way, there we missing API so I added them into a nightly build (version0.3.0-<sha>
). The documentation for those new APIs should appear over the next couple days in the nightly documentation. Let's discuss anything that feels wrong with this code and add any potential missing API to the JNI library plugin.There is some current limitation but I don't see them as an issue for this migration:
1- Lack of source layout configuration.
2- Lack of build type modelling. I didn't see any obvious usage of the debug variant of the native library. If I'm mistaken, let's chat about adding this modelling.
Ideally, we would wait for the GA version, that would be version 0.3, before merging but we come back with another PR to update the version.