Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: latest updates for Last Mile Fleet Solution Sample Apps. #216

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
run: |
gradle wrapper

- name: Build app
# Use assemble instead of build since build includes running tests. Tests will be run as part of
# the test workflow.
- name: Assemble app
working-directory: ./android_driverapp_samples
run: ./gradlew build
run: ./gradlew assemble
6 changes: 4 additions & 2 deletions .github/workflows/backend-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
run: |
gradle wrapper

- name: Build backend
# Use assemble instead of build since build includes running tests. Tests will be included as
# part of the test workflow (at this point test compilation only due to credential issues).
- name: Assemble backend
working-directory: ./backend
run: ./gradlew build
run: ./gradlew assemble
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# A workflow that runs tests on every new pull request
name: Test Android app and compile backend tests

on:
repository_dispatch:
types: [test]
push:
branches-ignore: ['gh-pages']
pull_request:
branches-ignore: ['gh-pages']
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repo
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Generate Android gradle wrapper
working-directory: ./android_driverapp_samples
run: |
gradle wrapper

- name: Test Android
working-directory: ./android_driverapp_samples
run: ./gradlew test

- name: Generate backend gradle wrapper
working-directory: ./backend
run: |
gradle wrapper

# Test credentials were never set up. So, we can't run tests, but we can make sure it compiles.
- name: Compile backend tests (no test execution)
working-directory: ./backend
run: ./gradlew testClasses
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ private void setupDeliveryVehicleReporter(Navigator navigator) {
.setNavigator(navigator)
.setRoadSnappedLocationProvider(
NavigationApi.getRoadSnappedLocationProvider(application))
.setStatusListener(
(statusLevel, statusCode, statusMsg) -> {
.setDriverStatusListener(
(statusLevel, statusCode, statusMsg, cause) -> {
Log.d(
TAG,
String.format(
"VehicleReporter: %s | %s | %s",
statusLevel.name(), statusCode.name(), statusMsg));
"VehicleReporter: %s | %s | %s | %s",
statusLevel.name(), statusCode.name(), statusMsg, cause.getMessage()));
})
.build();
DeliveryDriverApi.createInstance(driverContext);
Expand Down
2 changes: 1 addition & 1 deletion android_driverapp_samples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ buildscript {
}

plugins {
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
id "maven-publish"
id "com.google.cloud.artifactregistry.gradle-plugin" version "2.1.5"
}
Expand Down
6 changes: 3 additions & 3 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ dependencies {
implementation 'jstl:jstl:1.2'

// Add dependencies here
implementation 'com.google.maps:grpc-google-maps-fleetengine-delivery-v1-java:0.+'
implementation 'com.google.maps:grpc-google-maps-fleetengine-delivery-v1-java:latest.release'

// Fleet Engine Auth Library and its dependencies
implementation 'com.google.maps:fleetengine-auth:1.8.0'
implementation 'com.google.maps:fleetengine-auth:2.0.0'
implementation 'com.google.guava:guava:23.0'
implementation 'com.google.auth:google-auth-library-oauth2-http:0.26.0'

Expand All @@ -61,7 +61,7 @@ dependencies {
implementation 'com.google.inject.extensions:guice-servlet:6.0.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.google.auto.value:auto-value-annotations:1.10.4'
implementation 'io.grpc:grpc-api:1.66.0'
implementation 'io.grpc:grpc-api:1.66.0'
implementation 'io.grpc:grpc-protobuf:1.66.0'
implementation 'io.grpc:grpc-stub:1.66.0'
implementation 'io.grpc:grpc-netty:1.66.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
import com.example.backend.utils.SampleBackendUtils;
import com.example.backend.utils.ServletUtils;
import com.google.gson.Gson;
import com.google.maps.fleetengine.delivery.v1.CreateDeliveryVehicleRequest;
import com.google.maps.fleetengine.delivery.v1.CreateTaskRequest;
import com.google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import com.google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import com.google.maps.fleetengine.delivery.v1.DeliveryVehicleLocation;
import com.google.maps.fleetengine.delivery.v1.Task;
import com.google.maps.fleetengine.delivery.v1.UpdateDeliveryVehicleRequest;
import com.google.protobuf.FieldMask;
import com.google.type.LatLng;
import google.maps.fleetengine.delivery.v1.CreateDeliveryVehicleRequest;
import google.maps.fleetengine.delivery.v1.CreateTaskRequest;
import google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import google.maps.fleetengine.delivery.v1.DeliveryVehicleLocation;
import google.maps.fleetengine.delivery.v1.Task;
import google.maps.fleetengine.delivery.v1.UpdateDeliveryVehicleRequest;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import com.example.backend.json.BackendConfigGsonProvider;
import com.example.backend.utils.ServletUtils;
import com.google.gson.JsonObject;
import com.google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import com.google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import com.google.maps.fleetengine.delivery.v1.UpdateDeliveryVehicleRequest;
import com.google.maps.fleetengine.delivery.v1.VehicleStop;
import com.google.protobuf.FieldMask;
import google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import google.maps.fleetengine.delivery.v1.UpdateDeliveryVehicleRequest;
import google.maps.fleetengine.delivery.v1.VehicleStop;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Level;
Expand Down
10 changes: 5 additions & 5 deletions backend/src/main/java/com/example/backend/ManifestServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import com.example.backend.utils.ServletUtils;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import com.google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import com.google.maps.fleetengine.delivery.v1.UpdateDeliveryVehicleRequest;
import com.google.maps.fleetengine.delivery.v1.VehicleJourneySegment;
import com.google.maps.fleetengine.delivery.v1.VehicleStop;
import com.google.protobuf.FieldMask;
import google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import google.maps.fleetengine.delivery.v1.UpdateDeliveryVehicleRequest;
import google.maps.fleetengine.delivery.v1.VehicleJourneySegment;
import google.maps.fleetengine.delivery.v1.VehicleStop;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/java/com/example/backend/ServletState.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
package com.example.backend;

import com.example.backend.json.BackendConfig;
import google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import google.maps.fleetengine.delivery.v1.Task;
import com.google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import com.google.maps.fleetengine.delivery.v1.Task;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand Down
17 changes: 9 additions & 8 deletions backend/src/main/java/com/example/backend/TaskServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
import com.example.backend.utils.ServletUtils;
import com.example.backend.utils.TaskUtils;
import com.google.gson.JsonObject;
import com.google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import com.google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import com.google.maps.fleetengine.delivery.v1.GetTaskRequest;
import com.google.maps.fleetengine.delivery.v1.Task;
import com.google.maps.fleetengine.delivery.v1.UpdateTaskRequest;
import com.google.maps.fleetengine.delivery.v1.VehicleJourneySegment;
import com.google.maps.fleetengine.delivery.v1.VehicleStop;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Timestamp;
import google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import google.maps.fleetengine.delivery.v1.GetTaskRequest;
import google.maps.fleetengine.delivery.v1.Task;
import google.maps.fleetengine.delivery.v1.UpdateTaskRequest;
import google.maps.fleetengine.delivery.v1.VehicleJourneySegment;
import google.maps.fleetengine.delivery.v1.VehicleStop;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
Expand Down Expand Up @@ -139,7 +139,8 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
logger.log(
Level.WARNING,
String.format("The tracking ID %s does not exist in the manifest.", trackingId));
ServletUtils.setErrorResponse(response, "The task with the tracking ID cannot be found.", 404);
ServletUtils.setErrorResponse(
response, "The task with the tracking ID cannot be found.", 404);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package com.example.backend.auth.grpcservice;

import google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import com.google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;

/** Backend to get authenticated Grpc services. */
public interface AuthenticatedGrpcServiceProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import com.example.backend.auth.AuthTokenUtils;
import com.example.backend.utils.SampleBackendUtils;
import google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import com.google.maps.fleetengine.delivery.v1.DeliveryServiceGrpc;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.Metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import com.google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import java.lang.reflect.Type;

/** Class to provide serialization for DeliveryVehicle protos into JSON. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import com.google.maps.fleetengine.delivery.v1.Task;
import com.google.type.LatLng;
import google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import google.maps.fleetengine.delivery.v1.Task;

/**
* Provider for Gson after setting custom serializer and deserializer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import google.maps.fleetengine.delivery.v1.Task;
import com.google.maps.fleetengine.delivery.v1.Task;
import java.lang.reflect.Type;

final class TaskSerializer implements JsonSerializer<Task> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
package com.example.backend.utils;

import com.example.backend.json.BackendConfig;
import com.google.maps.fleetengine.delivery.v1.LocationInfo;
import com.google.maps.fleetengine.delivery.v1.Task;
import com.google.maps.fleetengine.delivery.v1.VehicleJourneySegment;
import com.google.maps.fleetengine.delivery.v1.VehicleStop;
import com.google.protobuf.Duration;
import com.google.type.LatLng;
import google.maps.fleetengine.delivery.v1.LocationInfo;
import google.maps.fleetengine.delivery.v1.Task;
import google.maps.fleetengine.delivery.v1.VehicleJourneySegment;
import google.maps.fleetengine.delivery.v1.VehicleStop;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

import com.example.backend.json.ErrorResponse;
import com.example.backend.json.GsonProvider;
import com.google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import com.google.maps.fleetengine.delivery.v1.Task;
import com.google.protobuf.Message;
import com.google.protobuf.util.JsonFormat;
import google.maps.fleetengine.delivery.v1.DeliveryVehicle;
import google.maps.fleetengine.delivery.v1.Task;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Reader;
Expand Down
Loading