protobuf.jinja 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {#- empty string #}
  2. protobuf {
  3. protoc {
  4. // Download from repositories
  5. artifact = "com.google.protobuf:protoc:{%- if target.proto_compiler_version -%}{{ target.proto_compiler_version }}{%- else -%}3.22.5{%- endif -%}"
  6. }
  7. {%- if target.proto_grpc %}
  8. plugins {
  9. id("grpc") {
  10. artifact = "io.grpc:protoc-gen-grpc-java:{%- if target.proto_grpc_version -%}{{ target.proto_grpc_version }}{%- else -%}1.45.0{%- endif -%}"
  11. }
  12. {%- if target.proto_kotlin_grpc %}
  13. id("grpckt") {
  14. artifact = "io.grpc:protoc-gen-grpc-kotlin:{%- if target.proto_kotlin_grpc_version -%}{{ target.proto_kotlin_grpc_version }}{%- else -%}1.3.1{%- endif -%}:jdk8@jar"
  15. }
  16. {%- endif %}
  17. }
  18. {%- endif %}
  19. {%- if target.proto_kotlin or target.proto_grpc %}
  20. generateProtoTasks {
  21. all().forEach {
  22. {%- if target.proto_grpc %}
  23. it.plugins {
  24. id("grpc")
  25. {%- if target.proto_kotlin_grpc %}
  26. id("grpckt")
  27. {%- endif %}
  28. }
  29. {%- endif %}
  30. {%- if target.proto_kotlin or target.proto_kotlin_grpc %}
  31. it.builtins {
  32. create("kotlin")
  33. }
  34. {%- endif %}
  35. }
  36. }
  37. {%- endif %}
  38. }