This is an automated email from the ASF dual-hosted git repository.
spica pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-graphar.git
The following commit(s) were added to refs/heads/main by this push:
new 98f3850c [Maven-project] Incorporate maven-proto-plugin into build of
Maven projects (#535)
98f3850c is described below
commit 98f3850c800bf1eb47fe31cf37ecd94c6fa20487
Author: John <[email protected]>
AuthorDate: Wed Jul 10 20:13:58 2024 +0800
[Maven-project] Incorporate maven-proto-plugin into build of Maven projects
(#535)
* Add proto-maven-plugin for java-info
* upgrade proto version adn patched optinal
* split proto into a single package
* modify proto java package name
* use ascopes maven plugin and delete java code gen in buf.gen.yaml
* Add ci for Java code-gen
* modify code-gen command
---
.github/workflows/format.yml | 124 +++++++++++++++++----------------
.gitignore | 6 +-
buf.gen.yaml | 4 +-
format/adjacent_list.proto | 2 +-
format/edge_info.proto | 2 +-
format/enums.proto | 2 +-
format/graph_info.proto | 2 +-
format/property_group.proto | 2 +-
format/vertex_info.proto | 2 +-
maven-projects/info/pom.xml | 1 -
maven-projects/pom.xml | 1 +
maven-projects/{info => proto}/pom.xml | 48 ++++++++-----
12 files changed, 109 insertions(+), 87 deletions(-)
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
index 0132b98e..87f66de3 100644
--- a/.github/workflows/format.yml
+++ b/.github/workflows/format.yml
@@ -1,59 +1,65 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-
-name: GraphAr Format
-
-on:
- push:
- branches:
- - main
- paths:
- - 'format/**'
- - '.github/workflows/format.yml'
- - 'buf.gen.yaml'
- - 'buf.yaml'
- pull_request:
- branches:
- - main
- paths:
- - 'format/**'
- - '.github/workflows/format.yml'
- - 'buf.gen.yaml'
- - 'buf.yaml'
-
-concurrency:
- group: ${{ github.repository }}-${{ github.event.number || github.head_ref
|| github.sha }}-${{ github.workflow }}
- cancel-in-progress: true
-
-jobs:
- generate:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- with:
- repository: ${{ github.event.pull_request.head.repo.full_name }}
- ref: ${{ github.event.pull_request.head.ref }}
- submodules: false
- fetch-depth: 0
-
- - uses: bufbuild/buf-setup-action@v1
- with:
- version: "1.32.0"
-
- - name: Buf Generate
- run: buf generate
-
\ No newline at end of file
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+name: GraphAr Format
+
+on:
+ push:
+ branches:
+ - main
+ paths:
+ - 'format/**'
+ - '.github/workflows/format.yml'
+ - 'buf.gen.yaml'
+ - 'buf.yaml'
+ pull_request:
+ branches:
+ - main
+ paths:
+ - 'format/**'
+ - '.github/workflows/format.yml'
+ - 'buf.gen.yaml'
+ - 'buf.yaml'
+
+concurrency:
+ group: ${{ github.repository }}-${{ github.event.number || github.head_ref
|| github.sha }}-${{ github.workflow }}
+ cancel-in-progress: true
+
+jobs:
+ generate:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
+ ref: ${{ github.event.pull_request.head.ref }}
+ submodules: false
+ fetch-depth: 0
+
+ - uses: bufbuild/buf-setup-action@v1
+ with:
+ version: "1.32.0"
+
+ - name: Buf Generate
+ run: buf generate
+
+ - name: Java Code Generate
+ run: |
+ pushd maven-projects/proto
+ mvn protobuf:generate
+ popd
+
diff --git a/.gitignore b/.gitignore
index 667cc9f7..0d520ae4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,4 +68,8 @@ venv.bak/
### Scala ###
*.bloop
-*.metals
\ No newline at end of file
+*.metals
+
+### Java ###
+target/
+maven-projects/proto/src/main/java
\ No newline at end of file
diff --git a/buf.gen.yaml b/buf.gen.yaml
index 6405baa9..9c4a91eb 100644
--- a/buf.gen.yaml
+++ b/buf.gen.yaml
@@ -30,6 +30,4 @@ plugins:
# Cpp
- remote: buf.build/protocolbuffers/cpp:v27.1
out: cpp/proto
- # Java
- - remote: buf.build/protocolbuffers/java:v27.1
- out: maven-projects/info/src/main/java/
+ # Java code well be generated by maven plugin
\ No newline at end of file
diff --git a/format/adjacent_list.proto b/format/adjacent_list.proto
index da88ef2a..8afb819e 100644
--- a/format/adjacent_list.proto
+++ b/format/adjacent_list.proto
@@ -21,7 +21,7 @@ syntax = "proto3";
package graphar;
option java_multiple_files = true;
-option java_package = "org.apache.graphar.info.proto";
+option java_package = "org.apache.graphar.proto";
import "enums.proto";
diff --git a/format/edge_info.proto b/format/edge_info.proto
index 12474545..92bea800 100644
--- a/format/edge_info.proto
+++ b/format/edge_info.proto
@@ -21,7 +21,7 @@ syntax = "proto3";
package graphar;
option java_multiple_files = true;
-option java_package = "org.apache.graphar.info.proto";
+option java_package = "org.apache.graphar.proto";
import "property_group.proto";
import "adjacent_list.proto";
diff --git a/format/enums.proto b/format/enums.proto
index 234b9e86..9a132fe3 100644
--- a/format/enums.proto
+++ b/format/enums.proto
@@ -21,7 +21,7 @@ syntax = "proto3";
package graphar;
option java_multiple_files = true;
-option java_package = "org.apache.graphar.info.proto";
+option java_package = "org.apache.graphar.proto";
enum DataType {
BOOL = 0;
diff --git a/format/graph_info.proto b/format/graph_info.proto
index 7d11c956..199a8dfc 100644
--- a/format/graph_info.proto
+++ b/format/graph_info.proto
@@ -21,7 +21,7 @@ syntax = "proto3";
package graphar;
option java_multiple_files = true;
-option java_package = "org.apache.graphar.info.proto";
+option java_package = "org.apache.graphar.proto";
import "vertex_info.proto";
import "edge_info.proto";
diff --git a/format/property_group.proto b/format/property_group.proto
index 23c28bcc..bb3a7028 100644
--- a/format/property_group.proto
+++ b/format/property_group.proto
@@ -21,7 +21,7 @@ syntax = "proto3";
package graphar;
option java_multiple_files = true;
-option java_package = "org.apache.graphar.info.proto";
+option java_package = "org.apache.graphar.proto";
import "enums.proto";
diff --git a/format/vertex_info.proto b/format/vertex_info.proto
index 99ec482f..0efcd278 100644
--- a/format/vertex_info.proto
+++ b/format/vertex_info.proto
@@ -21,7 +21,7 @@ syntax = "proto3";
package graphar;
option java_multiple_files = true;
-option java_package = "org.apache.graphar.info.proto";
+option java_package = "org.apache.graphar.proto";
import "property_group.proto";
diff --git a/maven-projects/info/pom.xml b/maven-projects/info/pom.xml
index ea59280d..f768e3c4 100644
--- a/maven-projects/info/pom.xml
+++ b/maven-projects/info/pom.xml
@@ -63,5 +63,4 @@
</dependency>
</dependencies>
-
</project>
\ No newline at end of file
diff --git a/maven-projects/pom.xml b/maven-projects/pom.xml
index 79d4b661..bd2e0bc4 100644
--- a/maven-projects/pom.xml
+++ b/maven-projects/pom.xml
@@ -75,5 +75,6 @@
<module>java</module>
<module>spark</module>
<module>info</module>
+ <module>proto</module>
</modules>
</project>
diff --git a/maven-projects/info/pom.xml b/maven-projects/proto/pom.xml
similarity index 56%
copy from maven-projects/info/pom.xml
copy to maven-projects/proto/pom.xml
index ea59280d..6e95e77a 100644
--- a/maven-projects/info/pom.xml
+++ b/maven-projects/proto/pom.xml
@@ -32,36 +32,50 @@
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>info</artifactId>
+ <artifactId>proto</artifactId>
<packaging>jar</packaging>
<version>0.13.0.dev-SNAPSHOT</version>
- <name>info</name>
+ <name>proto</name>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <protobuf-maven-plugin.version>2.3.0</protobuf-maven-plugin.version>
+ <protobuf.version>4.27.1</protobuf.version>
</properties>
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-common</artifactId>
- <version>3.4.0</version>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>${protobuf.version}</version>
+ <scope>compile</scope>
</dependency>
</dependencies>
-
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.github.ascopes</groupId>
+ <artifactId>protobuf-maven-plugin</artifactId>
+ <version>${protobuf-maven-plugin.version}</version>
+ <configuration>
+ <sourceDirectories>
+
<sourceDirectory>${project.basedir}/../../format</sourceDirectory>
+ </sourceDirectories>
+
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
+ <protocVersion>${protobuf.version}</protocVersion>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]