diff --git a/pants.toml b/pants.toml index 509c709..a358d0e 100644 --- a/pants.toml +++ b/pants.toml @@ -14,6 +14,7 @@ backend_packages = [ "pants.backend.experimental.java.lint.google_java_format", "pants.backend.experimental.scala", "pants.backend.experimental.scala.lint.scalafmt", + "pants.backend.experimental.codegen.protobuf.java", ] [source] diff --git a/src/jvm/org/pantsbuild/example/lib/ExampleLib.java b/src/jvm/org/pantsbuild/example/lib/ExampleLib.java index 1aba7d3..ab7ea97 100644 --- a/src/jvm/org/pantsbuild/example/lib/ExampleLib.java +++ b/src/jvm/org/pantsbuild/example/lib/ExampleLib.java @@ -4,12 +4,21 @@ import com.google.common.base.Joiner; import com.google.common.io.Resources; import java.io.IOException; +import javax.annotation.Nonnull; +import org.pantsbuild.example.SubmitPynestJobRequest; public class ExampleLib { public static String hello() throws IOException { + SubmitPynestJobRequest request = new SubmitPynestJobRequest(); + ExampleLib.printScope(request); + String world = Resources.toString(Resources.getResource(ExampleLib.class, "world.txt"), Charsets.UTF_8) .strip(); return Joiner.on(" ").join("Hello", world); } + + private static void printScope(@Nonnull final SubmitPynestJobRequest request) { + System.out.println(request.getConfigScope()); + } } diff --git a/src/jvm/org/pantsbuild/example/proto/BUILD b/src/jvm/org/pantsbuild/example/proto/BUILD new file mode 100644 index 0000000..c994535 --- /dev/null +++ b/src/jvm/org/pantsbuild/example/proto/BUILD @@ -0,0 +1 @@ +protobuf_sources(grpc=True) diff --git a/src/jvm/org/pantsbuild/example/proto/example.proto b/src/jvm/org/pantsbuild/example/proto/example.proto new file mode 100644 index 0000000..ff172b7 --- /dev/null +++ b/src/jvm/org/pantsbuild/example/proto/example.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "org.pantsbuild.example"; +option java_outer_classname = "DatabricksAPIProto"; + +package org.pantsbuild.example; + + +message SubmitPynestJobRequest { + // To deduplicate retried job submits. This will be a UUID token generated by the requester + string idempotency_token = 1; + + // The git SHA commit id of the job you want to run + string git_sha = 2; + + // The preregisterd job name to run + string job_name = 3; + + // The service role to run the job with: e.g. etl, secure_etl, etc. + // If the caller does not have access to the role the request will be rejected + string requested_role = 4; + + // A list of arguments to pass to the job + repeated string task_args = 5; + + // Config service scope + string config_scope = 6; + + // The jar version for a data/jms-package-manager project that you want to run + string jmspm_jar_version = 100; +}