Skip to content

Commit

Permalink
Merge branch 'main' into renovate/grpc-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
alicejli committed Feb 13, 2024
2 parents b1a476c + 3c5284a commit 4aae265
Show file tree
Hide file tree
Showing 181 changed files with 5,118 additions and 3,008 deletions.
1 change: 1 addition & 0 deletions .github/snippet-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ignoreFiles:
- src/test/**
- test/**
- showcase/**
- library_generation/owlbot/templates/java_library/samples/install-without-bom/pom.xml
65 changes: 37 additions & 28 deletions .github/workflows/verify_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ jobs:
strategy:
matrix:
java: [ 11 ]
os: [ ubuntu-22.04, macos-12 ]
post_processing: [ 'true', 'false' ]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
Expand Down Expand Up @@ -44,36 +42,15 @@ jobs:
set -ex
pushd library_generation
pip install -r requirements.in
pip install .
popd
- name: install utils (macos)
if: matrix.os == 'macos-12'
shell: bash
run: |
brew update --preinstall
# we need the `realpath` command to be available
brew install coreutils
- name: install docker (ubuntu)
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
set -x
# install docker
sudo apt install containerd -y
sudo apt install -y docker.io docker-compose
# launch docker
sudo systemctl start docker
- name: Run integration tests
# we don't run ITs with postprocessing on macos because one of its dependencies "synthtool" is designed to run on linux only
if: matrix.os == 'ubuntu-22.04' || matrix.post_processing == 'false'
shell: bash
run: |
set -x
git config --global user.email "github-workflow@github.com"
git config --global user.name "Github Workflow"
library_generation/test/generate_library_integration_test.sh \
--googleapis_gen_url https://cloud-java-bot:${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}@github.com/googleapis/googleapis-gen.git \
--enable_postprocessing "${{ matrix.post_processing }}"
python -m unittest library_generation/test/integration_tests.py
unit_tests:
strategy:
matrix:
Expand All @@ -98,6 +75,21 @@ jobs:
pushd library_generation
pip install -r requirements.in
popd
- name: install synthtool
shell: bash
run: |
set -ex
mkdir -p /tmp/synthtool
pushd /tmp/synthtool
if [ ! -d "synthtool" ]; then
git clone https://github.com/googleapis/synthtool.git
fi
pushd "synthtool"
git reset --hard origin/no-java-templates
python3 -m pip install -e .
python3 -m pip install -r requirements.in
- name: Run shell unit tests
run: |
set -x
Expand All @@ -106,7 +98,7 @@ jobs:
run: |
set -x
python -m unittest library_generation/test/unit_tests.py
lint:
lint-shell:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
Expand All @@ -116,3 +108,20 @@ jobs:
scandir: 'library_generation'
format: tty
severity: error
lint-python:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: install python dependencies
shell: bash
run: |
set -ex
pushd library_generation
pip install -r requirements.in
popd
- name: Lint
shell: bash
run: |
# exclude generated golden files
# exclude owlbot until further refaction
black --check library_generation --exclude "(library_generation/test/resources/goldens)"
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ target/

# Python
**/__pycache__/
.venv

# library generation
output/
library_generation/output/
showcase/scripts/output/
**/output/
**/googleapis
library_generation/test/**/golden*/
library_generation/test/resources/test_repo_level_postprocess/
**/*egg-info/
**/build/
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,6 @@ private List<MethodDefinition> createDefaultGetterMethods(Service service, TypeS
"defaultApiClientHeaderProviderBuilder",
TypeNode.withReference(
ConcreteReference.withClazz(ApiClientHeaderProvider.Builder.class)))
.setAnnotations(
Arrays.asList(
AnnotationNode.builder()
.setType(FIXED_TYPESTORE.get("BetaApi"))
.setDescription(
"The surface for customizing headers is not stable yet and may"
+ " change in the future.")
.build()))
.build());
return javaMethods;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,7 @@ protected MethodDefinition createApiClientHeaderProviderBuilderMethod(
.setReturnType(returnType)
.build();

AnnotationNode annotation =
AnnotationNode.builder()
.setType(FIXED_TYPESTORE.get("BetaApi"))
.setDescription(
"The surface for customizing headers is not stable yet and may change in the"
+ " future.")
.build();
return MethodDefinition.builder()
.setAnnotations(Arrays.asList(annotation))
.setScope(ScopeNode.PUBLIC)
.setIsStatic(true)
.setReturnType(returnType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,6 @@ public void createSimpleMessage_containsMessagesEnumsAndResourceName() {
"EchoRequest.newBuilder().setName("
+ "FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())"
+ ".setParent(FoobarName.ofProjectFoobarName(\"[PROJECT]\", \"[FOOBAR]\").toString())"
+ ".setRequestId(\"requestId693933066\")"
+ ".setSecondRequestId(\"secondRequestId344404470\")"
+ ".setThirdRequestId(true)"
+ ".setFourthRequestId(\"fourthRequestId-2116417776\")"
+ ".setFifthRequestId(\"fifthRequestId959024147\")"
+ ".setSixthRequestId(\"sixthRequestId1005218260\")"
+ ".setSeverity(Severity.forNumber(0))"
+ ".setFoobar(Foobar.newBuilder().build()).build()",
writerVisitor.write());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,14 @@ public void generateGrpcServiceStubClass_createBatchingCallable() {
Assert.assertGoldenClass(this.getClass(), clazz, "GrpcLoggingStub.golden");
Assert.assertEmptySamples(clazz.samples());
}

@Test
public void generateGrpcServiceStubClass_autopopulateField() {
GapicContext context = GrpcTestProtoLoader.instance().parseAutoPopulateFieldTesting();
Service service = context.services().get(0);
GapicClass clazz = GrpcServiceStubClassComposer.instance().generate(context, service);

Assert.assertGoldenClass(this.getClass(), clazz, "GrpcAutoPopulateFieldStub.golden");
Assert.assertEmptySamples(clazz.samples());
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.google.testdata.v1;

import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
Expand Down Expand Up @@ -109,7 +108,6 @@ public class DeprecatedServiceSettings extends ClientSettings<DeprecatedServiceS
return DeprecatedServiceStubSettings.defaultTransportChannelProvider();
}

@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
return DeprecatedServiceStubSettings.defaultApiClientHeaderProviderBuilder();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.google.testdata.v1.stub;

import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GaxProperties;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
Expand Down Expand Up @@ -148,7 +147,6 @@ public class DeprecatedServiceStubSettings extends StubSettings<DeprecatedServic
return defaultGrpcTransportProviderBuilder().build();
}

@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,6 @@ public class EchoClient implements BackgroundResource {
* EchoRequest.newBuilder()
* .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setRequestId("requestId693933066")
* .setSecondRequestId("secondRequestId344404470")
* .setThirdRequestId(true)
* .setFourthRequestId("fourthRequestId-2116417776")
* .setFifthRequestId("fifthRequestId959024147")
* .setSixthRequestId("sixthRequestId1005218260")
* .setSeverity(Severity.forNumber(0))
* .setFoobar(Foobar.newBuilder().build())
* .build();
Expand Down Expand Up @@ -552,12 +546,6 @@ public class EchoClient implements BackgroundResource {
* EchoRequest.newBuilder()
* .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setRequestId("requestId693933066")
* .setSecondRequestId("secondRequestId344404470")
* .setThirdRequestId(true)
* .setFourthRequestId("fourthRequestId-2116417776")
* .setFifthRequestId("fifthRequestId959024147")
* .setSixthRequestId("sixthRequestId1005218260")
* .setSeverity(Severity.forNumber(0))
* .setFoobar(Foobar.newBuilder().build())
* .build();
Expand All @@ -583,11 +571,7 @@ public class EchoClient implements BackgroundResource {
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (EchoClient echoClient = EchoClient.create()) {
* ExpandRequest request =
* ExpandRequest.newBuilder()
* .setContent("content951530617")
* .setInfo("info3237038")
* .setRequestId("requestId693933066")
* .build();
* ExpandRequest.newBuilder().setContent("content951530617").setInfo("info3237038").build();
* ServerStream<EchoResponse> stream = echoClient.expandCallable().call(request);
* for (EchoResponse response : stream) {
* // Do something when a response is received.
Expand Down Expand Up @@ -633,12 +617,6 @@ public class EchoClient implements BackgroundResource {
* EchoRequest.newBuilder()
* .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setRequestId("requestId693933066")
* .setSecondRequestId("secondRequestId344404470")
* .setThirdRequestId(true)
* .setFourthRequestId("fourthRequestId-2116417776")
* .setFifthRequestId("fifthRequestId959024147")
* .setSixthRequestId("sixthRequestId1005218260")
* .setSeverity(Severity.forNumber(0))
* .setFoobar(Foobar.newBuilder().build())
* .build();
Expand Down Expand Up @@ -666,12 +644,6 @@ public class EchoClient implements BackgroundResource {
* EchoRequest.newBuilder()
* .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setRequestId("requestId693933066")
* .setSecondRequestId("secondRequestId344404470")
* .setThirdRequestId(true)
* .setFourthRequestId("fourthRequestId-2116417776")
* .setFifthRequestId("fifthRequestId959024147")
* .setSixthRequestId("sixthRequestId1005218260")
* .setSeverity(Severity.forNumber(0))
* .setFoobar(Foobar.newBuilder().build())
* .build();
Expand Down Expand Up @@ -702,12 +674,6 @@ public class EchoClient implements BackgroundResource {
* EchoRequest.newBuilder()
* .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setRequestId("requestId693933066")
* .setSecondRequestId("secondRequestId344404470")
* .setThirdRequestId(true)
* .setFourthRequestId("fourthRequestId-2116417776")
* .setFifthRequestId("fifthRequestId959024147")
* .setSixthRequestId("sixthRequestId1005218260")
* .setSeverity(Severity.forNumber(0))
* .setFoobar(Foobar.newBuilder().build())
* .build();
Expand Down Expand Up @@ -1116,12 +1082,6 @@ public class EchoClient implements BackgroundResource {
* EchoRequest.newBuilder()
* .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setRequestId("requestId693933066")
* .setSecondRequestId("secondRequestId344404470")
* .setThirdRequestId(true)
* .setFourthRequestId("fourthRequestId-2116417776")
* .setFifthRequestId("fifthRequestId959024147")
* .setSixthRequestId("sixthRequestId1005218260")
* .setSeverity(Severity.forNumber(0))
* .setFoobar(Foobar.newBuilder().build())
* .build();
Expand Down Expand Up @@ -1151,12 +1111,6 @@ public class EchoClient implements BackgroundResource {
* EchoRequest.newBuilder()
* .setName(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setParent(FoobarName.ofProjectFoobarName("[PROJECT]", "[FOOBAR]").toString())
* .setRequestId("requestId693933066")
* .setSecondRequestId("secondRequestId344404470")
* .setThirdRequestId(true)
* .setFourthRequestId("fourthRequestId-2116417776")
* .setFifthRequestId("fifthRequestId959024147")
* .setSixthRequestId("sixthRequestId1005218260")
* .setSeverity(Severity.forNumber(0))
* .setFoobar(Foobar.newBuilder().build())
* .build();
Expand Down
Loading

0 comments on commit 4aae265

Please sign in to comment.