leiningen.protoc

Leiningen plugin for compiling Google Protocol Buffers

+proto-source-paths-default+

+protoc-timeout-default+

+protoc-version-default+

activate

(activate)

all-source-paths

(all-source-paths {:keys [proto-source-paths], :as project})

all-target-paths

(all-target-paths {:keys [proto-target-path protoc-grpc], :as project})

build-cmd

(build-cmd {:keys [protoc-exe protoc-grpc-exe]} {:keys [proto-source-paths builtin-proto-path]} {:keys [proto-target-path grpc-target-path]})

compile-proto!

(compile-proto! compiler-details source-paths target-paths timeout)

Compiles the sources using the provided configurations

compiler-details

(compiler-details {:keys [protoc-version protoc-grpc], :as project})

explain

(explain spec x)

get-arch

(get-arch)

get-os

(get-os)

jar-uri

(jar-uri jar-string)

java?

(java? file)

javac-hook

(javac-hook f & args)

latest-version

(latest-version artifact)

parse-response

(parse-response process)

print-warn-msg

(print-warn-msg e)

proto-files

(proto-files source-directory)

proto-jar-regex

proto?

(proto? file)

protoc

(protoc {:keys [protoc-timeout], :as project} & _)

Compiles Google Protocol Buffer proto files to Java Sources.

The following options are available and should be configured in the project.clj:

:protoc-version :: the Protocol Buffers Compiler version to use. Defaults to :latest

:proto-source-paths :: vector of absolute paths or paths relative to the project root that contain the .proto files to be compiled. Defaults to ["src/proto"]

:proto-target-path :: the absolute path or path relative to the project root where the sources should be generated. Defaults to ${target-path}/generated-sources/protobuf

:protoc-grpc :: true (or empty map) to generate interfaces for gRPC service definitions with default settings. Can optionally provide a map with the following configs: :version - version number for gRPC codegen. Defaults to :latest. :target-path - absolute path or path relative to the project root where the sources should be generated. Defaults to the :proto-target-path Defaults to false.

:protoc-timeout :: timeout value in seconds for the compilation process Defaults to 60

protoc-file

(protoc-file version classifier)

protoc-grpc-file

(protoc-grpc-file version classifier)

qualify-path

(qualify-path project path)

resolve!

(resolve! artifact protoc-version)

Resolves the Google Protocol Buffers code generation artifact+version in the local maven repository if it exists or downloads from Maven Central

resolve-builtin-proto!

(resolve-builtin-proto! project)

If the project.clj includes the com.google.protobuf/protobuf-java dependency, then we unpack it to a temporary location to use during compilation in order to make the builtin proto files available.

resolve-mismatched

(resolve-mismatched target-path source-path new-path)

resolve-protoc!

(resolve-protoc! protoc-version)

Given a string com.google.protobuf/protoc version or :latest, will ensure the required protoc executable is available in the local Maven repository either from a previous download, or will download from Maven Central.

resolve-protoc-grpc!

(resolve-protoc-grpc! protoc-version)

Given a string io.grpc/protoc-gen-grpc-java version or :latest, will ensure the required protoc executable is available in the local Maven repository either from a previous download, or will download from Maven Central.

resolve-target-path!

(resolve-target-path! target-path)

str->src-path-arg

(str->src-path-arg p)

target-path-default

(target-path-default project)

unpack-jar!

(unpack-jar! proto-jar)

validate

(validate {:keys [protoc-version protoc-grpc proto-source-paths proto-target-path protoc-timeout]})

Validates the input arguments and returns a vector of error messages

vargs

(vargs t)