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 a "slim" deployment option. #1024

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 97 additions & 44 deletions driver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<relativePath>..</relativePath>
</parent>

<artifactId>neo4j-java-driver</artifactId>
<artifactId>neo4j-java-driver${deploymentType}</artifactId>

<packaging>jar</packaging>
<name>Neo4j Java Driver</name>
Expand All @@ -22,6 +22,7 @@
<moduleName>org.neo4j.driver</moduleName>
<rootDir>${project.basedir}/..</rootDir>
<maven.deploy.skip>false</maven.deploy.skip>
<deploymentType/>
</properties>

<dependencies>
Expand Down Expand Up @@ -82,7 +83,102 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>slim</id>
<activation>
<property>
<name>skipShade</name>
<value>true</value>
</property>
</activation>
<properties>
<deploymentType>-slim</deploymentType>
</properties>
</profile>

<profile>
<id>shading</id>
<activation>
<property>
<name>skipShade</name>
<value>!true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>io.netty:*</include>
<include>io.projectreactor:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>org.neo4j.driver.internal.shaded.io.netty</shadedPattern>
</relocation>
<relocation>
<pattern>reactor</pattern>
<shadedPattern>org.neo4j.driver.internal.shaded.reactor</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<file>src/main/resources/shaded/META-INF/native-image/org.neo4j.driver/neo4j-java-driver/native-image.properties</file>
<resource>META-INF/native-image/org.neo4j.driver/neo4j-java-driver/native-image.properties</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<file>src/main/resources/shaded/META-INF/native-image/org.neo4j.driver/neo4j-java-driver/reflection-config.json</file>
<resource>META-INF/native-image/org.neo4j.driver/neo4j-java-driver/reflection-config.json</resource>
</transformer>
</transformers>
<filters>
<filter>
<artifact>io.netty:*</artifact>
<excludes>
<exclude>META-INF/native-image/**</exclude>
</excludes>
</filter>
<filter>
<!-- We have dedicated ones included above -->
<artifact>org.neo4j.driver:neo4j-java-driver</artifact>
<excludes>
<exclude>META-INF/native-image/**</exclude>
</excludes>
</filter>
</filters>
<shadeTestJar>true</shadeTestJar>
<createSourcesJar>true</createSourcesJar>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>shaded/**/*</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down Expand Up @@ -215,49 +311,6 @@
<classesDirectory>${project.build.directory}/classes</classesDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>io.netty:*</include>
<include>io.projectreactor:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>org.neo4j.driver.internal.shaded.io.netty</shadedPattern>
</relocation>
<relocation>
<pattern>reactor</pattern>
<shadedPattern>org.neo4j.driver.internal.shaded.reactor</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<filters>
<filter>
<artifact>io.netty:*</artifact>
<excludes>
<exclude>META-INF/native-image/**</exclude>
</excludes>
</filter>
</filters>
<shadeTestJar>true</shadeTestJar>
<createSourcesJar>true</createSourcesJar>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ Args = -H:ReflectionConfigurationResources=${.}/reflection-config.json \
--initialize-at-run-time=org.neo4j.driver.internal.async.connection.BoltProtocolUtil \
--initialize-at-run-time=org.neo4j.driver.internal.async.connection.ChannelAttributes \
--initialize-at-run-time=org.neo4j.driver.internal.async.connection.ChannelConnectedListener \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.AbstractReferenceCountedByteBuf \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.ByteBufAllocator \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.ByteBufUtil \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.ByteBufUtil$HexUtil \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.PooledByteBufAllocator \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.UnpooledHeapByteBuf \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.UnreleasableByteBuf \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.Conscrypt \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.util.ThreadLocalInsecureRandom \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.util.AbstractReferenceCounted \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.util.internal.logging.Log4JLogger \
--initialize-at-run-time=io.netty.buffer.AbstractReferenceCountedByteBuf \
--initialize-at-run-time=io.netty.buffer.ByteBufAllocator \
--initialize-at-run-time=io.netty.buffer.ByteBufUtil \
--initialize-at-run-time=io.netty.buffer.ByteBufUtil$HexUtil \
--initialize-at-run-time=io.netty.buffer.PooledByteBufAllocator \
--initialize-at-run-time=io.netty.buffer.UnpooledHeapByteBuf \
--initialize-at-run-time=io.netty.buffer.UnreleasableByteBuf \
--initialize-at-run-time=io.netty.handler.ssl.Conscrypt \
--initialize-at-run-time=io.netty.handler.ssl.ConscryptAlpnSslEngine \
--initialize-at-run-time=io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator \
--initialize-at-run-time=io.netty.handler.ssl.ReferenceCountedOpenSslEngine \
--initialize-at-run-time=io.netty.handler.ssl.util.ThreadLocalInsecureRandom \
--initialize-at-run-time=io.netty.util.AbstractReferenceCounted \
--initialize-at-run-time=io.netty.util.internal.logging.Log4JLogger \
-Dio.netty.noUnsafe=true \
-Dio.netty.leakDetection.level=DISABLED
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
[
{
"name": "org.neo4j.driver.internal.shaded.io.netty.channel.socket.nio.NioSocketChannel",
"name": "io.netty.channel.socket.nio.NioSocketChannel",
"methods": [
{ "name": "<init>", "parameterTypes": [] }
]
},
{
"name": "org.neo4j.driver.internal.shaded.io.netty.channel.socket.nio.NioServerSocketChannel",
"name": "io.netty.channel.socket.nio.NioServerSocketChannel",
"methods": [
{ "name": "<init>", "parameterTypes": [] }
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.buffer.AbstractByteBufAllocator",
"name" : "io.netty.buffer.AbstractByteBufAllocator",
"allDeclaredMethods" : true
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.ReferenceCountUtil",
"name" : "io.netty.util.ReferenceCountUtil",
"allDeclaredMethods" : true
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField",
"name" : "io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField",
"fields": [
{"name": "producerIndex", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField",
"name" : "io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField",
"fields": [
{"name": "producerLimit", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField",
"name" : "io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField",
"fields": [
{"name": "consumerIndex", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields",
"name" : "io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields",
"fields": [
{"name": "producerIndex", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields",
"name" : "io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields",
"fields": [
{"name": "producerLimit", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields",
"name" : "io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields",
"fields": [
{"name": "consumerIndex", "allowUnsafeAccess": true}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Args = -H:ReflectionConfigurationResources=${.}/reflection-config.json \
--initialize-at-run-time=org.neo4j.driver.internal.async.connection.BoltProtocolUtil \
--initialize-at-run-time=org.neo4j.driver.internal.async.connection.ChannelAttributes \
--initialize-at-run-time=org.neo4j.driver.internal.async.connection.ChannelConnectedListener \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.AbstractReferenceCountedByteBuf \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.ByteBufAllocator \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.ByteBufUtil \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.ByteBufUtil$HexUtil \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.PooledByteBufAllocator \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.UnpooledHeapByteBuf \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.buffer.UnreleasableByteBuf \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.Conscrypt \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.handler.ssl.util.ThreadLocalInsecureRandom \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.util.AbstractReferenceCounted \
--initialize-at-run-time=org.neo4j.driver.internal.shaded.io.netty.util.internal.logging.Log4JLogger \
-Dio.netty.noUnsafe=true \
-Dio.netty.leakDetection.level=DISABLED
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"name": "org.neo4j.driver.internal.shaded.io.netty.channel.socket.nio.NioSocketChannel",
"methods": [
{ "name": "<init>", "parameterTypes": [] }
]
},
{
"name": "org.neo4j.driver.internal.shaded.io.netty.channel.socket.nio.NioServerSocketChannel",
"methods": [
{ "name": "<init>", "parameterTypes": [] }
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.buffer.AbstractByteBufAllocator",
"allDeclaredMethods" : true
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.ReferenceCountUtil",
"allDeclaredMethods" : true
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField",
"fields": [
{"name": "producerIndex", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField",
"fields": [
{"name": "producerLimit", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField",
"fields": [
{"name": "consumerIndex", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields",
"fields": [
{"name": "producerIndex", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields",
"fields": [
{"name": "producerLimit", "allowUnsafeAccess": true}
]
},
{
"name" : "org.neo4j.driver.internal.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields",
"fields": [
{"name": "consumerIndex", "allowUnsafeAccess": true}
]
}
]