Skip to content

Commit

Permalink
java: updated protobuf-java dep version, moved local build to docker (#…
Browse files Browse the repository at this point in the history
…121)

* java: updated protobuf-java dep version, moved local build to docker

* Updated the Slack invite URL

* chore: Replace compile with implementation for Java Gradle dependency  (#123)

Fixed deprecated method in Java Gradle dependency - replaced compile with implementation.
Closes #122.

* use maven docker image

* switch to java 11 for better backwards compatibility

---------

Co-authored-by: Frédéric Simard <frederic-contractor@mobilitydata.org>
Co-authored-by: Jingsi Lu <5789435+qcdyx@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 28, 2023
1 parent ff2584a commit ffe13e9
Show file tree
Hide file tree
Showing 5 changed files with 3,375 additions and 2,707 deletions.
21 changes: 21 additions & 0 deletions java/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM maven:3.9.2-eclipse-temurin-11

WORKDIR /lib

# Install protoc (cf. http://google.github.io/proto-lens/installing-protoc.html)
ENV PROTOC_ZIP=protoc-21.12-linux-x86_64.zip
RUN apt-get update && apt-get install -y unzip
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP \
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
&& unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \
&& rm -f $PROTOC_ZIP

RUN mkdir -p src/main/java
RUN mkdir -p src/test/java/com/google/transit/realtime
RUN mkdir -p src/test/resources/com/google/transit/realtime
COPY gtfs-realtime.proto /lib/gtfs-realtime.proto
COPY java/pom.xml /lib/pom.xml
COPY java/src/test/java/com/google/transit/realtime/GtfsRealtimeTest.java src/test/java/com/google/transit/realtime/GtfsRealtimeTest.java
COPY java/src/test/resources/com/google/transit/realtime/* src/test/resources/com/google/transit/realtime

CMD protoc --java_out=src/main/java gtfs-realtime.proto && mvn verify
22 changes: 6 additions & 16 deletions java/UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,17 @@

#### One-Time Setup

1. Download and setup Protocol Buffer release from https://github.com/protocolbuffers/protobuf/releases (if you haven't already done this for another language). As of February 2019 we're using v3.7 release, which is compatible with proto2 .proto files.
1. Download [Java JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html)
1. Download and install [Maven](https://maven.apache.org/download.cgi)
1. Download and install [Docker](https://docs.docker.com/get-docker/)

#### Every time `gtfs-realtime.proto` changes

Regenerate the language binding source from gtfs-realtime.proto.
1. Run the update script:

From the project `/java` folder, run:
```
./update_generated_code.sh
```

```
protoc --java_out=src/main/java --proto_path=.. ../gtfs-realtime.proto
```

Add the license header back to the generated source file.

Test the generated code:

```
mvn verify
````
1. Add the license header back to the generated source file.

## Publishing a new release.

Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.16.1</version>
<version>3.21.12</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
Loading

0 comments on commit ffe13e9

Please sign in to comment.