Skip to content

Commit

Permalink
Merge branch 'master' of github.com:grpc/grpc-java into doc/update_pr…
Browse files Browse the repository at this point in the history
…otobuf_gradle_plugin_version_to_0_8_13
  • Loading branch information
voidzcy committed Aug 24, 2020
2 parents 3cbc584 + 03f83bb commit 283ad2b
Show file tree
Hide file tree
Showing 469 changed files with 29,213 additions and 5,600 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
@@ -1,7 +1,6 @@
---
name: Report a bug
about: Create a bug report to help us improve
labels: bug
---

<!-- Please answer these questions before submitting a bug report. -->
Expand Down
36 changes: 18 additions & 18 deletions README.md
Expand Up @@ -2,8 +2,8 @@ gRPC-Java - An RPC library and framework
========================================

gRPC-Java works with JDK 7. gRPC-Java clients are supported on Android API
levels 14 and up (Ice Cream Sandwich and later). Deploying gRPC servers on an
Android device is not supported.
levels 16 and up (Jelly Bean and later). Deploying gRPC servers on an Android
device is not supported.

TLS usage typically requires using Java 8, or Play Services Dynamic Security
Provider on Android. Please see the [Security Readme](SECURITY.md).
Expand All @@ -30,8 +30,8 @@ For a guided tour, take a look at the [quick start
guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
basics](https://grpc.io/docs/languages/java/basics).

The [examples](https://github.com/grpc/grpc-java/tree/v1.29.0/examples) and the
[Android example](https://github.com/grpc/grpc-java/tree/v1.29.0/examples/android)
The [examples](https://github.com/grpc/grpc-java/tree/v1.31.1/examples) and the
[Android example](https://github.com/grpc/grpc-java/tree/v1.31.1/examples/android)
are standalone projects that showcase the usage of gRPC.

Download
Expand All @@ -42,17 +42,17 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.29.0</version>
<version>1.31.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.29.0</version>
<version>1.31.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.29.0</version>
<version>1.31.1</version>
</dependency>
<dependency> <!-- necessary for Java 9+ -->
<groupId>org.apache.tomcat</groupId>
Expand All @@ -64,23 +64,23 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:

Or for Gradle with non-Android, add to your dependencies:
```gradle
implementation 'io.grpc:grpc-netty-shaded:1.29.0'
implementation 'io.grpc:grpc-protobuf:1.29.0'
implementation 'io.grpc:grpc-stub:1.29.0'
implementation 'io.grpc:grpc-netty-shaded:1.31.1'
implementation 'io.grpc:grpc-protobuf:1.31.1'
implementation 'io.grpc:grpc-stub:1.31.1'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
```

For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
`grpc-protobuf-lite` instead of `grpc-protobuf`:
```gradle
implementation 'io.grpc:grpc-okhttp:1.29.0'
implementation 'io.grpc:grpc-protobuf-lite:1.29.0'
implementation 'io.grpc:grpc-stub:1.29.0'
implementation 'io.grpc:grpc-okhttp:1.31.1'
implementation 'io.grpc:grpc-protobuf-lite:1.31.1'
implementation 'io.grpc:grpc-stub:1.31.1'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
```

[the JARs]:
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.29.0
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.31.1

Development snapshots are available in [Sonatypes's snapshot
repository](https://oss.sonatype.org/content/repositories/snapshots/).
Expand Down Expand Up @@ -110,9 +110,9 @@ For protobuf-based codegen integrated with the Maven build system, you can use
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.11.0:exe:${os.detected.classifier}</protocArtifact>
<protocArtifact>com.google.protobuf:protoc:3.12.0:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.29.0:exe:${os.detected.classifier}</pluginArtifact>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.31.1:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
Expand All @@ -138,11 +138,11 @@ plugins {
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.11.0"
artifact = "com.google.protobuf:protoc:3.12.0"
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.29.0'
artifact = 'io.grpc:protoc-gen-grpc-java:1.31.1'
}
}
generateProtoTasks {
Expand Down
4 changes: 2 additions & 2 deletions RELEASING.md
Expand Up @@ -201,7 +201,7 @@ Update version referenced by tutorials
--------------------------------------

Update the `grpc_java_release_tag` in
[config.toml](https://github.com/grpc/grpc.io/blob/master/config.toml)
[config.yaml](https://github.com/grpc/grpc.io/blob/master/config.yaml)
of the grpc.io repository.

Notify the Community
Expand All @@ -225,7 +225,7 @@ Now we need to update gh-pages with the new Javadoc:

```bash
git checkout gh-pages
git pull --ff-only
git pull --ff-only upstream gh-pages
rm -r javadoc/
wget -O grpc-all-javadoc.jar "http://search.maven.org/remotecontent?filepath=io/grpc/grpc-all/$MAJOR.$MINOR.$PATCH/grpc-all-$MAJOR.$MINOR.$PATCH-javadoc.jar"
unzip -d javadoc grpc-all-javadoc.jar
Expand Down
2 changes: 1 addition & 1 deletion all/build.gradle
Expand Up @@ -32,7 +32,7 @@ for (subproject in rootProject.subprojects) {
}

dependencies {
api subprojects.minus(project(':grpc-protobuf-lite'))
api subprojects.minus([project(':grpc-protobuf-lite'), project(':grpc-rls')])
}

javadoc {
Expand Down
4 changes: 2 additions & 2 deletions alts/src/main/java/io/grpc/alts/AltsServerBuilder.java
Expand Up @@ -30,7 +30,7 @@
import io.grpc.ServerCallHandler;
import io.grpc.ServerInterceptor;
import io.grpc.ServerServiceDefinition;
import io.grpc.ServerStreamTracer.Factory;
import io.grpc.ServerStreamTracer;
import io.grpc.ServerTransportFilter;
import io.grpc.Status;
import io.grpc.alts.internal.AltsProtocolNegotiator;
Expand Down Expand Up @@ -102,7 +102,7 @@ public AltsServerBuilder directExecutor() {

/** {@inheritDoc} */
@Override
public AltsServerBuilder addStreamTracerFactory(Factory factory) {
public AltsServerBuilder addStreamTracerFactory(ServerStreamTracer.Factory factory) {
delegate.addStreamTracerFactory(factory);
return this;
}
Expand Down
11 changes: 11 additions & 0 deletions alts/src/main/java/io/grpc/alts/internal/AltsAuthContext.java
Expand Up @@ -17,6 +17,7 @@
package io.grpc.alts.internal;

import com.google.common.annotations.VisibleForTesting;
import java.util.Map;

/** AltsAuthContext contains security-related context information about an ALTs connection. */
public final class AltsAuthContext {
Expand All @@ -33,6 +34,7 @@ public AltsAuthContext(HandshakerResult result) {
.setPeerServiceAccount(result.getPeerIdentity().getServiceAccount())
.setLocalServiceAccount(result.getLocalIdentity().getServiceAccount())
.setPeerRpcVersions(result.getPeerRpcVersions())
.putAllPeerAttributes(result.getPeerIdentity().getAttributes())
.build();
}

Expand Down Expand Up @@ -94,4 +96,13 @@ public String getLocalServiceAccount() {
public RpcProtocolVersions getPeerRpcVersions() {
return context.getPeerRpcVersions();
}

/**
* Get peer attributes.
*
* @return the context's peer attributes.
*/
public Map<String, String> getPeerAttributes() {
return context.getPeerAttributes();
}
}
2 changes: 1 addition & 1 deletion alts/src/main/java/io/grpc/alts/internal/TsiPeer.java
Expand Up @@ -54,7 +54,7 @@ public abstract static class Property<T> {
private final String name;
private final T value;

public Property(@Nonnull String name, @Nonnull T value) {
protected Property(@Nonnull String name, @Nonnull T value) {
this.name = name;
this.value = value;
}
Expand Down
Expand Up @@ -18,6 +18,8 @@

import static org.junit.Assert.assertEquals;

import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -35,12 +37,17 @@ public final class AltsAuthContextTest {
private static final String TEST_LOCAL_SERVICE_ACCOUNT = "local@gserviceaccount.com";
private static final String TEST_PEER_SERVICE_ACCOUNT = "peer@gserviceaccount.com";
private static final String TEST_RECORD_PROTOCOL = "ALTSRP_GCM_AES128";
private static final String TEST_PEER_ATTRIBUTES_KEY = "peer";
private static final String TEST_PEER_ATTRIBUTES_VALUE = "attributes";

private Map<String, String> testPeerAttributes;
private HandshakerResult handshakerResult;
private RpcProtocolVersions rpcVersions;

@Before
public void setUp() {
testPeerAttributes = new HashMap<String, String>();
testPeerAttributes.put(TEST_PEER_ATTRIBUTES_KEY, TEST_PEER_ATTRIBUTES_VALUE);
rpcVersions =
RpcProtocolVersions.newBuilder()
.setMaxRpcVersion(
Expand All @@ -54,11 +61,14 @@ public void setUp() {
.setMinor(TEST_MIN_RPC_VERSION_MINOR)
.build())
.build();
Identity.Builder peerIdentity = Identity.newBuilder()
.setServiceAccount(TEST_PEER_SERVICE_ACCOUNT);
peerIdentity.putAllAttributes(testPeerAttributes);
handshakerResult =
HandshakerResult.newBuilder()
.setApplicationProtocol(TEST_APPLICATION_PROTOCOL)
.setRecordProtocol(TEST_RECORD_PROTOCOL)
.setPeerIdentity(Identity.newBuilder().setServiceAccount(TEST_PEER_SERVICE_ACCOUNT))
.setPeerIdentity(peerIdentity)
.setLocalIdentity(Identity.newBuilder().setServiceAccount(TEST_LOCAL_SERVICE_ACCOUNT))
.setPeerRpcVersions(rpcVersions)
.build();
Expand All @@ -73,5 +83,8 @@ public void testAltsAuthContext() {
assertEquals(TEST_PEER_SERVICE_ACCOUNT, authContext.getPeerServiceAccount());
assertEquals(TEST_LOCAL_SERVICE_ACCOUNT, authContext.getLocalServiceAccount());
assertEquals(rpcVersions, authContext.getPeerRpcVersions());
assertEquals(testPeerAttributes, authContext.getPeerAttributes());
assertEquals(TEST_PEER_ATTRIBUTES_VALUE, authContext.getPeerAttributes()
.get(TEST_PEER_ATTRIBUTES_KEY));
}
}
3 changes: 1 addition & 2 deletions android-interop-testing/build.gradle
Expand Up @@ -29,8 +29,7 @@ android {

defaultConfig {
applicationId "io.grpc.android.integrationtest"
// API level 14+ is required for TLS since Google Play Services v10.2
minSdkVersion 14
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
Expand Down
5 changes: 0 additions & 5 deletions android-interop-testing/src/androidTest/AndroidManifest.xml
Expand Up @@ -2,11 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.grpc.android.integrationtest.test" >

<!-- API level 14+ is required for TLS since Google Play Services v10.2 -->
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="22"/>

<instrumentation
android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="io.grpc.android.integrationtest" />
Expand Down
5 changes: 0 additions & 5 deletions android-interop-testing/src/main/AndroidManifest.xml
Expand Up @@ -2,11 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.grpc.android.integrationtest" >

<!-- API level 14+ is required for TLS since Google Play Services v10.2 -->
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="22"/>

<uses-permission android:name="android.permission.INTERNET" />

<application
Expand Down
Expand Up @@ -19,6 +19,7 @@
import android.os.AsyncTask;
import android.util.Log;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.testing.integration.AbstractInteropTest;
import java.io.PrintWriter;
import java.io.StringWriter;
Expand Down Expand Up @@ -156,6 +157,11 @@ protected ManagedChannel createChannel() {
return channel;
}

@Override
protected ManagedChannelBuilder<?> createChannelBuilder() {
throw new UnsupportedOperationException();
}

@Override
protected boolean metricsExpected() {
return false;
Expand Down
7 changes: 5 additions & 2 deletions android/build.gradle
Expand Up @@ -11,7 +11,7 @@ android {
compileSdkVersion 28
defaultConfig {
consumerProguardFiles "proguard-rules.txt"
minSdkVersion 14
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
Expand All @@ -31,7 +31,10 @@ dependencies {
testImplementation project('::grpc-okhttp')
testImplementation libraries.androidx_test
testImplementation libraries.junit
testImplementation libraries.robolectric
testImplementation (libraries.robolectric) {
// Unreleased change: https://github.com/robolectric/robolectric/pull/5432
exclude group: 'com.google.auto.service', module: 'auto-service'
}
testImplementation libraries.truth
}

Expand Down
7 changes: 3 additions & 4 deletions api/src/main/java/io/grpc/Attributes.java
Expand Up @@ -22,7 +22,6 @@
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
Expand Down Expand Up @@ -179,7 +178,7 @@ public boolean equals(Object o) {
if (data.size() != that.data.size()) {
return false;
}
for (Entry<Key<?>, Object> e : data.entrySet()) {
for (Map.Entry<Key<?>, Object> e : data.entrySet()) {
if (!that.data.containsKey(e.getKey())) {
return false;
}
Expand All @@ -202,7 +201,7 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
int hashCode = 0;
for (Entry<Key<?>, Object> e : data.entrySet()) {
for (Map.Entry<Key<?>, Object> e : data.entrySet()) {
hashCode += Objects.hashCode(e.getKey(), e.getValue());
}
return hashCode;
Expand Down Expand Up @@ -262,7 +261,7 @@ public Builder setAll(Attributes other) {
*/
public Attributes build() {
if (newdata != null) {
for (Entry<Key<?>, Object> entry : base.data.entrySet()) {
for (Map.Entry<Key<?>, Object> entry : base.data.entrySet()) {
if (!newdata.containsKey(entry.getKey())) {
newdata.put(entry.getKey(), entry.getValue());
}
Expand Down
3 changes: 1 addition & 2 deletions api/src/main/java/io/grpc/DecompressorRegistry.java
Expand Up @@ -25,7 +25,6 @@
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
Expand Down Expand Up @@ -116,7 +115,7 @@ byte[] getRawAdvertisedMessageEncodings() {
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
public Set<String> getAdvertisedMessageEncodings() {
Set<String> advertisedDecompressors = new HashSet<>(decompressors.size());
for (Entry<String, DecompressorInfo> entry : decompressors.entrySet()) {
for (Map.Entry<String, DecompressorInfo> entry : decompressors.entrySet()) {
if (entry.getValue().advertised) {
advertisedDecompressors.add(entry.getKey());
}
Expand Down
8 changes: 1 addition & 7 deletions api/src/main/java/io/grpc/ForwardingChannelBuilder.java
Expand Up @@ -77,13 +77,6 @@ public T offloadExecutor(Executor executor) {
return thisT();
}

@Deprecated
@Override
public T blockingExecutor(Executor executor) {
delegate().blockingExecutor(executor);
return thisT();
}

@Override
public T intercept(List<ClientInterceptor> interceptors) {
delegate().intercept(interceptors);
Expand Down Expand Up @@ -120,6 +113,7 @@ public T useTransportSecurity() {
return thisT();
}

@Deprecated
@Override
public T nameResolverFactory(NameResolver.Factory resolverFactory) {
delegate().nameResolverFactory(resolverFactory);
Expand Down

0 comments on commit 283ad2b

Please sign in to comment.