Browse Source

Add sematic attributes, refactor java.conf, scripts for manual check yexport output for yt, ydb, catboost

dimdim11 1 year ago
parent
commit
281e071434

+ 25 - 16
build/conf/java.conf

@@ -288,7 +288,7 @@ module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
         otherwise {
             MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
         }
-        MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GOUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
+        MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GROUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
     }
 
     PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL PACKAGE_UNION
@@ -859,8 +859,8 @@ GRADLE_EXPORT_PUBLISHING=no
 _GRADLE_EXPORT_PUBLISHING_SEM=
 PUBLISH_MAVEN_VERSION=no
 _DO_GRADLE_EXPORT_PUBLISHING_SEM= \
-    && publish True \
-    && publish_group $MAVEN_EXPORT_GOUP_ID \
+    && publish \
+    && publish_group $MAVEN_EXPORT_GROUP_ID \
     && publish_version $PUBLISH_MAVEN_VERSION
 
 BUILD_JAR_SEM= \
@@ -876,19 +876,10 @@ BUILD_JAR_SEM= \
     $_GRADLE_EXPORT_PUBLISHING_SEM \
     $SEM_JAR_SOURCE_SET
 
-### _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...)
-###
-### Add target attribute `NAME` for .SEM if `VALUE` is non-empty
-### ` && $Name $Value
-macro _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...) {
-    .SEM=${pre= && $NAME :VALUE}
-}
-
 BUILD_PROTO_JAR_SEM= \
     ${hide:target} ${hide:AUTO_INPUT} \
     jar_proto $MODDIR $REALPRJNAME \
-    $_EXPORT_GRADLE_TARGET_ATTR(proto_namespace $PROTO_NAMESPACE) \
-    $_EXPORT_GRADLE_TARGET_ATTR(proto_grpc ${ext=yes:_GRPC_ENABLED}) \
+    $_JAVA_PROTO_SEM \
     && consumer_classpath $EXPORT_GRADLE_CLASSPATH \
     && consumer.classpath $EXPORT_GRADLE_CLASSPATH \
     && consumer.jar ${MODDIR}/${REALPRJNAME}.jar \
@@ -977,7 +968,7 @@ module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
         otherwise {
             MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM
         }
-        MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GOUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
+        MAVEN_EXPORT_COORDS_GLOBAL=$MAVEN_EXPORT_GROUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
     }
 
     when ($SOURCES_JAR == "yes") {
@@ -1645,14 +1636,14 @@ when ($SAVE_JAVAC_GENERATED_SRCS) {
 # tag:java-specific
 # TODO: MAVEN_GROUP_ID_VALUE is only used by jbuild remove it after YMAKE-45 and YMAKE-46
 MAVEN_GROUP_ID_VALUE=
-MAVEN_EXPORT_GOUP_ID=ru.yandex
+MAVEN_EXPORT_GROUP_ID=ru.yandex
 ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
 ###
 ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
 ### Have no effect on regular build.
 macro MAVEN_GROUP_ID(Arg, VERSION="no") {
     SET(MAVEN_GROUP_ID_VALUE $Arg)
-    SET(MAVEN_EXPORT_GOUP_ID $Arg)
+    SET(MAVEN_EXPORT_GROUP_ID $Arg)
     SET(PUBLISH_MAVEN_VERSION $VERSION)
 }
 
@@ -1869,6 +1860,24 @@ _KOTLIN_SEM= \
     && with_kotlinc_plugin_noarg ${WITH_KOTLINC_PLUGIN_NOARG} \
     && with_kotlinc_plugin_serialization ${WITH_KOTLINC_PLUGIN_SERIALIZATION}
 
+
+_JAVA_PROTO_GRPC_SEM=
+when ($_GRPC_ENABLED == "yes") {
+    _JAVA_PROTO_GRPC_SEM= && proto_grpc && proto_grpc_version ${JAVA_GRPC_VERSION}
+}
+
+_JAVA_PROTO_NAMESPACE_SEM=
+when ($PROTO_NAMESPACE != "") {
+    _JAVA_PROTO_NAMESPACE_SEM= && proto_namespace $PROTO_NAMESPACE
+}
+
+_JAVA_PROTO_SEM= \
+    ${_JAVA_PROTO_NAMESPACE_SEM} \
+    && proto_compiler_version ${JAVA_PROTO_COMPILER_VERSION} \
+    && proto_runtime_version ${JAVA_PROTO_RUNTIME_VERSION} \
+    && proto_common_version ${JAVA_PROTO_COMMON_VERSION} \
+    ${_JAVA_PROTO_GRPC_SEM}
+
 # tag:java-specific
 DIRECT_DEPS_ONLY_VALUE=
 ### @usage: DIRECT_DEPS_ONLY

+ 1 - 0
build/conf/proto.conf

@@ -446,6 +446,7 @@ macro USE_JAVALITE() {
 }
 
 # tag:proto tag:java-specific
+JAVA_PROTO_COMPILER_VERSION = 3.22.5
 JAVA_PROTO_RUNTIME_VERSION = 3.22.5
 JAVA_PROTO_COMMON_VERSION = 1.12.0
 JAVA_GRPC_VERSION = 1.43.2

+ 9 - 3
build/export_generators/gradle/build.gradle.kts.proto.jinja

@@ -40,9 +40,15 @@ dependencies {
 protobuf {
     protoc {
         // Download from repositories
-        artifact = "com.google.protobuf:protoc:3.22.5"
+        artifact = "com.google.protobuf:protoc:
+{%- if targets[0].proto_compiler_version is defined -%}
+{{ targets[0].proto_compiler_version }}
+{%- else -%}
+3.22.5
+{%- endif -%}
+"
     }
-{% if targets[0].proto_grpc is defined -%}
+{%  if targets[0].proto_grpc is defined -%}
     plugins {
         id("grpc") {
             artifact = "io.grpc:protoc-gen-grpc-java:1.45.0"
@@ -55,7 +61,7 @@ protobuf {
             }
         }
     }
-{% endif -%}
+{%- endif %}
 }
 
 val prepareProto = tasks.register<Copy>("prepareProto") {

+ 13 - 6
build/export_generators/gradle/generator.toml

@@ -15,21 +15,28 @@ template="build.gradle.kts.jinja"
 template={ path="build.gradle.kts.proto.jinja", dest="build.gradle.kts" }
 
 [attrs.target]
-proto_files="list"
-proto_grpc="flag"
-proto_namespace="str"
 required_jdk="str"
 add_vcs_info_to_mf="bool"
 junit4_test="flag"
 junit5_test="flag"
 app_main_class="str"
-publish="flag"
-publish_group="str"
-publish_version="str"
 peers_closure="list"
 peers_closure_coords="list"
 excludes_rules="list"
 
+publish="flag"
+publish_group="str"
+publish_version="str"
+
+proto_files="list"
+proto_namespace="str"
+proto_compiler_version="str"
+proto_runtime_version="str"
+proto_common_version="str"
+
+proto_grpc="flag"
+proto_grpc_version="str"
+
 kotlin_version="str"
 with_kotlin="bool"
 with_kotlinc_plugin_allopen="bool"

+ 9 - 3
build/export_generators/ide-gradle/build.gradle.kts.proto.jinja

@@ -40,9 +40,15 @@ dependencies {
 protobuf {
     protoc {
         // Download from repositories
-        artifact = "com.google.protobuf:protoc:3.22.5"
+        artifact = "com.google.protobuf:protoc:
+{%- if targets[0].proto_compiler_version is defined -%}
+{{ targets[0].proto_compiler_version }}
+{%- else -%}
+3.22.5
+{%- endif -%}
+"
     }
-{% if targets[0].proto_grpc is defined -%}
+{%  if targets[0].proto_grpc is defined -%}
     plugins {
         id("grpc") {
             artifact = "io.grpc:protoc-gen-grpc-java:1.45.0"
@@ -55,7 +61,7 @@ protobuf {
             }
         }
     }
-{% endif -%}
+{%- endif %}
 }
 
 val prepareProto = tasks.register<Copy>("prepareProto") {

+ 13 - 6
build/export_generators/ide-gradle/generator.toml

@@ -14,22 +14,29 @@ template="build.gradle.kts.jinja"
 template={ path="build.gradle.kts.proto.jinja", dest="build.gradle.kts" }
 
 [attrs.target]
-proto_files="list"
-proto_grpc="flag"
-proto_namespace="str"
 required_jdk="str"
 add_vcs_info_to_mf="bool"
 junit4_test="flag"
 junit5_test="flag"
 app_main_class="str"
-publish="flag"
-publish_group="str"
-publish_version="str"
 peers_closure="list"
 peers_closure_coords="list"
 excludes_rules="list"
 jar_source_set="list"
 
+publish="flag"
+publish_group="str"
+publish_version="str"
+
+proto_files="list"
+proto_namespace="str"
+proto_compiler_version="str"
+proto_runtime_version="str"
+proto_common_version="str"
+
+proto_grpc="flag"
+proto_grpc_version="str"
+
 kotlin_version="str"
 with_kotlin="bool"
 with_kotlinc_plugin_allopen="bool"