-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
1 parent
7877837
commit 3ef49df
Showing
15 changed files
with
351 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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 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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.apache.cassandra</groupId> | ||
<artifactId>java-driver-parent</artifactId> | ||
<version>4.18.2-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>java-driver-guava-shaded</artifactId> | ||
<name>Apache Cassandra Java Driver - guava shaded dep</name> | ||
<description>Shaded Guava artifact for use in the Java driver for Apache Cassandra®</description> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>com.google.code.findbugs</groupId> | ||
<artifactId>jsr305</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.checkerframework</groupId> | ||
<artifactId>checker-qual</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>com.google.errorprone</groupId> | ||
<artifactId>error_prone_annotations</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>com.google.j2objc</groupId> | ||
<artifactId>j2objc-annotations</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>animal-sniffer-annotations</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.graalvm.nativeimage</groupId> | ||
<artifactId>svm</artifactId> | ||
<version>20.0.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>shade-guava-dependency</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<artifactSet> | ||
<includes> | ||
<include>org.apache.cassandra:java-driver-guava-shaded</include> | ||
<include>com.google.guava:guava</include> | ||
</includes> | ||
</artifactSet> | ||
<relocations> | ||
<relocation> | ||
<pattern>com.google</pattern> | ||
<shadedPattern>com.datastax.oss.driver.shaded.guava</shadedPattern> | ||
</relocation> | ||
</relocations> | ||
<filters> | ||
<filter> | ||
<artifact>com.google.guava:*</artifact> | ||
<excludes> | ||
<exclude>META-INF/**</exclude> | ||
</excludes> | ||
</filter> | ||
</filters> | ||
<createSourcesJar>true</createSourcesJar> | ||
<shadeSourcesContent>true</shadeSourcesContent> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>clean-classes</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>clean</goal> | ||
</goals> | ||
<configuration> | ||
<directory>${project.build.outputDirectory}</directory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>unpack-shaded-classes</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>unpack</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${project.build.outputDirectory}</outputDirectory> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>org.apache.cassandra</groupId> | ||
<artifactId>java-driver-guava-shaded</artifactId> | ||
<version>${project.version}</version> | ||
<type>jar</type> | ||
</artifactItem> | ||
</artifactItems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
<!-- | ||
Using later version of the plugin will scan all dynamically loaded classes | ||
with Class.forName(). In the end, more packages will be imported in MANIFEST.MF | ||
and OSGi integration tests will break. | ||
--> | ||
<version>3.5.0</version> | ||
<extensions>true</extensions> | ||
<executions> | ||
<execution> | ||
<id>generate-shaded-manifest</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>manifest</goal> | ||
</goals> | ||
<configuration> | ||
<instructions> | ||
<Bundle-SymbolicName>com.datastax.oss.driver.shaded.guava</Bundle-SymbolicName> | ||
<Export-Package>!com.datastax.oss.driver.shaded.guava.errorprone.*, !org.checkerframework.*, *</Export-Package> | ||
<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> | ||
</instructions> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>generate-final-shaded-jar</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<configuration> | ||
<archive> | ||
<!-- this is the manifest generated by the bundle plugin --> | ||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||
</archive> | ||
<descriptors> | ||
<descriptor>src/assembly/shaded-jar.xml</descriptor> | ||
</descriptors> | ||
<!-- Replace the original artifact --> | ||
<appendAssemblyId>false</appendAssemblyId> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>empty-javadoc-jar</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
<configuration> | ||
<classifier>javadoc</classifier> | ||
<classesDirectory>${basedir}/src/main/javadoc</classesDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.revapi</groupId> | ||
<artifactId>revapi-maven-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<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"> | ||
<id>shaded-jar</id> | ||
<formats> | ||
<format>jar</format> | ||
</formats> | ||
<includeBaseDirectory>false</includeBaseDirectory> | ||
<fileSets> | ||
<!-- | ||
Include everything from the shaded jar created with the shade plugin and | ||
unpacked by the dependency plugin | ||
--> | ||
<fileSet> | ||
<directory>${project.build.outputDirectory}</directory> | ||
<excludes> | ||
<exclude>META-INF/maven/org.apache.cassandra/java-driver-guava-shaded/pom.xml</exclude> | ||
</excludes> | ||
<outputDirectory/> | ||
</fileSet> | ||
</fileSets> | ||
<!-- Include the transformed pom with shaded deps created by the shade plugin --> | ||
<files> | ||
<file> | ||
<source>${project.basedir}/dependency-reduced-pom.xml</source> | ||
<outputDirectory>META-INF/maven/org.apache.cassandra/java-driver-guava-shaded</outputDirectory> | ||
<destName>pom.xml</destName> | ||
</file> | ||
</files> | ||
</assembly> |
39 changes: 39 additions & 0 deletions
39
...c/main/java/com/google/common/primitives/LexicographicalComparatorHolderSubstitution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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. | ||
*/ | ||
package com.google.common.primitives; | ||
|
||
import com.oracle.svm.core.annotate.Alias; | ||
import com.oracle.svm.core.annotate.RecomputeFieldValue; | ||
import com.oracle.svm.core.annotate.Substitute; | ||
import com.oracle.svm.core.annotate.TargetClass; | ||
import java.util.Comparator; | ||
|
||
@TargetClass(UnsignedBytes.LexicographicalComparatorHolder.class) | ||
final class LexicographicalComparatorHolderSubstitution { | ||
|
||
@Alias | ||
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias) | ||
static Comparator<byte[]> BEST_COMPARATOR = UnsignedBytes.lexicographicalComparatorJavaImpl(); | ||
|
||
/* All known cases should be covered by the field substitution above... keeping this only | ||
* for sake of completeness */ | ||
@Substitute | ||
static Comparator<byte[]> getBestComparator() { | ||
return UnsignedBytes.lexicographicalComparatorJavaImpl(); | ||
} | ||
} |
Oops, something went wrong.