aboutsummaryrefslogtreecommitdiffstats
path: root/build/export_generators/ide-gradle/dependencies.jinja
blob: cf12326bbf2a0d6a744cab1cda3ab91c66b3d76f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{#- empty string #}
dependencies {
{%- for library in target.consumer if library.classpath -%}
{%-     if has_errorprone -%}
{%-         if library.prebuilt and (library.type != "contrib" or build_contribs) and ("contrib/java/com/google/errorprone/error_prone_annotations" in library.jar) -%}
{%-             set errorprone_version = library.jar|replace("contrib/java/com/google/errorprone/error_prone_annotations/", "") -%}
{%-             set errorprone_parts = split(errorprone_version, '/', 2) %}
    errorprone("com.google.errorprone:error_prone_core:{{ errorprone_parts[0] }}")
{%-         endif -%}
{%-     endif -%}

{%-     if library.prebuilt and library.jar and (library.type != "contrib" or build_contribs) %}
    implementation(files("$project_root/{{ library.jar }}"))
{%-     else -%}
{%-         set classpath = library.classpath -%}
{%-         if classpath|replace('"','') == classpath -%}
{%-             set classpath = '"' + classpath + '"' -%}
{%-         endif -%}
{%-         if library.type != "contrib" %}
{%-             if library.testdep %}
    implementation(project(path = ":{{ library.testdep | replace("/", ":") }}", configuration = "testArtifacts"))
{%-             else %}
    implementation({{ classpath }})
{%-             endif -%}
{%-         else %}
    api({{ classpath }})
{%-         endif -%}
{%-         if library.excludes.consumer is defined %} {
{%              for exclude in library.excludes.consumer if exclude.classpath -%}
{%-                 set classpath = exclude.classpath|replace('"','') -%}
{%-                 set classpath_parts = split(classpath, ':') -%}
        exclude(group = "{{ classpath_parts[0] }}", module = "{{ classpath_parts[1] }}")
{%              endfor -%}
    }
{%-         endif -%}
{%-     endif -%}
{%- endfor -%}

{%- for annotation_processor in target.use_annotation_processor %}
    annotationProcessor(files("$project_root/{{ annotation_processor}}"))
{%- endfor -%}

{%- for extra_target in extra_targets -%}
{%-     for library in extra_target.consumer if library.classpath -%}
{%-         if library.prebuilt and library.jar and (library.type != "contrib" or build_contribs) %}
    testImplementation(files("$project_root/{{ library.jar }}"))
{%-         else -%}
{%-             set classpath = library.classpath -%}
{%-             if classpath|replace('"','') == classpath -%}
{%-                 set classpath = '"' + classpath + '"' -%}
{%-             endif %}
{%-             if library.type != "contrib" and library.testdep %}
    testImplementation(project(path = ":{{ library.testdep | replace("/", ":") }}", configuration = "testArtifacts"))
{%-             else %}
    testImplementation({{ classpath }})
{%-             endif -%}
{%-             if library.excludes.consumer is defined %} {
{%                  for exclude in library.excludes.consumer if exclude.classpath -%}
{%-                     set classpath = exclude.classpath|replace('"','') -%}
{%-                     set classpath_parts = split(classpath, ':') -%}
        exclude(group = "{{ classpath_parts[0] }}", module = "{{ classpath_parts[1] }}")
{%                  endfor -%}
    }
{%-             endif -%}
{%-         endif -%}
{%-     endfor -%}
{%-     for annotation_processor in extra_target.use_annotation_processor %}
    testAnnotationProcessor(files("$project_root/{{ annotation_processor}}"))
{%-     endfor -%}
{%- endfor %}
}