Skip to content

Commit

Permalink
Revert "feat: Use gapic-generator-java jar in the client library gene…
Browse files Browse the repository at this point in the history
…ration process (#918)"

This reverts commit 0051f49.
  • Loading branch information
lqiu96 committed Jan 10, 2023
1 parent ce4ea3b commit 0484f9a
Show file tree
Hide file tree
Showing 11 changed files with 554 additions and 94 deletions.
6 changes: 3 additions & 3 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ fi
if [ $NUM_JAVA_FILES_CHANGED -gt 0 ]
then
echo_status "Running Java linter..."
mvn fmt:check
bazel --batch run --disk_cache="$BAZEL_CACHE_DIR" //:google_java_format_verification
FORMAT_STATUS=$?
if [ $FORMAT_STATUS != 0 ]
then
echo_error "Linting failed." "Please run mvn fmt:format and try again."
echo_error "Linting failed." "Please run :google_java_format and try again."
exit 1
fi
fi
Expand All @@ -118,7 +118,7 @@ fi
if [ $NUM_JAVA_FILES_CHANGED -gt 0 ] || [ $NUM_UNIT_GOLDEN_FILES_CHANGED -gt 0 ]
then
echo_status "Checking unit tests..."
mvn test
bazel --batch test //:units --disk_cache="$BAZEL_CACHE_DIR"
TEST_STATUS=$?
if [ $TEST_STATUS != 0 ]
then
Expand Down
78 changes: 26 additions & 52 deletions .github/workflows/ci-maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: ci-maven
env:
SHOWCASE_VERSION: 0.25.0
jobs:
build:
units:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -22,34 +22,11 @@ jobs:
- run: java -version
- name: Unit Tests
run: |
mvn install --batch-mode --no-transfer-progress -Dcheckstyle.skip \
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip
- run: bazelisk version
- name: Integration Tests
run: |
bazel --batch test //test/integration/...
- name: Gradle Build Generated Storage Client Library
run: |
echo "Building Storage lib from generated source..."
mkdir /tmp/java-storage
bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
pushd /tmp/java-storage/google-cloud-storage-v2-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
- name: Gradle Build Generated Compute Client Library
run: |
echo "Building Compute lib from generated source..."
mkdir /tmp/java-compute
bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
build-java8-except-gapic-generator-java:
name: "build(8) except for gapic-generator-java"
units-java8:
name: "units (8) except gapic-generator-java"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -88,8 +65,8 @@ jobs:
-Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false \
-Dfmt.skip
build-java8-gapic-generator-java:
name: "build(8) for gapic-generator-java"
units-java8-gapic-generator-java:
name: "units (8) for gapic-generator-java"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -112,29 +89,6 @@ jobs:
shell: bash
run: |
mvn -V -B -ntp surefire:test --projects 'gapic-generator-java'
- run: bazelisk version
- name: Integration Tests
run: |
bazelisk --batch test //test/integration/...
- name: Gradle Build Generated Storage Client Library
run: |
echo "Building Storage lib from generated source..."
mkdir /tmp/java-storage
bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
pushd /tmp/java-storage/google-cloud-storage-v2-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
- name: Gradle Build Generated Compute Client Library
run: |
echo "Building Compute lib from generated source..."
mkdir /tmp/java-compute
bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -162,6 +116,26 @@ jobs:
java-version: ${{ matrix.java }}
distribution: temurin
- run: java -version

- name: Bazel File Cache Setup
id: cache-bazel
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ hashFiles('WORKSPACE') }}
restore-keys: ${{ runner.os }}-
- name: Bazel Cache Not Found
if: steps.cache-bazel.outputs.cache-hit != 'true'
run: |
echo "No cache found."
- name: Bazel Cache Found
if: steps.cache-bazel.outputs.cache-hit == 'true'
run: |
echo -n "Cache found. Cache size: "
du -sh ~/.cache/bazel
echo "If the cache seems broken, update the root WORKSPACE file with a trivial change."
echo "The old cache will disappear after 7 days."
- name: Install maven modules
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
Expand Down
115 changes: 115 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
on:
push:
branches:
- main
pull_request:
name: ci
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 8, 11 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
- run: java -version
- run: bazelisk version
- name: Bazel File Cache Setup
id: cache-bazel
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ hashFiles('WORKSPACE') }}
restore-keys: ${{ runner.os }}-
- name: Bazel Cache Not Found
if: steps.cache-bazel.outputs.cache-hit != 'true'
run: |
echo "No cache found."
- name: Bazel Cache Found
if: steps.cache-bazel.outputs.cache-hit == 'true'
run: |
echo -n "Cache found. Cache size: "
du -sh ~/.cache/bazel
echo "If the cache seems broken, update the root WORKSPACE file with a trivial change."
echo "The old one will disappear after 7 days."
- name: Integration Tests
run: bazelisk --batch test //test/integration/...

- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: test-artifacts
path: ~/.cache/bazel/*/*/*/gapic_generator_java/bazel-out/*/testlogs/*
retention-days: 5

generate-client-libraries:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 8, 11 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
- run: java -version
- run: bazelisk version
- name: Bazel File Cache Setup
id: cache-bazel
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ hashFiles('WORKSPACE') }}
restore-keys: ${{ runner.os }}-
- name: Bazel Cache Not Found
if: steps.cache-bazel.outputs.cache-hit != 'true'
run: |
echo "No cache found."
- name: Bazel Cache Found
if: steps.cache-bazel.outputs.cache-hit == 'true'
run: |
echo -n "Cache found. Cache size: "
du -sh ~/.cache/bazel
echo "If the cache seems broken, update the root WORKSPACE file with a trivial change."
echo "The old cache will disappear after 7 days."
- name: Gradle Build Generated Storage Client Library
run: |
echo "Building Storage lib from generated source..."
mkdir /tmp/java-storage
bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
pushd /tmp/java-storage/google-cloud-storage-v2-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
- name: Gradle Build Generated Compute Client Library
run: |
echo "Building Compute lib from generated source..."
mkdir /tmp/java-compute
bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
license-header:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '^1.13.1'
- name: License Header Check
run: |
go install github.com/google/addlicense@latest
addlicense -c "Google LLC" -l apache -check $(find $PWD -type f -name '*.java' ! -path '**/showcase/**' ! -iname '*PlaceholderFile.java')
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ target/

# Vscode Settings
.vscode/settings.json

*.iml
Loading

0 comments on commit 0484f9a

Please sign in to comment.