dependencies.jinja 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {#- empty string #}
  2. dependencies {
  3. {%- for library in target.consumer if library.classpath -%}
  4. {%- if has_errorprone -%}
  5. {%- if library.prebuilt and (library.type != "contrib" or build_contribs) and ("contrib/java/com/google/errorprone/error_prone_annotations" in library.jar) -%}
  6. {%- set errorprone_version = library.jar|replace("contrib/java/com/google/errorprone/error_prone_annotations/", "") -%}
  7. {%- set errorprone_parts = split(errorprone_version, '/', 2) %}
  8. errorprone("com.google.errorprone:error_prone_core:{{ errorprone_parts[0] }}")
  9. {%- endif -%}
  10. {%- endif -%}
  11. {%- if library.prebuilt and library.jar and (library.type != "contrib" or build_contribs) %}
  12. implementation(files("$project_root/{{ library.jar }}"))
  13. {%- else -%}
  14. {%- set classpath = library.classpath -%}
  15. {%- if classpath|replace('"','') == classpath -%}
  16. {%- set classpath = '"' + classpath + '"' -%}
  17. {%- endif -%}
  18. {%- if library.type != "contrib" %}
  19. {%- if library.testdep %}
  20. implementation(project(path = ":{{ library.testdep | replace("/", ":") }}", configuration = "testArtifacts"))
  21. {%- else %}
  22. implementation({{ classpath }})
  23. {%- endif -%}
  24. {%- else %}
  25. api({{ classpath }})
  26. {%- endif -%}
  27. {%- if library.excludes.consumer is defined %} {
  28. {% for exclude in library.excludes.consumer if exclude.classpath -%}
  29. {%- set classpath = exclude.classpath|replace('"','') -%}
  30. {%- set classpath_parts = split(classpath, ':') -%}
  31. exclude(group = "{{ classpath_parts[0] }}", module = "{{ classpath_parts[1] }}")
  32. {% endfor -%}
  33. }
  34. {%- endif -%}
  35. {%- endif -%}
  36. {%- endfor -%}
  37. {%- for annotation_processor in target.use_annotation_processor %}
  38. annotationProcessor(files("$project_root/{{ annotation_processor}}"))
  39. {%- endfor -%}
  40. {%- for extra_target in extra_targets -%}
  41. {%- for library in extra_target.consumer if library.classpath -%}
  42. {%- if library.prebuilt and library.jar and (library.type != "contrib" or build_contribs) %}
  43. testImplementation(files("$project_root/{{ library.jar }}"))
  44. {%- else -%}
  45. {%- set classpath = library.classpath -%}
  46. {%- if classpath|replace('"','') == classpath -%}
  47. {%- set classpath = '"' + classpath + '"' -%}
  48. {%- endif %}
  49. {%- if library.type != "contrib" and library.testdep %}
  50. testImplementation(project(path = ":{{ library.testdep | replace("/", ":") }}", configuration = "testArtifacts"))
  51. {%- else %}
  52. testImplementation({{ classpath }})
  53. {%- endif -%}
  54. {%- if library.excludes.consumer is defined %} {
  55. {% for exclude in library.excludes.consumer if exclude.classpath -%}
  56. {%- set classpath = exclude.classpath|replace('"','') -%}
  57. {%- set classpath_parts = split(classpath, ':') -%}
  58. exclude(group = "{{ classpath_parts[0] }}", module = "{{ classpath_parts[1] }}")
  59. {% endfor -%}
  60. }
  61. {%- endif -%}
  62. {%- endif -%}
  63. {%- endfor -%}
  64. {%- for annotation_processor in extra_target.use_annotation_processor %}
  65. testAnnotationProcessor(files("$project_root/{{ annotation_processor}}"))
  66. {%- endfor -%}
  67. {%- endfor %}
  68. }