Skip to content

Commit

Permalink
Introduce datatypes/java module for proto generation
Browse files Browse the repository at this point in the history
Rather than the Maven protobuf plugin running on the same symlinked
definitions in several Java modules, localize this process into one
module that the others depend on.

This provides a single module that can be depended on by third-party
extensions with the bare minimum of dependencies.

Also removes proto files that are no longer used.
  • Loading branch information
ches committed Jan 7, 2020
1 parent 58527de commit 1cf9e4c
Show file tree
Hide file tree
Showing 19 changed files with 135 additions and 123 deletions.
4 changes: 0 additions & 4 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
1 change: 0 additions & 1 deletion core/src/main/proto/feast

This file was deleted.

1 change: 0 additions & 1 deletion core/src/main/proto/third_party

This file was deleted.

43 changes: 43 additions & 0 deletions datatypes/java/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Feast Data Types for Java
=========================

This module produces Java class files for Feast's data type and gRPC service
definitions, from Protobuf IDL. These are used across Feast components for wire
interchange, contracts, etc.

End users of Feast will be best served by our Java SDK which adds higher-level
conveniences, but the data types are published independently for custom needs,
without any additional dependencies the SDK may add.

Dependency Coordinates
----------------------

```xml
<dependency>
<groupId>dev.feast</groupId>
<artifactId>datatypes-java</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
```

Using the `.proto` Definitions
------------------------------

The `.proto` definitions are packaged as resources within the Maven artifact,
which may be useful to `include` them in dependent Protobuf definitions in a
downstream project, or for other JVM languages to consume from their builds to
generate more idiomatic bindings.

Google's Gradle plugin, for instance, [can use protos in dependencies][Gradle]
either for `include` or to compile with a different `protoc` plugin than Java.

[sbt-protoc] offers similar functionality for sbt/Scala.

[Gradle]: https://github.com/google/protobuf-gradle-plugin#protos-in-dependencies
[sbt-protoc]: https://github.com/thesamet/sbt-protoc

Publishing
----------

TODO: this module should be published to Maven Central upon Feast releases—this
needs to be set up in POM configuration and release automation.
72 changes: 72 additions & 0 deletions datatypes/java/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019 The Feast Authors
~
~ 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
~
~ https://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.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<name>Feast Data Types for Java</name>
<description>
Data types and service contracts used throughout Feast components and
their interchanges. These are generated from Protocol Buffers and gRPC
definitions included in the package.
</description>
<artifactId>datatypes-java</artifactId>

<parent>
<groupId>dev.feast</groupId>
<artifactId>feast-parent</artifactId>
<version>${revision}</version>
<relativePath>../..</relativePath>
</parent>

<build>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<configuration>
<checkStaleness>true</checkStaleness>
<protocArtifact>
com.google.protobuf:protoc:${protocVersion}:exe:${os.detected.classifier}
</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>
io.grpc:protoc-gen-grpc-java:${grpcVersion}:exe:${os.detected.classifier}
</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-services</artifactId>
</dependency>
</dependencies>
</project>
File renamed without changes.
1 change: 1 addition & 0 deletions datatypes/java/src/main/proto/third_party
10 changes: 6 additions & 4 deletions ingestion/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@

<build>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down Expand Up @@ -90,6 +86,12 @@
</build>

<dependencies>
<dependency>
<groupId>dev.feast</groupId>
<artifactId>datatypes-java</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
Expand Down
1 change: 0 additions & 1 deletion ingestion/src/main/proto/feast

This file was deleted.

35 changes: 0 additions & 35 deletions ingestion/src/main/proto/feast_ingestion/types/CoalesceAccum.proto

This file was deleted.

25 changes: 0 additions & 25 deletions ingestion/src/main/proto/feast_ingestion/types/CoalesceKey.proto

This file was deleted.

1 change: 0 additions & 1 deletion ingestion/src/main/proto/third_party

This file was deleted.

10 changes: 0 additions & 10 deletions ingestion/src/test/proto/DriverArea.proto

This file was deleted.

12 changes: 0 additions & 12 deletions ingestion/src/test/proto/Ping.proto

This file was deleted.

20 changes: 1 addition & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<packaging>pom</packaging>

<modules>
<module>datatypes/java</module>
<module>ingestion</module>
<module>core</module>
<module>serving</module>
Expand Down Expand Up @@ -542,25 +543,6 @@
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<checkStaleness>true</checkStaleness>
<protocArtifact>
com.google.protobuf:protoc:${protocVersion}:exe:${os.detected.classifier}
</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>
io.grpc:protoc-gen-grpc-java:${grpcVersion}:exe:${os.detected.classifier}
</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Expand Down
10 changes: 6 additions & 4 deletions sdk/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
</properties>

<dependencies>
<dependency>
<groupId>dev.feast</groupId>
<artifactId>datatypes-java</artifactId>
<version>${project.version}</version>
</dependency>

<!-- GRPC and Protobuf -->
<dependency>
<groupId>io.grpc</groupId>
Expand Down Expand Up @@ -79,10 +85,6 @@

<build>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
</plugin>
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
10 changes: 6 additions & 4 deletions serving/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
Expand All @@ -74,6 +70,12 @@
</build>

<dependencies>
<dependency>
<groupId>dev.feast</groupId>
<artifactId>datatypes-java</artifactId>
<version>${project.version}</version>
</dependency>

<!-- TODO: SLF4J is being used via Lombok, but also jog4j - pick one -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
1 change: 0 additions & 1 deletion serving/src/main/proto/feast

This file was deleted.

1 change: 0 additions & 1 deletion serving/src/main/proto/third_party

This file was deleted.

0 comments on commit 1cf9e4c

Please sign in to comment.