Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cindy-peng committed Jan 20, 2025
1 parent 57faf20 commit c90f911
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 58 deletions.
2 changes: 0 additions & 2 deletions .cloudbuild/samples_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ steps:
- 'JOB_TYPE=samples'
- 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-sample'
- 'KOKORO_GITHUB_PULL_REQUEST_NUMBER=$_PR_NUMBER'
- 'JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64'
- 'JAVA=/usr/lib/jvm/java-11-openjdk-amd64/bin/java'
- 'SUREFIRE_JVM_OPT=-Djvm=/usr/lib/jvm/java-11-openjdk-amd64/bin/java'
- name: gcr.io/cloud-devrel-public-resources/java8
entrypoint: echo
args: [
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
env:
JOB_TYPE: test
windows:
# Building using Java 8 and run the tests with Java 11 runtime
# Building using Java 11 and run the tests with Java 8 runtime
runs-on: windows-latest
steps:
- name: Support longpaths
Expand All @@ -69,12 +69,6 @@ jobs:
with:
java-version: 8
distribution: temurin
# - name: "Set Java system property environment variable for surefire plugin (unit tests)"
# # Maven surefire plugin (unit tests) allows us to specify JVM to run the tests.
# # https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
## run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV
# run: echo "JAVA=${JAVA_HOME}\bin\java" >> $GITHUB_ENV
# shell: bash
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}\bin\java" >> $GITHUB_ENV
shell: bash
Expand Down
17 changes: 3 additions & 14 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ cd ${scriptDir}/..
# include common functions
source ${scriptDir}/common.sh

# Kokoro integration test uses both JDK 11 and JDK 8. GraalVM dependencies
# require JDK 11 to compile the classes touching GraalVM classes.
if [ -n "${JAVA11_HOME}" ]; then
# Kokoro integration test uses both JDK 11 and JDK 8. Integration
# tests require JDK 11 to compile the classes.
if [ -n "${JAVA11_HOME}" && ! -z "${JAVA8_HOME}"]; then
setJava "${JAVA11_HOME}"
echo "Java: ${JAVA}"
fi


# Print out Maven & Java version
mvn -version
echo ${JOB_TYPE}
Expand Down Expand Up @@ -68,11 +66,6 @@ javadoc)
RETURN_CODE=$?
;;
integration)
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
echo "Java 11: ${JAVA11_HOME}"
echo "JAVA_HOME: ${JAVA_HOME}"
echo "Java: ${JAVA}"
echo "INTEGRATION_TEST_ARGS: ${INTEGRATION_TEST_ARGS}"
java -version
mvn -B ${INTEGRATION_TEST_ARGS} \
-ntp \
Expand All @@ -81,7 +74,6 @@ integration)
-Dclirr.skip=true \
-Denforcer.skip=true \
-fae \
${SUREFIRE_JVM_OPT} \
verify
RETURN_CODE=$?
;;
Expand All @@ -97,8 +89,6 @@ graalvm17)
;;
samples)
SAMPLES_DIR=samples
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
echo "Java 11: ${JAVA11_HOME}"
# only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise.
if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]]
then
Expand All @@ -119,7 +109,6 @@ samples)
-Dclirr.skip=true \
-Denforcer.skip=true \
-fae \
${SUREFIRE_JVM_OPT} \
verify
RETURN_CODE=$?
popd
Expand Down
3 changes: 0 additions & 3 deletions .kokoro/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ function msg() { println "$*" >&2; }
function println() { printf '%s\n' "$(now) $*"; }
function setJava() {
export JAVA=$1/bin/java
export JAVA_HOME=$1
export SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java
export PATH=${JAVA_HOME}/bin:$PATH
}

## Helper comment to trigger updated repo dependency release
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import com.google.cloud.datastore.DatastoreOptions;
import com.google.cloud.testing.BaseEmulatorHelper;
import com.google.common.collect.ImmutableList;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.FileVisitResult;
Expand Down Expand Up @@ -192,8 +190,8 @@ private LocalDatastoreHelper(Builder builder) {
if (builder.firestoreInDatastoreMode) {
binCommand.add("--firestore_in_datastore_mode");
} else {
// At most one of --consistency | --use-firestore-in-datastore-mode can be specified.
// --consistency will be ignored with --use-firestore-in-datastore-mode.
// At most one of --consistency | --firestore_in_datastore_mode can be specified.
// --consistency will be ignored with --firestore_in_datastore_mode.
binCommand.add(CONSISTENCY_FLAG + getConsistency());
}
binCommand.add(BIN_CMD_PORT_FLAG + getPort());
Expand Down Expand Up @@ -325,34 +323,6 @@ public static LocalDatastoreHelper create() {
*/
@Override
public void start() throws IOException, InterruptedException {
try {
// Run the gcloud --version command
Process process = Runtime.getRuntime().exec("gcloud --version");
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));

String line;
StringBuilder output = new StringBuilder();
while ((line = reader.readLine()) != null) {
output.append(line).append("\n");
}

// Check the exit code to see if the command was successful
int exitCode = process.waitFor();
if (exitCode == 0) {
System.out.println("gcloud is installed.\nVersion information:\n" + output);
LOGGER.info("gcloud is installed.\nVersion information:\n" + output);
} else {
System.err.println("gcloud is not installed or not in the PATH.");
LOGGER.severe("gcloud is not installed or not in the PATH.");
}

} catch (IOException | InterruptedException e) {
System.err.println("Error checking gcloud installation: " + e.getMessage());
LOGGER.severe("Error checking gcloud installation: " + e.getMessage());
}

String Java_version = System.getenv("JAVA");
LOGGER.info("java_evn Java: " + Java_version);
String blockUntilOutput = "Dev App Server is now running";
startProcess(blockUntilOutput);
}
Expand Down

0 comments on commit c90f911

Please sign in to comment.