From ed80db0371505d0316fe6595556531f96fe9117f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?npofsi=20koi=20=7C=20N/P=E7=A1=85?= Date: Mon, 27 Oct 2025 10:58:52 +0800 Subject: [PATCH 1/2] [Build] Add dependency for protoc --- .../dolphinscheduler-task-grpc/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/pom.xml index aade681d5045..13dc2273fd91 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/pom.xml @@ -46,6 +46,11 @@ ${project.version} provided + + com.github.os72 + protoc-jar + 3.11.4 + com.google.code.findbugs jsr305 From a3b8cb33ebd1d03f7fac0e0e08167e2930b5890a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?npofsi=20koi=20=7C=20N/P=E7=A1=85?= Date: Sun, 9 Nov 2025 23:40:03 +0800 Subject: [PATCH 2/2] [Feat] Add desc file parser --- .../dolphinscheduler-task-grpc/pom.xml | 19 ++++++++++++++ .../grpc/protofactory/DynamicService.java | 4 +++ .../task/grpc/protofactory/ProtoFactory.java | 25 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protofactory/DynamicService.java create mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protofactory/ProtoFactory.java diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/pom.xml index 13dc2273fd91..5f2753f24ff6 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/pom.xml @@ -46,6 +46,25 @@ ${project.version} provided + + com.github.os72 + protobuf-dynamic + 0.9.5 + + + com.google.code.findbugs + jsr305 + + + com.google.guava + guava + + + com.google.errorprone + error_prone_annotations + + + com.github.os72 protoc-jar diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protofactory/DynamicService.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protofactory/DynamicService.java new file mode 100644 index 000000000000..7ed7f4433117 --- /dev/null +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protofactory/DynamicService.java @@ -0,0 +1,4 @@ +package org.apache.dolphinscheduler.plugin.task.grpc.protofactory; + +public class DynamicService { +} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protofactory/ProtoFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protofactory/ProtoFactory.java new file mode 100644 index 000000000000..aa2efa735ec9 --- /dev/null +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protofactory/ProtoFactory.java @@ -0,0 +1,25 @@ +package org.apache.dolphinscheduler.plugin.task.grpc.protofactory; +import com.github.os72.protocjar.Protoc; +import com.google.protobuf.DescriptorProtos; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +public class ProtoFactory { + public static void runProtoc(String[] args) throws IOException, InterruptedException { + +// String[] args = {"-v2.4.1", "--help"}; + Protoc.runProtoc(args); + } + + public static void loadDescFile() throws IOException { + final FileInputStream fileInputStream = new FileInputStream("directory/descriptors.dsc"); + final DescriptorProtos.FileDescriptorSet descriptorSet = DescriptorProtos.FileDescriptorSet.parseFrom(fileInputStream); + + for (DescriptorProtos.FileDescriptorProto fileDescriptor : descriptorSet.getFileList()) { + // Do as you wish with fileDescriptor + } + } +} +