Skip to content

Commit 0f8d7ca

Browse files
committed
Update dependencies for Speech sample.
Also, fix shell-check warnings in scripts. Switches to the auth library recommended in the grpc documentation. There was an old version of Guava being included from this, which I had to exclude from the pom.
1 parent 29c223a commit 0f8d7ca

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

speech/grpc/bin/speech-sample-async.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
SRC_DIR=$(cd "$(dirname "$0")/.."; pwd)
16+
SRC_DIR="$( cd "$( dirname "$0" )/.." && pwd )"
1717
java -cp "${SRC_DIR}/target/grpc-sample-1.0-jar-with-dependencies.jar" \
1818
com.examples.cloud.speech.AsyncRecognizeClient "$@"

speech/grpc/bin/speech-sample-streaming.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
SRC_DIR=$(cd "$(dirname "$0")/.."; pwd)
16+
SRC_DIR="$( cd "$( dirname "$0" )/.." && pwd )"
1717
java -cp "${SRC_DIR}/target/grpc-sample-1.0-jar-with-dependencies.jar" \
1818
com.examples.cloud.speech.StreamingRecognizeClient "$@"

speech/grpc/bin/speech-sample-sync.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
SRC_DIR=$(cd "$(dirname "$0")/.."; pwd)
16+
SRC_DIR="$( cd "$( dirname "$0" )/.." && pwd )"
1717
java -cp "${SRC_DIR}/target/grpc-sample-1.0-jar-with-dependencies.jar" \
1818
com.examples.cloud.speech.SyncRecognizeClient "$@"

speech/grpc/pom.xml

+16-8
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ limitations under the License.
123123
<artifactId>commons-cli</artifactId>
124124
<version>1.3.1</version>
125125
</dependency>
126+
<dependency>
127+
<groupId>com.google.auth</groupId>
128+
<artifactId>google-auth-library-oauth2-http</artifactId>
129+
<version>0.4.0</version>
130+
<exclusions>
131+
<!-- Exclude an old version of guava that is being pulled
132+
in by a transitive dependency of google-api-client -->
133+
<exclusion>
134+
<groupId>com.google.guava</groupId>
135+
<artifactId>guava-jdk5</artifactId>
136+
</exclusion>
137+
</exclusions>
138+
</dependency>
126139
<dependency>
127140
<groupId>com.google.guava</groupId>
128141
<artifactId>guava</artifactId>
@@ -131,12 +144,7 @@ limitations under the License.
131144
<dependency>
132145
<groupId>io.grpc</groupId>
133146
<artifactId>grpc-all</artifactId>
134-
<version>0.13.2</version>
135-
</dependency>
136-
<dependency>
137-
<groupId>com.google.oauth-client</groupId>
138-
<artifactId>google-oauth-client</artifactId>
139-
<version>1.21.0</version>
147+
<version>0.15.0</version>
140148
</dependency>
141149
<dependency>
142150
<!--
@@ -149,13 +157,13 @@ limitations under the License.
149157
-->
150158
<groupId>io.netty</groupId>
151159
<artifactId>netty-tcnative-boringssl-static</artifactId>
152-
<version>1.1.33.Fork14</version>
160+
<version>1.1.33.Fork20</version>
153161
<classifier>${tcnative.classifier}</classifier>
154162
</dependency>
155163
<dependency>
156164
<groupId>com.google.truth</groupId>
157165
<artifactId>truth</artifactId>
158-
<version>0.28</version>
166+
<version>0.29</version>
159167
<scope>test</scope>
160168
</dependency>
161169
<dependency>

speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java

-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.google.cloud.speech.v1beta1.RecognitionConfig;
2424
import com.google.cloud.speech.v1beta1.RecognitionConfig.AudioEncoding;
2525
import com.google.cloud.speech.v1beta1.SpeechGrpc;
26-
2726
import com.google.longrunning.GetOperationRequest;
2827
import com.google.longrunning.Operation;
2928
import com.google.longrunning.OperationsGrpc;
@@ -33,7 +32,6 @@
3332
import io.grpc.auth.ClientAuthInterceptor;
3433
import io.grpc.netty.NegotiationType;
3534
import io.grpc.netty.NettyChannelBuilder;
36-
3735
import org.apache.commons.cli.CommandLine;
3836
import org.apache.commons.cli.CommandLineParser;
3937
import org.apache.commons.cli.DefaultParser;

0 commit comments

Comments
 (0)