Changes required for Harry build

Patch by Alex Petrov; reviewed by Marcus Eriksson for CASSANDRA-16102
This commit is contained in:
Alex Petrov 2020-09-03 16:00:31 +02:00
parent b936d3e95d
commit 0dc5bd51f5
6 changed files with 186 additions and 9 deletions

38
build-shaded-dtest-jar.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
set -xe
# Cassandra version that is specified in build.xml
CASSANDRA_VERSION=$1
# In-JVM dtest version that is specified in relocate-dependencies.pom
DTEST_VERSION=$2
ARTIFACT_NAME=cassandra-dtest
REPO_DIR=~/.m2/repository
ant clean
ant dtest-jar
# Install the version that will be shaded
mvn install:install-file \
-Dfile=./build/dtest-${CASSANDRA_VERSION}.jar \
-DgroupId=org.apache.cassandra \
-DartifactId=${ARTIFACT_NAME}-local \
-Dversion=${DTEST_VERSION} \
-Dpackaging=jar \
-DgeneratePom=true \
-DlocalRepositoryPath=${REPO_DIR}
# Create shaded artifact
mvn -f relocate-dependencies.pom package -DskipTests -nsu
# Deploy shaded artifact
mvn install:install-file \
-Dfile=./target/${ARTIFACT_NAME}-shaded-${DTEST_VERSION}.jar \
-DgroupId=org.apache.cassandra \
-DartifactId=${ARTIFACT_NAME}-shaded \
-Dversion=${DTEST_VERSION} \
-Dpackaging=jar \
-DgeneratePom=true \
-DlocalRepositoryPath=${REPO_DIR}
set +xe

View File

@ -583,7 +583,7 @@
<dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
<dependency groupId="com.github.jbellis" artifactId="jamm" version="${jamm.version}"/>
<dependency groupId="org.yaml" artifactId="snakeyaml" version="1.11"/>
<dependency groupId="org.yaml" artifactId="snakeyaml" version="1.23"/>
<dependency groupId="junit" artifactId="junit" version="4.12" />
<dependency groupId="org.mockito" artifactId="mockito-core" version="3.2.4" />
<dependency groupId="org.quicktheories" artifactId="quicktheories" version="0.25" />

Binary file not shown.

BIN
lib/snakeyaml-1.23.jar Normal file

Binary file not shown.

132
relocate-dependencies.pom Normal file
View File

@ -0,0 +1,132 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-dtest-shaded</artifactId>
<version>4.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Cassandra in-jvm dtests shaded jar</name>
<properties>
<project.type>library</project.type>
<java.version>1.8</java.version>
<test.source.directory>src/test/unit/java</test.source.directory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<junit.version>4.12</junit.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-dtest-local</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testSourceDirectory>${test.source.directory}</testSourceDirectory>
<plugins>
<!-- generate a shaded JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<createSourcesJar>false</createSourcesJar>
<artifactSet>
<includes>
<include>org.apache.cassandra:cassandra-dtest-local</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>relocated.shaded.io.netty</shadedPattern>
</relocation>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>relocated.shaded.com.google</shadedPattern>
</relocation>
<relocation>
<pattern>com.datastax</pattern>
<shadedPattern>relocated.shaded.com.datastax</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/Log4j2Plugins.dat</exclude>
</excludes>
</filter>
<filter>
<artifact>io.netty:netty-*</artifact>
<excludes>
<exclude>META-INF/maven/</exclude>
<exclude>META-INF/io.netty.versions.properties</exclude>
</excludes>
</filter>
<filter>
<artifact>com.google.guava:guava</artifact>
<excludes>
<exclude>META-INF/maven/</exclude>
</excludes>
</filter>
<filter>
<artifact>com.google.guava:failureaccess</artifact>
<excludes>
<exclude>META-INF/maven/</exclude>
</excludes>
</filter>
<filter>
<artifact>com.datastax.cassandra:cassandra-driver-core</artifact>
<excludes>
<exclude>META-INF/maven/</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -22,7 +22,9 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@ -146,11 +148,12 @@ public class YamlConfigurationLoader implements ConfigurationLoader
@Override
protected List<Object> createDefaultList(int initSize)
{
return Lists.newCopyOnWriteArrayList();
}
@Override
protected Map<Object, Object> createDefaultMap()
protected Map<Object, Object> createDefaultMap(int initSize)
{
return Maps.newConcurrentMap();
}
@ -160,12 +163,6 @@ public class YamlConfigurationLoader implements ConfigurationLoader
{
return Sets.newConcurrentHashSet();
}
@Override
protected Set<Object> createDefaultSet()
{
return Sets.newConcurrentHashSet();
}
}
private Config loadConfig(Yaml yaml, byte[] configBytes)
@ -192,7 +189,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader
}
@Override
public Property getProperty(Class<? extends Object> type, String name) throws IntrospectionException
public Property getProperty(Class<? extends Object> type, String name)
{
final Property result = super.getProperty(type, name);
@ -224,6 +221,16 @@ public class YamlConfigurationLoader implements ConfigurationLoader
{
return result.get(object);
}
public List<Annotation> getAnnotations()
{
return Collections.EMPTY_LIST;
}
public <A extends Annotation> A getAnnotation(Class<A> aClass)
{
return null;
}
};
}