Skip to content

Commit

Permalink
Merge branch 'master' into 819-failToParseLargeString
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jl authored Feb 7, 2024
2 parents f7ee95c + 84b1777 commit 9605388
Show file tree
Hide file tree
Showing 22 changed files with 381 additions and 166 deletions.
36 changes: 32 additions & 4 deletions FIPS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,7 @@
<exclude>META-INF/DEPENDENCIES</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/services/com.fasterxml.*</exclude>
<!-- jackson became a multi-release JAR since 2.15.x -->
<!-- will need to exclude META-INF/versions/17 and META-INF/versions/19 until we move to newer Java versions -->
<exclude>META-INF/versions/17/**</exclude>
<exclude>META-INF/versions/19/**</exclude>
<exclude>META-INF/versions/9/module-info.*</exclude>
<exclude>META-INF/*.xml</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
Expand Down Expand Up @@ -618,6 +615,37 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- relocate the META-INF/versions files manually due to the maven bug -->
<!-- https://issues.apache.org/jira/browse/MSHADE-406 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>repack</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
<configuration>
<target>
<unzip dest="${project.build.directory}/relocate" src="${project.build.directory}/${project.build.finalName}.jar"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/17/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/19/${relocationBase}"/>
<!-- com.fasterxml.* packages are relocated to ${relocationBase}.fasterxml.* -->
<move file="${project.build.directory}/relocate/META-INF/versions/11/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/17/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/17/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/19/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/19/${relocationBase}"/>
<zip basedir="${project.build.directory}/relocate" destfile="${project.build.directory}/${project.build.finalName}.jar"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/17/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/19/${relocationBase}"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
1 change: 0 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ timestamps {
'RT-LanguageJDBC2-PC' : "Test JDBC 2 - $jdk",
'RT-LanguageJDBC3-PC' : "Test JDBC 3 - $jdk",
'RT-LanguageJDBC4-PC' : "Test JDBC 4 - $jdk",
'RT-LanguageJDBC-CodeCoverage-PC' : "CodeCoverage JDBC - $jdk"
].collect { jobToRun, runName ->
return new JdbcJobDefinition(
jdk: jdk,
Expand Down
59 changes: 44 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Installation

Maven
-----
Add following code block as a dependency
Add following dependency for fat-jar

.. code-block:: xml
Expand All @@ -35,6 +35,25 @@ Add following code block as a dependency
<version>{version}</version>
</dependency>
or for FIPS compliant fat-jar

.. code-block:: xml
<dependency>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc-fips</artifactId>
<version>{version}</version>
</dependency>
or for experimental thin-jar

.. code-block:: xml
<dependency>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc-thin</artifactId>
<version>{version}</version>
</dependency>
Build from Source Code
----------------------
Expand All @@ -44,11 +63,33 @@ Build from Source Code
git clone https://github.com/snowflakedb/snowflake-jdbc.git
2. Build the driver by running:
2. Build the fat-jar and install it in local maven repository by running:

.. code-block:: bash
mvn install
./mvnw clean verify
./mvnw org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file -Dfile=target/snowflake-jdbc.jar -DpomFile=./public_pom.xml
3. Build the FIPS compliant fat-jar and install it in local maven repository by running:

.. code-block:: bash
cd FIPS
../mvnw clean verify
../mvnw org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file -Dfile=target/snowflake-jdbc-fips.jar -DpomFile=./public_pom.xml
cd -
4. Build the experimental thin-jar and install it in local maven repository by running:

.. code-block:: bash
./mvnw clean verify -Dnot-self-contained-jar -Dthin-jar
./mvnw org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file -Dfile=target/snowflake-jdbc-thin.jar -DpomFile=./thin_public_pom.xml -Dnot-self-contained-jar -Dthin-jar
- ``thin-jar`` enables thin jar profile
- ``not-self-contained-jar`` turns off fat jar profile (enabled by default)

5. **Note that the built dependencies are installed with version 1.0-SNAPSHOT**

Usage
=====
Expand Down Expand Up @@ -111,18 +152,6 @@ You may import the coding style from IntelliJ so that the coding style can be ap
- Enable `google-java-format` for the JDBC project.
- In the source code window, select **Code** -> **Reformat** to apply the coding style.

Thin Jar
========

To build a thin jar run command:

.. code-block:: bash
mvn clean verify -Dthin-jar -Dnot-self-contained-jar
- `thin-jar` enables thin jar profile
- `not-self-contained-jar` turns off fat jar profile (enabled by default)

Tests
=====

Expand Down
8 changes: 4 additions & 4 deletions TestOnly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>4.9.0</version>
<scope>provided</scope>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
Expand Down
5 changes: 5 additions & 0 deletions ci/scripts/check_content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{prin
echo "[ERROR] JDBC jar includes class not under the snowflake namespace"
exit 1
fi

if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{print $8}' | grep -E "^META-INF/versions/.*.class" | grep -v -E "^META-INF/versions/.*/(net|com)/snowflake"; then
echo "[ERROR] JDBC jar includes multi release classes not under the snowflake namespace"
exit 1
fi
97 changes: 41 additions & 56 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@
<sortDependencyExclusions>groupId,artifactId</sortDependencyExclusions>
<sortExecutions>true</sortExecutions>
<sortModules>true</sortModules>
<sortPlugins>groupId,artifactId</sortPlugins>
<sortProperties>true</sortProperties>
<verifyFail>stop</verifyFail>
<verifyFailOn>strict</verifyFailOn>
Expand Down Expand Up @@ -609,33 +608,6 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- relocate the META-INF/versions files manually due to the maven bug -->
<!-- https://issues.apache.org/jira/browse/MSHADE-406 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>repack</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
<configuration>
<target>
<unzip dest="${project.build.directory}/relocate" src="${project.build.directory}/${project.build.finalName}.jar"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/9/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
<zip basedir="${project.build.directory}/relocate" destfile="${project.build.directory}/${project.build.finalName}.jar"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/9/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- google linkage checker doesn't work well with shaded jar, disable the check in this case for now -->
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -697,7 +669,6 @@
<exclude>META-INF/NOTICE*</exclude>
<exclude>META-INF/DEPENDENCIES</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/services/com.fasterxml.*</exclude>
<exclude>META-INF/*.xml</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
Expand Down Expand Up @@ -781,33 +752,6 @@
</activation>
<build>
<plugins>
<plugin>
<!-- relocate the META-INF/versions files manually due to the maven bug -->
<!-- https://issues.apache.org/jira/browse/MSHADE-406 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>repack</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
<configuration>
<target>
<unzip dest="${project.build.directory}/relocate" src="${project.build.directory}/${project.build.finalName}.jar"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/9/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
<zip basedir="${project.build.directory}/relocate" destfile="${project.build.directory}/${project.build.finalName}.jar"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/9/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- google linkage checker doesn't work well with shaded jar, disable the check in this case for now -->
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -1010,6 +954,7 @@
<exclude>META-INF/DEPENDENCIES</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/services/com.fasterxml.*</exclude>
<exclude>META-INF/versions/9/module-info.*</exclude>
<exclude>META-INF/*.xml</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
Expand Down Expand Up @@ -1059,6 +1004,46 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- relocate the META-INF/versions files manually due to the maven bug -->
<!-- https://issues.apache.org/jira/browse/MSHADE-406 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>repack</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
<configuration>
<target>
<unzip dest="${project.build.directory}/relocate" src="${project.build.directory}/${project.build.finalName}.jar"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/9/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/17/${relocationBase}"/>
<mkdir dir="${project.build.directory}/relocate/META-INF/versions/19/${relocationBase}"/>
<!-- org.bouncycastle.* packages are relocated to ${relocationBase}.org.bouncycastle.* -->
<move file="${project.build.directory}/relocate/META-INF/versions/9/org" todir="${project.build.directory}/relocate/META-INF/versions/9/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/11/org" todir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/15/org" todir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
<!-- com.fasterxml.* packages are relocated to ${relocationBase}.fasterxml.* -->
<move file="${project.build.directory}/relocate/META-INF/versions/11/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/17/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/17/${relocationBase}"/>
<move file="${project.build.directory}/relocate/META-INF/versions/19/com/fasterxml" todir="${project.build.directory}/relocate/META-INF/versions/19/${relocationBase}"/>
<zip basedir="${project.build.directory}/relocate" destfile="${project.build.directory}/${project.build.finalName}.jar"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/9/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/11/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/15/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/17/${relocationBase}"/>
<delete dir="${project.build.directory}/relocate/META-INF/versions/19/${relocationBase}"/>
</target>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
Expand Down
Loading

0 comments on commit 9605388

Please sign in to comment.