Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update dependencies com.coveo:fmt-mvn-plugin and com.google.goo… #1525

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/scripts/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# Copyright 2022 Google LLC
#
# Licensed 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.

function determineMavenOpts() {
local javaVersion=$(
# filter down to the version line, then pull out the version between quotes,
# then trim the version number down to its minimal number (removing any
# update or suffix number).
java -version 2>&1 | grep "version" \
| sed -E 's/^.*"(.*?)".*$/\1/g' \
| sed -E 's/^(1\.[0-9]\.0).*$/\1/g'
)

# Workaround for google-java-format to work on java 17+
if [[ $javaVersion == 17* ]]
then
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
fi
}
7 changes: 7 additions & 0 deletions .github/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ function setJava() {
export PATH=${JAVA_HOME}/bin:$PATH
}

scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

# include common functions
source ${scriptDir}/common.sh

export MAVEN_OPTS=$(determineMavenOpts)

if [[ $OSTYPE == 'darwin'* ]]; then
# Add alias for 127.0.0.2 to be used as a loopback address
# https://superuser.com/questions/458875/how-do-you-get-loopback-addresses-other-than-127-0-0-1-to-work-on-os-x
Expand Down
7 changes: 7 additions & 0 deletions .github/scripts/run_tests_graalvm_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
# `-e` enables the script to automatically fail when a command fails
set -e

scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

# include common functions
source ${scriptDir}/common.sh

export MAVEN_OPTS=$(determineMavenOpts)

echo -e "******************** Installing modules... ********************\n"
mvn -e -B install -DskipTests
echo -e "******************** Installation complete. ********************\n"
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ jobs:
distribution: 'zulu'
java-version: '17'
- name: lint
run: mvn -B compile -Plint
run: .kokoro/build.sh
shell: bash
env:
JOB_TYPE: lint
2 changes: 2 additions & 0 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ source ${scriptDir}/common.sh
mvn -version
echo ${JOB_TYPE}

export MAVEN_OPTS=$(determineMavenOpts)

# attempt to install 3 times with exponential backoff (starting with 10 seconds)
retry_with_backoff 3 10 \
mvn install -B -V -ntp \
Expand Down
21 changes: 21 additions & 0 deletions .kokoro/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,24 @@ function msg() { println "$*" >&2; }
function println() { printf '%s\n' "$(now) $*"; }

## Helper comment to trigger updated repo dependency release

function determineMavenOpts() {
local javaVersion=$(
# filter down to the version line, then pull out the version between quotes,
# then trim the version number down to its minimal number (removing any
# update or suffix number).
java -version 2>&1 | grep "version" \
| sed -E 's/^.*"(.*?)".*$/\1/g' \
| sed -E 's/^(1\.[0-9]\.0).*$/\1/g'
)

# Workaround for google-java-format to work on java 17+
if [[ $javaVersion == 17* ]]
then
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"
echo -n " --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
fi
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ class RetryingCallable<T> implements Callable<T> {

/** The callable that should be retried. */
private final Callable<T> callable;

/** The number of times to attempt to retry. */
private final int retryCount;

/** The duration to sleep after a failed retry attempt. */
private final Duration sleepDuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public class SqlAdminApiFetcherTest {

@Test
public void testFetchInstanceData_returnsIpAddresses()
throws ExecutionException, InterruptedException, GeneralSecurityException,
throws ExecutionException,
InterruptedException,
GeneralSecurityException,
OperatorCreationException {
MockAdminApi mockAdminApi = buildMockAdminApi(INSTANCE_CONNECTION_NAME, DATABASE_VERSION);
SqlAdminApiFetcher fetcher =
Expand All @@ -70,7 +72,9 @@ public void testFetchInstanceData_returnsIpAddresses()

@Test
public void testFetchInstanceData_returnsPscForNonIpDatabase()
throws ExecutionException, InterruptedException, GeneralSecurityException,
throws ExecutionException,
InterruptedException,
GeneralSecurityException,
OperatorCreationException {

MockAdminApi mockAdminApi = new MockAdminApi();
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.9</version>
<version>2.13</version>
<executions>
<execution>
<phase>compile</phase>
Expand All @@ -229,7 +229,7 @@
<dependency>
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format</artifactId>
<version>1.7</version>
<version>1.17.0</version>
</dependency>
</dependencies>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class GcpConnectionFactoryProviderPostgres extends GcpConnectionFactoryPr

/** Postgres driver option value. */
private static final String POSTGRESQL_DRIVER = "postgresql";

/** Legacy postgres driver option value. */
private static final String LEGACY_POSTGRESQL_DRIVER = "postgres";

Expand Down
Loading