Skip to content

Commit 3ef49df

Browse files
Move DataStax shaded Guava module into Java driver
patch by Lukasz Antoniak; reviewed by Alexandre Dutra and Erik Merkle for CASSJAVA-52 Update pom.xml Co-authored-by: Alexandre Dutra <[email protected]>
1 parent 7877837 commit 3ef49df

File tree

15 files changed

+351
-21
lines changed

15 files changed

+351
-21
lines changed

bom/pom.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
<artifactId>java-driver-query-builder</artifactId>
5656
<version>4.18.2-SNAPSHOT</version>
5757
</dependency>
58+
<dependency>
59+
<groupId>org.apache.cassandra</groupId>
60+
<artifactId>java-driver-guava-shaded</artifactId>
61+
<version>4.18.2-SNAPSHOT</version>
62+
</dependency>
5863
<dependency>
5964
<groupId>org.apache.cassandra</groupId>
6065
<artifactId>java-driver-test-infra</artifactId>
@@ -75,11 +80,6 @@
7580
<artifactId>native-protocol</artifactId>
7681
<version>1.5.1</version>
7782
</dependency>
78-
<dependency>
79-
<groupId>com.datastax.oss</groupId>
80-
<artifactId>java-driver-shaded-guava</artifactId>
81-
<version>25.1-jre-graal-sub-1</version>
82-
</dependency>
8383
</dependencies>
8484
</dependencyManagement>
8585
<build>

core-shaded/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
<artifactId>native-protocol</artifactId>
5858
</dependency>
5959
<dependency>
60-
<groupId>com.datastax.oss</groupId>
61-
<artifactId>java-driver-shaded-guava</artifactId>
60+
<groupId>org.apache.cassandra</groupId>
61+
<artifactId>java-driver-guava-shaded</artifactId>
6262
</dependency>
6363
<dependency>
6464
<groupId>com.typesafe</groupId>

core/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
<artifactId>netty-handler</artifactId>
5050
</dependency>
5151
<dependency>
52-
<groupId>com.datastax.oss</groupId>
53-
<artifactId>java-driver-shaded-guava</artifactId>
52+
<groupId>org.apache.cassandra</groupId>
53+
<artifactId>java-driver-guava-shaded</artifactId>
5454
</dependency>
5555
<dependency>
5656
<groupId>com.typesafe</groupId>

distribution/src/assembly/binary-tarball.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
<exclude>org.apache.cassandra:java-driver-core</exclude>
6767
<exclude>org.apache.cassandra:java-driver-mapper-runtime</exclude>
6868
<exclude>org.apache.cassandra:java-driver-mapper-processor</exclude>
69+
<exclude>org.apache.cassandra:java-driver-guava-shaded</exclude>
6970
<!-- Don't reinclude dependencies that core also has -->
70-
<exclude>com.datastax.oss:java-driver-shaded-guava</exclude>
7171
<exclude>com.github.stephenc.jcip:jcip-annotations</exclude>
7272
<exclude>com.github.spotbugs:spotbugs-annotations</exclude>
7373
</excludes>
@@ -91,8 +91,8 @@
9191
<exclude>org.apache.cassandra:java-driver-core</exclude>
9292
<exclude>org.apache.cassandra:java-driver-query-builder</exclude>
9393
<exclude>org.apache.cassandra:java-driver-mapper-processor</exclude>
94+
<exclude>org.apache.cassandra:java-driver-guava-shaded</exclude>
9495
<!-- Don't reinclude dependencies that core also has -->
95-
<exclude>com.datastax.oss:java-driver-shaded-guava</exclude>
9696
<exclude>com.github.stephenc.jcip:jcip-annotations</exclude>
9797
<exclude>com.github.spotbugs:spotbugs-annotations</exclude>
9898
</excludes>
@@ -116,8 +116,8 @@
116116
<exclude>org.apache.cassandra:java-driver-core</exclude>
117117
<exclude>org.apache.cassandra:java-driver-query-builder</exclude>
118118
<exclude>org.apache.cassandra:java-driver-mapper-runtime</exclude>
119+
<exclude>org.apache.cassandra:java-driver-guava-shaded</exclude>
119120
<!-- Don't reinclude dependencies that core also has -->
120-
<exclude>com.datastax.oss:java-driver-shaded-guava</exclude>
121121
<exclude>com.github.stephenc.jcip:jcip-annotations</exclude>
122122
<exclude>com.github.spotbugs:spotbugs-annotations</exclude>
123123
</excludes>

guava-shaded/pom.xml

+215
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
20+
-->
21+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
<parent>
24+
<groupId>org.apache.cassandra</groupId>
25+
<artifactId>java-driver-parent</artifactId>
26+
<version>4.18.2-SNAPSHOT</version>
27+
</parent>
28+
<artifactId>java-driver-guava-shaded</artifactId>
29+
<name>Apache Cassandra Java Driver - guava shaded dep</name>
30+
<description>Shaded Guava artifact for use in the Java driver for Apache Cassandra®</description>
31+
<dependencies>
32+
<dependency>
33+
<groupId>com.google.guava</groupId>
34+
<artifactId>guava</artifactId>
35+
<exclusions>
36+
<exclusion>
37+
<groupId>com.google.code.findbugs</groupId>
38+
<artifactId>jsr305</artifactId>
39+
</exclusion>
40+
<exclusion>
41+
<groupId>org.checkerframework</groupId>
42+
<artifactId>checker-qual</artifactId>
43+
</exclusion>
44+
<exclusion>
45+
<groupId>com.google.errorprone</groupId>
46+
<artifactId>error_prone_annotations</artifactId>
47+
</exclusion>
48+
<exclusion>
49+
<groupId>com.google.j2objc</groupId>
50+
<artifactId>j2objc-annotations</artifactId>
51+
</exclusion>
52+
<exclusion>
53+
<groupId>org.codehaus.mojo</groupId>
54+
<artifactId>animal-sniffer-annotations</artifactId>
55+
</exclusion>
56+
</exclusions>
57+
</dependency>
58+
<dependency>
59+
<groupId>org.graalvm.nativeimage</groupId>
60+
<artifactId>svm</artifactId>
61+
<version>20.0.0</version>
62+
<scope>provided</scope>
63+
</dependency>
64+
</dependencies>
65+
<build>
66+
<plugins>
67+
<plugin>
68+
<artifactId>maven-shade-plugin</artifactId>
69+
<executions>
70+
<execution>
71+
<id>shade-guava-dependency</id>
72+
<phase>package</phase>
73+
<goals>
74+
<goal>shade</goal>
75+
</goals>
76+
<configuration>
77+
<artifactSet>
78+
<includes>
79+
<include>org.apache.cassandra:java-driver-guava-shaded</include>
80+
<include>com.google.guava:guava</include>
81+
</includes>
82+
</artifactSet>
83+
<relocations>
84+
<relocation>
85+
<pattern>com.google</pattern>
86+
<shadedPattern>com.datastax.oss.driver.shaded.guava</shadedPattern>
87+
</relocation>
88+
</relocations>
89+
<filters>
90+
<filter>
91+
<artifact>com.google.guava:*</artifact>
92+
<excludes>
93+
<exclude>META-INF/**</exclude>
94+
</excludes>
95+
</filter>
96+
</filters>
97+
<createSourcesJar>true</createSourcesJar>
98+
<shadeSourcesContent>true</shadeSourcesContent>
99+
</configuration>
100+
</execution>
101+
</executions>
102+
</plugin>
103+
<plugin>
104+
<artifactId>maven-clean-plugin</artifactId>
105+
<executions>
106+
<execution>
107+
<id>clean-classes</id>
108+
<phase>package</phase>
109+
<goals>
110+
<goal>clean</goal>
111+
</goals>
112+
<configuration>
113+
<directory>${project.build.outputDirectory}</directory>
114+
</configuration>
115+
</execution>
116+
</executions>
117+
</plugin>
118+
<plugin>
119+
<artifactId>maven-dependency-plugin</artifactId>
120+
<executions>
121+
<execution>
122+
<id>unpack-shaded-classes</id>
123+
<phase>package</phase>
124+
<goals>
125+
<goal>unpack</goal>
126+
</goals>
127+
<configuration>
128+
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
129+
<artifactItems>
130+
<artifactItem>
131+
<groupId>org.apache.cassandra</groupId>
132+
<artifactId>java-driver-guava-shaded</artifactId>
133+
<version>${project.version}</version>
134+
<type>jar</type>
135+
</artifactItem>
136+
</artifactItems>
137+
</configuration>
138+
</execution>
139+
</executions>
140+
</plugin>
141+
<plugin>
142+
<groupId>org.apache.felix</groupId>
143+
<artifactId>maven-bundle-plugin</artifactId>
144+
<!--
145+
Using later version of the plugin will scan all dynamically loaded classes
146+
with Class.forName(). In the end, more packages will be imported in MANIFEST.MF
147+
and OSGi integration tests will break.
148+
-->
149+
<version>3.5.0</version>
150+
<extensions>true</extensions>
151+
<executions>
152+
<execution>
153+
<id>generate-shaded-manifest</id>
154+
<phase>package</phase>
155+
<goals>
156+
<goal>manifest</goal>
157+
</goals>
158+
<configuration>
159+
<instructions>
160+
<Bundle-SymbolicName>com.datastax.oss.driver.shaded.guava</Bundle-SymbolicName>
161+
<Export-Package>!com.datastax.oss.driver.shaded.guava.errorprone.*, !org.checkerframework.*, *</Export-Package>
162+
<Import-Package>javax.annotation.*;resolution:=optional;version="[3.0,4)", javax.crypto.*;resolution:=optional, sun.misc.*;resolution:=optional, !com.oracle.svm.*, !com.datastax.oss.driver.shaded.guava.errorprone.*, !org.checkerframework.*, *</Import-Package>
163+
</instructions>
164+
</configuration>
165+
</execution>
166+
</executions>
167+
</plugin>
168+
<plugin>
169+
<artifactId>maven-assembly-plugin</artifactId>
170+
<executions>
171+
<execution>
172+
<id>generate-final-shaded-jar</id>
173+
<phase>package</phase>
174+
<goals>
175+
<goal>single</goal>
176+
</goals>
177+
<configuration>
178+
<archive>
179+
<!-- this is the manifest generated by the bundle plugin -->
180+
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
181+
</archive>
182+
<descriptors>
183+
<descriptor>src/assembly/shaded-jar.xml</descriptor>
184+
</descriptors>
185+
<!-- Replace the original artifact -->
186+
<appendAssemblyId>false</appendAssemblyId>
187+
</configuration>
188+
</execution>
189+
</executions>
190+
</plugin>
191+
<plugin>
192+
<artifactId>maven-jar-plugin</artifactId>
193+
<executions>
194+
<execution>
195+
<id>empty-javadoc-jar</id>
196+
<goals>
197+
<goal>jar</goal>
198+
</goals>
199+
<configuration>
200+
<classifier>javadoc</classifier>
201+
<classesDirectory>${basedir}/src/main/javadoc</classesDirectory>
202+
</configuration>
203+
</execution>
204+
</executions>
205+
</plugin>
206+
<plugin>
207+
<groupId>org.revapi</groupId>
208+
<artifactId>revapi-maven-plugin</artifactId>
209+
<configuration>
210+
<skip>true</skip>
211+
</configuration>
212+
</plugin>
213+
</plugins>
214+
</build>
215+
</project>
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
20+
-->
21+
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
22+
<id>shaded-jar</id>
23+
<formats>
24+
<format>jar</format>
25+
</formats>
26+
<includeBaseDirectory>false</includeBaseDirectory>
27+
<fileSets>
28+
<!--
29+
Include everything from the shaded jar created with the shade plugin and
30+
unpacked by the dependency plugin
31+
-->
32+
<fileSet>
33+
<directory>${project.build.outputDirectory}</directory>
34+
<excludes>
35+
<exclude>META-INF/maven/org.apache.cassandra/java-driver-guava-shaded/pom.xml</exclude>
36+
</excludes>
37+
<outputDirectory/>
38+
</fileSet>
39+
</fileSets>
40+
<!-- Include the transformed pom with shaded deps created by the shade plugin -->
41+
<files>
42+
<file>
43+
<source>${project.basedir}/dependency-reduced-pom.xml</source>
44+
<outputDirectory>META-INF/maven/org.apache.cassandra/java-driver-guava-shaded</outputDirectory>
45+
<destName>pom.xml</destName>
46+
</file>
47+
</files>
48+
</assembly>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package com.google.common.primitives;
19+
20+
import com.oracle.svm.core.annotate.Alias;
21+
import com.oracle.svm.core.annotate.RecomputeFieldValue;
22+
import com.oracle.svm.core.annotate.Substitute;
23+
import com.oracle.svm.core.annotate.TargetClass;
24+
import java.util.Comparator;
25+
26+
@TargetClass(UnsignedBytes.LexicographicalComparatorHolder.class)
27+
final class LexicographicalComparatorHolderSubstitution {
28+
29+
@Alias
30+
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias)
31+
static Comparator<byte[]> BEST_COMPARATOR = UnsignedBytes.lexicographicalComparatorJavaImpl();
32+
33+
/* All known cases should be covered by the field substitution above... keeping this only
34+
* for sake of completeness */
35+
@Substitute
36+
static Comparator<byte[]> getBestComparator() {
37+
return UnsignedBytes.lexicographicalComparatorJavaImpl();
38+
}
39+
}

0 commit comments

Comments
 (0)