diff options
author | dimdim11 <dimdim11@yandex-team.com> | 2023-12-15 11:44:37 +0300 |
---|---|---|
committer | dimdim11 <dimdim11@yandex-team.com> | 2023-12-15 12:25:25 +0300 |
commit | d1374eadc86bb66d36b0182b13a3b080e2ee4d58 (patch) | |
tree | cb0733d8433652f401207782c98573c697a26503 | |
parent | 9f1609ba84aece694be7cd89ea209995032ab868 (diff) | |
download | ydb-d1374eadc86bb66d36b0182b13a3b080e2ee4d58.tar.gz |
Switch to use object attributes for consumer
Use object attribute for consumer
7 files changed, 47 insertions, 46 deletions
diff --git a/build/conf/java.conf b/build/conf/java.conf index a50e0e7b0f..5b926fba7f 100644 --- a/build/conf/java.conf +++ b/build/conf/java.conf @@ -503,8 +503,7 @@ macro LOCAL_SOURCES_JAR(File) { JAVA_CONTRIB_SEM= \ ${hide:TARGET} ${hide:AUTO_INPUT} \ - consumer_classpath $EXPORT_GRADLE_CLASSPATH \ - && consumer-classpath $EXPORT_GRADLE_CLASSPATH \ + consumer-classpath $EXPORT_GRADLE_CLASSPATH \ && consumer-jar ${MODDIR}/${REALPRJNAME}.jar \ && consumer-type contrib \ && peers_closure $MANAGED_PEERS_CLOSURE \ @@ -866,7 +865,6 @@ _DO_GRADLE_EXPORT_PUBLISHING_SEM= \ BUILD_JAR_SEM= \ ${hide:TARGET} ${hide:AUTO_INPUT} ${hide:APPLIED_EXCLUDES} \ jar $MODDIR $REALPRJNAME \ - && consumer_classpath $EXPORT_GRADLE_CLASSPATH \ && consumer-classpath $EXPORT_GRADLE_CLASSPATH \ && consumer-jar ${MODDIR}/${REALPRJNAME}.jar \ && consumer-type library \ @@ -880,7 +878,6 @@ BUILD_PROTO_JAR_SEM= \ ${hide:target} ${hide:AUTO_INPUT} \ jar_proto $MODDIR $REALPRJNAME \ $_JAVA_PROTO_SEM \ - && consumer_classpath $EXPORT_GRADLE_CLASSPATH \ && consumer-classpath $EXPORT_GRADLE_CLASSPATH \ && consumer-jar ${MODDIR}/${REALPRJNAME}.jar \ && consumer-type library \ diff --git a/build/export_generators/gradle/build.gradle.kts.jinja b/build/export_generators/gradle/build.gradle.kts.jinja index 306e35ad24..327b8fc8de 100644 --- a/build/export_generators/gradle/build.gradle.kts.jinja +++ b/build/export_generators/gradle/build.gradle.kts.jinja @@ -34,30 +34,31 @@ java { dependencies { {% for target in targets -%} -{% if target.junit5_test -%} +{% if target.junit5_test -%} testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") api("org.apache.commons:commons-math3:3.6.1") api("com.google.guava:guava:31.0.1-jre") -{% endif -%} -{% for library in target.consumer_classpath -%} -{% if targets|selectattr("app_main_class") -%} -{% if target.lib_excludes is defined and target.lib_excludes[library]|length > 0 -%} - implementation({{ library }}) { -{% for exclude in target.lib_excludes[library] -%} +{% endif -%} +{% for library in target.consumer -%} +{% set classpath = library.classpath -%} +{% if targets|selectattr("app_main_class") -%} +{% if target.lib_excludes is defined and target.lib_excludes[classpath]|length > 0 -%} + implementation({{ classpath }}) { +{% for exclude in target.lib_excludes[classpath] -%} exclude group: '{{ exclude[0] }}', module: '{{ exclude[1] }}' -{% endfor -%} +{% endfor -%} } -{% else -%} - implementation({{ library }}) -{% endif -%} -{% elif target.isTest -%} - testImplementation({{ library }}) -{% else -%} - api({{ library }}) -{% endif -%} -{% endfor -%} +{% else -%} + implementation({{ classpath }}) +{% endif -%} +{% elif target.isTest -%} + testImplementation({{ classpath }}) +{% else -%} + api({{ classpath }}) +{% endif -%} +{% endfor -%} {% endfor -%} } diff --git a/build/export_generators/gradle/build.gradle.kts.proto.jinja b/build/export_generators/gradle/build.gradle.kts.proto.jinja index c12ab0d4f3..43e6ec3529 100644 --- a/build/export_generators/gradle/build.gradle.kts.proto.jinja +++ b/build/export_generators/gradle/build.gradle.kts.proto.jinja @@ -26,9 +26,11 @@ java { } dependencies { -{% for library in targets[0].consumer_classpath -%} - api({{ library }}) -{% endfor -%} +{% if targets[0].consumer is defined -%} +{%- for library in targets[0].consumer -%} + api({{ library.classpath }}) +{% endfor -%} +{%- endif -%} {% if targets[0].proto_namespace is defined -%} protobuf(files(File(buildProtoDir, "{{ targets[0].proto_namespace }}"))) diff --git a/build/export_generators/gradle/generator.toml b/build/export_generators/gradle/generator.toml index 1226cdcdcb..a06a684a5e 100644 --- a/build/export_generators/gradle/generator.toml +++ b/build/export_generators/gradle/generator.toml @@ -49,7 +49,6 @@ with_kotlinc_plugin_serialization="bool" [attrs.dir] [attrs.induced] -consumer_classpath="list" consumer-classpath="str" consumer-jar="str" consumer-type="str" diff --git a/build/export_generators/ide-gradle/build.gradle.kts.jinja b/build/export_generators/ide-gradle/build.gradle.kts.jinja index 683f9b90e3..3d629c89d8 100644 --- a/build/export_generators/ide-gradle/build.gradle.kts.jinja +++ b/build/export_generators/ide-gradle/build.gradle.kts.jinja @@ -58,30 +58,31 @@ sourceSets.main.java.srcDirs += '{{ srcdir }}' dependencies { {% for target in targets -%} -{% if target.junit5_test -%} +{% if target.junit5_test -%} testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") api("org.apache.commons:commons-math3:3.6.1") api("com.google.guava:guava:31.0.1-jre") -{% endif -%} -{% for library in target.consumer_classpath -%} -{% if targets|selectattr("app_main_class") -%} -{% if target.lib_excludes is defined and target.lib_excludes[library]|length > 0 -%} - implementation({{ library }}) { -{% for exclude in target.lib_excludes[library] -%} +{% endif -%} +{% for library in target.consumer -%} +{% set classpath = library.classpath -%} +{% if targets|selectattr("app_main_class") -%} +{% if target.lib_excludes is defined and target.lib_excludes[classpath]|length > 0 -%} + implementation({{ classpath }}) { +{% for exclude in target.lib_excludes[classpath] -%} exclude group: '{{ exclude[0] }}', module: '{{ exclude[1] }}' -{% endfor -%} +{% endfor -%} } -{% else -%} - implementation({{ library }}) -{% endif -%} -{% elif target.isTest -%} - testImplementation({{ library }}) -{% else -%} - api({{ library }}) -{% endif -%} -{% endfor -%} +{% else -%} + implementation({{ classpath }}) +{% endif -%} +{% elif target.isTest -%} + testImplementation({{ classpath }}) +{% else -%} + api({{ classpath }}) +{% endif -%} +{% endfor -%} {% endfor -%} } diff --git a/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja b/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja index c12ab0d4f3..43e6ec3529 100644 --- a/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja +++ b/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja @@ -26,9 +26,11 @@ java { } dependencies { -{% for library in targets[0].consumer_classpath -%} - api({{ library }}) -{% endfor -%} +{% if targets[0].consumer is defined -%} +{%- for library in targets[0].consumer -%} + api({{ library.classpath }}) +{% endfor -%} +{%- endif -%} {% if targets[0].proto_namespace is defined -%} protobuf(files(File(buildProtoDir, "{{ targets[0].proto_namespace }}"))) diff --git a/build/export_generators/ide-gradle/generator.toml b/build/export_generators/ide-gradle/generator.toml index caa507e89b..9728685a12 100644 --- a/build/export_generators/ide-gradle/generator.toml +++ b/build/export_generators/ide-gradle/generator.toml @@ -49,7 +49,6 @@ with_kotlinc_plugin_serialization="bool" [attrs.dir] [attrs.induced] -consumer_classpath="list" consumer-classpath="str" consumer-jar="str" consumer-type="str" |