Skip to content
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

Add Java module declaration for neo4j-java-driver #1274

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

injectives
Copy link
Contributor

@injectives injectives commented Jul 22, 2022

This update introduces an explicit org.neo4j.driver Java module declaration for neo4j-java-driver artifact. The introduced module name matches the previously used Automatic-Module-Name value.

org.neo4j.driver.internal.RevocationStrategy has been moved to org.neo4j.driver.RevocationStrategy.

@injectives injectives marked this pull request as draft July 22, 2022 11:46
@injectives injectives added enhancement on hold Work has temporarily been suspended discussion labels Jul 22, 2022
@michael-simons
Copy link
Contributor

michael-simons commented Jul 29, 2022

Hey @alina-yur quick question here that we ran into.
We are adding proper Java Module System to our driver and we are using org.graalvm.nativeimage:svm in provided scope for adding a bunch of substitutions, making active use of those:

import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

Now, for this to work on the module path, we require the corresponding module statically:

https://github.com/neo4j/neo4j-java-driver/pull/1274/files#diff-9d9468f1a44673612059e5cc10b501e82d34253cf56f16ae1925962ea60035afR39

module org.neo4j.driver {
    // The rest omitted
    requires static org.graalvm.nativeimage.builder;
}

Asorg.graalvm.nativeimage.builder does not export above annotations but only to a selected set of modules stuff needs help on compilation:

 <compilerArgs>
     <arg>--add-exports</arg>
     <arg>jdk.internal.vm.ci/jdk.vm.ci.code=org.graalvm.nativeimage.builder</arg>
     <arg>--add-exports</arg>
     <arg>org.graalvm.nativeimage.builder/com.oracle.svm.core.annotate=org.neo4j.driver</arg>
     <arg>--add-exports</arg>
     <arg>org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=org.neo4j.driver</arg>
</compilerArgs>

but we want to avoid those.

From your module info:

    exports com.oracle.svm.core.annotate to
        com.oracle.svm.svm_enterprise,
        jdk.internal.vm.compiler,
        org.graalvm.nativeimage.agent.diagnostics,
        org.graalvm.nativeimage.agent.jvmtibase,
        org.graalvm.nativeimage.agent.tracing,
        org.graalvm.nativeimage.base,
        org.graalvm.nativeimage.configure,
        org.graalvm.nativeimage.driver,
        org.graalvm.nativeimage.junitsupport,
        org.graalvm.nativeimage.librarysupport,
        org.graalvm.nativeimage.llvm;

and we are wondering if our usages is
a) correct at all
b) what happens on the module path
c) is that just an oversight on your side

It would be most awesome if you or someone else could point us to the correct manual or give a hint how to procceed.

@injectives injectives force-pushed the feature/jpms branch 15 times, most recently from 530b65a to 3bf3d15 Compare August 2, 2022 16:14
This update introduces an explicit `org.neo4j.driver` Java module declaration for `neo4j-java-driver` artifact. The introduced module name matches the previously used `Automatic-Module-Name` value.

`org.neo4j.driver.internal.RevocationStrategy` has been moved to `org.neo4j.driver.RevocationStrategy`.
@injectives injectives changed the title Add module declaration Add Java module declaration for neo4j-java-driver Aug 2, 2022
@injectives injectives marked this pull request as ready for review August 2, 2022 17:36
@injectives injectives removed on hold Work has temporarily been suspended discussion labels Aug 2, 2022
@injectives injectives merged commit 51ec3f3 into neo4j:5.0 Aug 3, 2022
@injectives injectives deleted the feature/jpms branch August 3, 2022 10:17
@michael-simons
Copy link
Contributor

Hmm @christianwimmer could you point me please to the correct path forward with these substitutions given the changes / advances in the native image API if you have a moment somewhen. Thanks !

@olpaw
Copy link

olpaw commented Sep 20, 2022

Hi @michael-simons

you will want to use

module org.neo4j.driver {
    ...
    requires org.graalvm.sdk;
    ...
}

then you have access to all our public API:
https://www.graalvm.org/sdk/javadoc/

Let me know if you need more help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants