kotlin_plugins.jinja 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {%- if target.with_kotlinc_plugin_allopen|length -%}
  2. {%- set allopen_annotations = [] -%}
  3. {%- if target.with_kotlinc_plugin_allopen|select('eq', 'preset=spring')|length -%}
  4. {%- set allopen_annotations = allopen_annotations + ['org.springframework.stereotype.Component', 'org.springframework.transaction.annotation.Transactional', 'org.springframework.scheduling.annotation.Async', 'org.springframework.cache.annotation.Cacheable', 'org.springframework.boot.test.context.SpringBootTest', 'org.springframework.validation.annotation.Validated'] -%}
  5. {%- endif -%}
  6. {%- if target.with_kotlinc_plugin_allopen|select('eq', 'preset=quarkus')|length -%}
  7. {%- set allopen_annotations = allopen_annotations + ['javax.enterprise.context.ApplicationScoped', 'javax.enterprise.context.RequestScoped'] -%}
  8. {%- endif -%}
  9. {%- if target.with_kotlinc_plugin_allopen|select('eq', 'preset=micronaut')|length -%}
  10. {%- set allopen_annotations = allopen_annotations + ['io.micronaut.aop.Around', 'io.micronaut.aop.Introduction', 'io.micronaut.aop.InterceptorBinding', 'io.micronaut.aop.InterceptorBindingDefinitions'] -%}
  11. {%- endif -%}
  12. {%- if target.with_kotlinc_plugin_allopen|select('startsWith', 'annotation=')|length -%}
  13. {%- set sannotations = target.with_kotlinc_plugin_allopen|select('startsWith', 'annotation=')|join('|')|replace('annotation=','') -%}
  14. {%- set annotations = split(sannotations, '|') -%}
  15. {%- set allopen_annotations = allopen_annotations + annotations -%}
  16. {%- endif -%}
  17. {%- set allopen_options = target.with_kotlinc_plugin_allopen|reject('startsWith', 'preset=')|reject('startsWith', 'annotation=')|reject('eq', 'default') %}
  18. allOpen {
  19. {%- if allopen_options|length -%}
  20. {%- for option in allopen_options|unique %}
  21. {{ option }}
  22. {%- endfor -%}
  23. {%- endif %}
  24. {%- if allopen_annotations|length -%}
  25. {%- for annotation in allopen_annotations|unique %}
  26. annotation("{{ annotation }}")
  27. {%- endfor -%}
  28. {%- endif %}
  29. }
  30. {% endif -%}
  31. {%- if target.with_kotlinc_plugin_noarg|length -%}
  32. {%- set noarg_annotations = [] -%}
  33. {%- if target.with_kotlinc_plugin_noarg|select('eq', 'preset=jpa')|length -%}
  34. {%- set noarg_annotations = noarg_annotations + ['javax.persistence.Entity', 'javax.persistence.Embeddable', 'javax.persistence.MappedSuperclass', 'jakarta.persistence.Entity', 'jakarta.persistence.Embeddable', 'jakarta.persistence.MappedSuperclass'] -%}
  35. {%- endif -%}
  36. {%- if target.with_kotlinc_plugin_noarg|select('startsWith', 'annotation=')|length -%}
  37. {%- set sannotations = target.with_kotlinc_plugin_noarg|select('startsWith', 'annotation=')|join('|')|replace('annotation=','') -%}
  38. {%- set annotations = split(sannotations, '|') -%}
  39. {%- set noarg_annotations = noarg_annotations + annotations -%}
  40. {%- endif -%}
  41. {%- set noarg_options = target.with_kotlinc_plugin_noarg|reject('startsWith', 'preset=')|reject('startsWith', 'annotation=')|reject('eq', 'default') %}
  42. noArg {
  43. {%- if noarg_options|length -%}
  44. {%- for option in noarg_options|unique %}
  45. {{ option }}
  46. {%- endfor -%}
  47. {%- endif %}
  48. {%- if noarg_annotations|length -%}
  49. {%- for annotation in noarg_annotations|unique %}
  50. annotation("{{ annotation }}")
  51. {%- endfor -%}
  52. {%- endif %}
  53. }
  54. {% endif -%}
  55. {%- if with_kotlin %}
  56. kotlin {
  57. jvmToolchain({{ jdk_version }})
  58. }
  59. {% endif -%}