Skip to content

Commit

Permalink
[ggj][bazel] feat: add microgenerator rules for cloud/asset (#381)
Browse files Browse the repository at this point in the history
* fix: support LRO package.name annotations

* feat: add microgenerator rules for cloud/asset

* fix: update CircleCI

* fix: update parser test method sig order

* fix: update circleci config

* fix: remove circleci store_artifacts for faster builds
  • Loading branch information
miraleung committed Oct 10, 2020
1 parent f365036 commit 65d80c9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
11 changes: 5 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
gapic-generator-java-tests:
working_directory: /tmp/
environment:
TEST_REPORTS_DIR: /tmp/workspace/bazel/reports/gapic-generator-java
TEST_REPORTS_DIR: ~/.cache/bazel
BAZEL_VERSION: 3.5.1
PYTHON_VERSION: 3.5.2
machine: true
Expand All @@ -28,21 +28,20 @@ jobs:
name: Make reports directory
command: |
mkdir -p ${TEST_REPORTS_DIR}
echo "Test reports will be stored in ${TEST_REPORTS_DIR}"
- run:
name: Build targets for gapic-generator-java
command: |
cd /tmp/gapic-generator-java
bazel --batch build //...
bazel --batch build //src/...
- run:
name: Run unit tests for gapic-generator-java
command: |
cd /tmp/gapic-generator-java
bazel --batch test //... --noshow_progress
bazel --batch test //src/test/... --noshow_progress
find . -type f -regex ".*/bazel-testlogs/.*xml" -exec cp {} ${TEST_REPORTS_DIR} \;
- store_test_results:
path: bazel/reports/gapic-generator-java
- store_artifacts:
path: bazel/reports/gapic-generator-java
path: ~/.cache/bazel
google-java-format:
docker:
- image: l.gcr.io/google/bazel
Expand Down
4 changes: 2 additions & 2 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fi
if [ $NUM_JAVA_FILES_CHANGED -gt 0 ] || [ $NUM_BAZEL_FILES_CHANGED -gt 0 ]
then
echo_status "Checking the build..."
bazel --batch build --disk_cache="$BAZEL_CACHE_DIR" //...
bazel --batch build --disk_cache="$BAZEL_CACHE_DIR" //src/...
BUILD_STATUS=$?
if [ $BUILD_STATUS != 0 ]
then
Expand All @@ -112,7 +112,7 @@ fi
if [ $NUM_JAVA_FILES_CHANGED -gt 0 ]
then
echo_status "Checking tests..."
bazel --batch test --disk_cache="$BAZEL_CACHE_DIR" //...
bazel --batch test --disk_cache="$BAZEL_CACHE_DIR" //src/test/...
TEST_STATUS=$?
if [ $TEST_STATUS != 0 ]
then
Expand Down
4 changes: 2 additions & 2 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def gapic_generator_java_repositories():
_maybe(
http_archive,
name = "com_google_googleapis",
strip_prefix = "googleapis-dbdd8ddeb6d9556952aa8784d9e48f2566c9911a",
strip_prefix = "googleapis-bda7ce951def5ae6e5c4258d0e569188dd4ae02b",
urls = [
"https://github.com/googleapis/googleapis/archive/dbdd8ddeb6d9556952aa8784d9e48f2566c9911a.zip",
"https://github.com/googleapis/googleapis/archive/bda7ce951def5ae6e5c4258d0e569188dd4ae02b.zip",
],
)

Expand Down
26 changes: 26 additions & 0 deletions test/integration/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package(default_visibility = ["//visibility:public"])

####################################################
# API Library Rules
####################################################
# These will eventually go away once more APIs in googleapis have been migrated to the microgenerator.

load(
"@com_google_googleapis_imports//:imports.bzl",
java_gapic_library = "java_gapic_library2",
)

java_gapic_library(
name = "asset_java_gapic",
srcs = ["@com_google_googleapis//google/cloud/asset/v1:asset_proto_with_info"],
grpc_service_config = "@com_google_googleapis//google/cloud/asset/v1:cloudasset_grpc_service_config.json",
package = "google.cloud.asset.v1",
test_deps = [
"@com_google_googleapis//google/cloud/asset/v1:asset_java_grpc",
"@com_google_googleapis//google/iam/v1:iam_java_grpc",
],
deps = [
"@com_google_googleapis//google/cloud/asset/v1:asset_java_proto",
"@com_google_googleapis//google/iam/v1:iam_java_proto",
],
)

0 comments on commit 65d80c9

Please sign in to comment.