Skip to content

Commit

Permalink
Add minimimal classes for fastutil into the shaded client jar
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed Jan 2, 2025
1 parent 69e9346 commit abcfe5c
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2586,6 +2586,7 @@ flexible messaging model and an intuitive client API.</description>
<module>pulsar-metadata</module>
<module>jetcd-core-shaded</module>
<module>jclouds-shaded</module>
<module>pulsar-client-dependencies-minimized</module>

<!-- package management releated modules (begin) -->
<module>pulsar-package-management</module>
Expand Down Expand Up @@ -2651,6 +2652,7 @@ flexible messaging model and an intuitive client API.</description>
<module>distribution</module>
<module>pulsar-metadata</module>
<module>jetcd-core-shaded</module>
<module>pulsar-client-dependencies-minimized</module>
<!-- package management releated modules (begin) -->
<module>pulsar-package-management</module>
<!-- package management releated modules (end) -->
Expand Down
16 changes: 16 additions & 0 deletions pulsar-client-admin-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-admin-original</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-dependencies-minimized</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down Expand Up @@ -150,6 +161,7 @@
<include>org.objenesis:*</include>
<include>org.reactivestreams:reactive-streams</include>
<include>org.yaml:snakeyaml</include>
<include>org.apache.pulsar:pulsar-client-dependencies-minimized</include>
</includes>
<excludes>
<exclude>com.fasterxml.jackson.core:jackson-annotations</exclude>
Expand Down Expand Up @@ -269,6 +281,10 @@
<pattern>io.swagger</pattern>
<shadedPattern>org.apache.pulsar.shade.io.swagger</shadedPattern>
</relocation>
<relocation>
<pattern>it.unimi.dsi.fastutil</pattern>
<shadedPattern>org.apache.pulsar.shade.it.unimi.dsi.fastutil</shadedPattern>
</relocation>
<relocation>
<pattern>javassist</pattern>
<shadedPattern>org.apache.pulsar.shade.javassist</shadedPattern>
Expand Down
17 changes: 16 additions & 1 deletion pulsar-client-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-original</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-dependencies-minimized</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down Expand Up @@ -200,7 +211,7 @@
<include>org.reactivestreams:reactive-streams</include>
<include>org.tukaani:xz</include>
<include>org.yaml:snakeyaml</include>
<include>it.unimi.dsi:fastutil</include>
<include>org.apache.pulsar:pulsar-client-dependencies-minimized</include>
</includes>
<excludes>
<exclude>com.fasterxml.jackson.core:jackson-annotations</exclude>
Expand Down Expand Up @@ -318,6 +329,10 @@
<pattern>io.swagger</pattern>
<shadedPattern>org.apache.pulsar.shade.io.swagger</shadedPattern>
</relocation>
<relocation>
<pattern>it.unimi.dsi.fastutil</pattern>
<shadedPattern>org.apache.pulsar.shade.it.unimi.dsi.fastutil</shadedPattern>
</relocation>
<relocation>
<pattern>javassist</pattern>
<shadedPattern>org.apache.pulsar.shade.javassist</shadedPattern>
Expand Down
100 changes: 100 additions & 0 deletions pulsar-client-dependencies-minimized/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar</artifactId>
<version>4.1.0-SNAPSHOT</version>
</parent>

<artifactId>pulsar-client-dependencies-minimized</artifactId>
<name>Apache Pulsar :: Client :: Dependencies minimized</name>
<description>This module is used in `pulsar-client-all`, `pulsar-client-shaded`, and `pulsar-client-admin-shaded`
to minimize the number of classes included in the shaded jars for specific dependencies.
Currently, it is used to minimize the classes included from `fastutil`.
</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-original</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<!-- Skips the deployment of the minimized dependencies to Maven Central as this is an intermediate
module used for building the shaded client jars -->
<configuration>
<skip>true</skip>
</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>
<createDependencyReducedPom>true</createDependencyReducedPom>
<promoteTransitiveDependencies>false</promoteTransitiveDependencies>
<!-- minimize the classes included in the shaded jar -->
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<!-- The Pulsar module that references the library being minimized -->
<include>org.apache.pulsar:pulsar-client-original</include>
<!-- Currently, only fastutil is minimized -->
<include>it.unimi.dsi:fastutil</include>
</includes>
</artifactSet>
<filters>
<!--
This filter specifies the classes that use the dependencies.
Both includes and excludes are set to **.
-->
<filter>
<artifact>org.apache.pulsar:pulsar-client-original</artifact>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
17 changes: 16 additions & 1 deletion pulsar-client-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-original</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-dependencies-minimized</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down Expand Up @@ -164,7 +175,7 @@
<include>org.reactivestreams:reactive-streams</include>
<include>org.tukaani:xz</include>
<include>org.yaml:snakeyaml</include>
<include>it.unimi.dsi:fastutil</include>
<include>org.apache.pulsar:pulsar-client-dependencies-minimized</include>
</includes>
<excludes>
<exclude>com.fasterxml.jackson.core:jackson-annotations</exclude>
Expand Down Expand Up @@ -264,6 +275,10 @@
<pattern>io.swagger</pattern>
<shadedPattern>org.apache.pulsar.shade.io.swagger</shadedPattern>
</relocation>
<relocation>
<pattern>it.unimi.dsi.fastutil</pattern>
<shadedPattern>org.apache.pulsar.shade.it.unimi.dsi.fastutil</shadedPattern>
</relocation>
<relocation>
<pattern>javax.activation</pattern>
<shadedPattern>org.apache.pulsar.shade.javax.activation</shadedPattern>
Expand Down

0 comments on commit abcfe5c

Please sign in to comment.