diff options
author | dimdim11 <dimdim11@yandex-team.com> | 2023-11-29 23:35:15 +0300 |
---|---|---|
committer | dimdim11 <dimdim11@yandex-team.com> | 2023-11-30 00:12:26 +0300 |
commit | bccf9ed4d65e4d7bd8f1c87610e61b39e2fe2537 (patch) | |
tree | 85a6d6cd03855f62f12783127aa18e94db5ac43c | |
parent | 18265f41838eee46825af0eaf6edcfebc01acb82 (diff) | |
download | ydb-bccf9ed4d65e4d7bd8f1c87610e61b39e2fe2537.tar.gz |
Refactor java.conf, add obj attributes without use they
Refactor java.conf, add obj attributes without use they
-rw-r--r-- | build/conf/java.conf | 62 | ||||
-rw-r--r-- | build/export_generators/gradle/generator.toml | 13 | ||||
-rw-r--r-- | build/export_generators/ide-gradle/generator.toml | 13 | ||||
-rw-r--r-- | build/plugins/java.py | 13 |
4 files changed, 75 insertions, 26 deletions
diff --git a/build/conf/java.conf b/build/conf/java.conf index c44a9e861d..be4cf9547f 100644 --- a/build/conf/java.conf +++ b/build/conf/java.conf @@ -272,7 +272,7 @@ module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT { .ALIASES=SRCS=_SRCS_NO_GLOBAL .ALLOWED=EMBED_JAVA_VCS_INFO .RESTRICTED=EXTERNAL_JAR - .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS + .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_CLASSPATH PEERDIR(build/platform/java/jdk) PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR @@ -440,7 +440,7 @@ module _JAR_BASE: _BARE_UNIT { .ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE .DEFAULT_NAME_GENERATOR=TwoDirNames .RESTRICTED=WITH_JDK RESOURCE RESOURCE_FILES - .GLOBAL=EXPORT_GRADLE_PROJECT_COORDS + .GLOBAL=EXPORT_GRADLE_CLASSPATH PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__ @@ -502,11 +502,14 @@ macro LOCAL_SOURCES_JAR(File) { } JAVA_CONTRIB_SEM= \ - consumer_classpath $EXPORT_GRADLE_PROJECT_COORDS ${hide:TARGET} ${hide:AUTO_INPUT} && \ - peers_closure $MANAGED_PEERS_CLOSURE && \ - peers_closure_coords $EXPORT_GRADLE_PROJECT_COORDS_GLOBAL && \ - exclude $EXCLUDE_VALUE && \ - IGNORED + ${hide:TARGET} ${hide:AUTO_INPUT} \ + consumer_classpath $EXPORT_GRADLE_CLASSPATH \ + && consumer.classpath $EXPORT_GRADLE_CLASSPATH \ + && consumer.jar ${MODDIR}/${REALPRJNAME}.jar \ + && consumer.type contrib \ + && peers_closure $MANAGED_PEERS_CLOSURE \ + && peers_closure_coords $EXPORT_GRADLE_CLASSPATH_GLOBAL \ + && IGNORED # tag:java-specific module JAVA_CONTRIB: _JAR_BASE { @@ -514,7 +517,7 @@ module JAVA_CONTRIB: _JAR_BASE { .PEERDIR_POLICY=as_include .SEM=JAVA_CONTRIB_SEM .FINAL_TARGET=yes - .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS + .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_CLASSPATH when ($JAR_RESOURCE_ID) { FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX}) @@ -855,14 +858,22 @@ _ADD_JAR_MAIN_SEM= && app_main_class ${_JAR_MAIN_CLASS} 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_version $PUBLISH_MAVEN_VERSION +_DO_GRADLE_EXPORT_PUBLISHING_SEM= \ + && publish True \ + && publish_group $MAVEN_EXPORT_GOUP_ID \ + && publish_version $PUBLISH_MAVEN_VERSION BUILD_JAR_SEM= \ - jar $MODDIR $REALPRJNAME ${hide:TARGET} ${hide:AUTO_INPUT} && \ - applied_excludes $EXCLUDED_EXPORT_GRADLE_PROJECT_COORDS_GLOBAL ${hide:APPLIED_EXCLUDES} && \ - excludes_rules $EXCLUDE_VALUE && \ - consumer_classpath $EXPORT_GRADLE_PROJECT_COORDS $_JAR_MAIN_SEM $_GRADLE_EXPORT_PUBLISHING_SEM && \ - exclude $EXCLUDE_VALUE \ + ${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 \ + && excludes_rules $EXCLUDE_VALUE \ + $_KOTLIN_SEM \ + $_JAR_MAIN_SEM \ + $_GRADLE_EXPORT_PUBLISHING_SEM \ $SEM_JAR_SOURCE_SET ### _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...) @@ -874,9 +885,15 @@ macro _EXPORT_GRADLE_TARGET_ATTR(NAME, VALUE...) { } BUILD_PROTO_JAR_SEM= \ - jar_proto $MODDIR $REALPRJNAME ${hide:target} ${hide:AUTO_INPUT} && \ - consumer_classpath $EXPORT_GRADLE_PROJECT_COORDS $_EXPORT_GRADLE_TARGET_ATTR(proto_namespace $PROTO_NAMESPACE) $_EXPORT_GRADLE_TARGET_ATTR(proto_grpc ${ext=yes:_GRPC_ENABLED}) && \ - exclude $EXCLUDE_VALUE + ${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}) \ + && consumer_classpath $EXPORT_GRADLE_CLASSPATH \ + && consumer.classpath $EXPORT_GRADLE_CLASSPATH \ + && consumer.jar ${MODDIR}/${REALPRJNAME}.jar \ + && consumer.type library \ + $_KOTLIN_SEM # tag:java-specific tag:internal ### @usage: JAR_LIBRARY() #internal @@ -889,7 +906,7 @@ module JAR_LIBRARY: _COMPILABLE_JAR_BASE { .FINAL_TARGET=yes .ALIASES=JAVA_SRCS=FULL_JAVA_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR .RESTRICTED=EXTERNAL_JAR - .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS + .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_CLASSPATH MODULE_SUFFIX=.jar PEERDIR(build/platform/java/jdk) @@ -1652,7 +1669,6 @@ macro ANNOTATION_PROCESSOR(Args...) { EXCLUDE_VALUE= ### EXCLUDE(prefixes) ### -### The macro is in development. ### Specifies which libraries should be excluded from the classpath. macro EXCLUDE(Args...) { SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args) @@ -1845,6 +1861,14 @@ KOTLIN_VERSION=1.9.20 KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.9.20/ya.dependency_management.inc GROOVY_VERSION=3.0.5 +_KOTLIN_SEM= \ + && kotlin_version ${KOTLIN_VERSION} \ + && with_kotlin ${WITH_KOTLIN_VALUE} \ + && with_kotlinc_plugin_allopen ${WITH_KOTLINC_PLUGIN_ALLOPEN} \ + && with_kotlinc_plugin_lombok ${WITH_KOTLINC_PLUGIN_LOMBOK} \ + && with_kotlinc_plugin_noarg ${WITH_KOTLINC_PLUGIN_NOARG} \ + && with_kotlinc_plugin_serialization ${WITH_KOTLINC_PLUGIN_SERIALIZATION} + # tag:java-specific DIRECT_DEPS_ONLY_VALUE= ### @usage: DIRECT_DEPS_ONLY diff --git a/build/export_generators/gradle/generator.toml b/build/export_generators/gradle/generator.toml index 5040216c73..6a640d81e5 100644 --- a/build/export_generators/gradle/generator.toml +++ b/build/export_generators/gradle/generator.toml @@ -26,11 +26,16 @@ app_main_class="str" publish="flag" publish_group="str" publish_version="str" -applied_excludes="list" peers_closure="list" peers_closure_coords="list" excludes_rules="list" -exclude="list" + +kotlin_version="str" +with_kotlin="bool" +with_kotlinc_plugin_allopen="bool" +with_kotlinc_plugin_lombok="bool" +with_kotlinc_plugin_noarg="bool" +with_kotlinc_plugin_serialization="bool" [attrs.root] @@ -38,6 +43,10 @@ exclude="list" [attrs.induced] consumer_classpath="list" +"consumer.classpath"="list" +"consumer.jar"="list" +"consumer.type"="list" +"consumer.prebuilt"="flag" [merge] test=[ diff --git a/build/export_generators/ide-gradle/generator.toml b/build/export_generators/ide-gradle/generator.toml index f882805933..9b88d62d4d 100644 --- a/build/export_generators/ide-gradle/generator.toml +++ b/build/export_generators/ide-gradle/generator.toml @@ -25,19 +25,28 @@ app_main_class="str" publish="flag" publish_group="str" publish_version="str" -applied_excludes="list" peers_closure="list" peers_closure_coords="list" excludes_rules="list" -exclude="list" jar_source_set="list" +kotlin_version="str" +with_kotlin="bool" +with_kotlinc_plugin_allopen="bool" +with_kotlinc_plugin_lombok="bool" +with_kotlinc_plugin_noarg="bool" +with_kotlinc_plugin_serialization="bool" + [attrs.root] [attrs.dir] [attrs.induced] consumer_classpath="list" +"consumer.classpath"="list" +"consumer.jar"="list" +"consumer.type"="list" +"consumer.prebuilt"="flag" [merge] test=[ diff --git a/build/plugins/java.py b/build/plugins/java.py index ebf4af8f1c..ee04a37674 100644 --- a/build/plugins/java.py +++ b/build/plugins/java.py @@ -466,14 +466,21 @@ def on_setup_maven_export_coords_if_need(unit, *args): unit.set(['MAVEN_EXPORT_COORDS_GLOBAL', _maven_coords_for_project(unit, args[0])]) +def _get_classpath(unit, dir): + if dir.startswith(CONTRIB_JAVA_PREFIX): + return '\\"{}\\"'.format(_maven_coords_for_project(unit, dir).rstrip(':')) + else: + return 'project(\\":{}\\")'.format(dir.replace('/', ':')) + + def on_setup_project_coords_if_needed(unit, *args): if not unit.enabled('EXPORT_GRADLE'): return project_dir = args[0] if project_dir.startswith(CONTRIB_JAVA_PREFIX): - value = '\\"{}\\"'.format(_maven_coords_for_project(unit, project_dir).rstrip(':')) + value = '\\"{}\\"'.format(_get_classpath(unit, project_dir).rstrip(':')) else: value = 'project(\\":{}\\")'.format(project_dir.replace('/', ':')) - unit.set(['EXPORT_GRADLE_PROJECT_COORDS', value]) - unit.set(['EXPORT_GRADLE_PROJECT_COORDS_GLOBAL', value]) + unit.set(['EXPORT_GRADLE_CLASSPATH', value]) + unit.set(['EXPORT_GRADLE_CLASSPATH_GLOBAL', value]) |