Skip to content

Commit 5d5c6dc

Browse files
committed
Merge pull request #16761 from ydb-platform/merge-libs-250404-0808
2 parents 0772aff + 1340d5e commit 5d5c6dc

File tree

194 files changed

+2791
-1125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+2791
-1125
lines changed

build/conf/go.conf

Lines changed: 103 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,23 +1020,59 @@ module GO_TEST: GO_PROGRAM {
10201020
}
10211021

10221022
# tag:go-specific
1023+
_GO_TOOL_ENV=${env:"PATH=${GO_TOOLS_ROOT}/bin"} ${env:"GOROOT=${GO_TOOLS_ROOT}"} ${env:"GOCACHE=${BINDIR}/.gocache"}
1024+
1025+
# tag:go-specific
1026+
_GO_GO_MOD=${ARCADIA_ROOT}/go.mod
1027+
_GO_MODULES_TXT=${ARCADIA_ROOT}/vendor/modules.txt
1028+
1029+
# tag:go-specific
1030+
_GO_TOOL_MOCKGEN=vendor/go.uber.org/mock/mockgen
1031+
_GO_TOOL_REFLECTOR=library/go/mockgen/reflector
1032+
_GO_TOOL_OAPI_CODEGEN=vendor/github.com/deepmap/oapi-codegen/cmd/oapi-codegen
1033+
_GO_TOOL_OAPI_CODEGEN_TAXI=taxi/infra/go/platform/tools/pkg/deepmap/oapi-codegen/cmd/oapi-codegen
1034+
_GO_TOOL_OAPI_CODEGEN_TAXI_1134=taxi/infra/go/platform/tools/pkg1134/oapi-codegen-1.13.4/cmd/oapi-codegen
1035+
1036+
# tag:go-specific
1037+
### @usage: GO_MOCKGEN_FROM(Path)
1038+
###
1039+
### Part of Go mock module definition, both reflect and source mode.
1040+
### Defines path for mock interfaces source
10231041
macro GO_MOCKGEN_FROM(Path) {
10241042
SET(MOCKGEN_FROM ${Path})
10251043
SET(MOCKGEN_MODULE ${GO_ARCADIA_PROJECT_PREFIX}${Path})
10261044
}
10271045

10281046
# tag:go-specific
1047+
### @usage: GO_MOCKGEN_CONTRIB_FROM(Path)
1048+
###
1049+
### Part of Go mock module definition, both reflect and source mode.
1050+
### Defines path for mock interfaces source for contrib (vendored) sources
10291051
macro GO_MOCKGEN_CONTRIB_FROM(Path) {
10301052
SET(MOCKGEN_FROM ${GO_CONTRIB_PROJECT_PREFIX}${Path})
10311053
SET(MOCKGEN_MODULE ${Path})
10321054
}
10331055

10341056
# tag:go-specific
10351057
macro GO_MOCKGEN_TYPES(Types...) {
1036-
SET(MOCKGEN_TYPES ${join=\\${__COMMA__}:Types})
1058+
SET(MOCKGEN_TYPES ${join=,:Types})
10371059
}
10381060

1061+
MOCKGEN_PACKAGE="mocks"
10391062
# tag:go-specific
1063+
### @usage: GO_MOCKGEN_PACKAGE(package)
1064+
###
1065+
### Part of Go mock module definition, source mode.
1066+
### Specifies generated package name, instead of default one "mocks"
1067+
macro GO_MOCKGEN_PACKAGE(PACKAGE) {
1068+
SET(MOCKGEN_PACKAGE ${PACKAGE})
1069+
}
1070+
1071+
# tag:go-specific
1072+
### @usage: GO_MOCKGEN_REFLECT()
1073+
###
1074+
### Part of Go mock module definition, reflect mode.
1075+
### Creates generator program, expected in `gen` folder
10401076
macro GO_MOCKGEN_REFLECT() {
10411077
PEERDIR(${GOSTD}/encoding/gob)
10421078
PEERDIR(${GOSTD}/flag)
@@ -1047,20 +1083,80 @@ macro GO_MOCKGEN_REFLECT() {
10471083
PEERDIR(vendor/go.uber.org/mock/mockgen/model)
10481084
PEERDIR(${MOCKGEN_FROM})
10491085

1050-
RUN_PROGRAM(vendor/go.uber.org/mock/mockgen -prog_only $MOCKGEN_MODULE $MOCKGEN_TYPES STDOUT main.go CWD $ARCADIA_BUILD_ROOT)
1086+
.CMD=${cwd:BINDIR} ${tool:_GO_TOOL_REFLECTOR} ${MOCKGEN_MODULE} ${MOCKGEN_TYPES} ${stdout;output:"main.go"} ${hide;kv:"p GR"} ${hide;kv:"pc blue"}
1087+
.STRUCT_CMD=yes
10511088
}
10521089

10531090
# tag:go-specific
1054-
_GO_EXE_SUFFIX=
1055-
when ($OS_WINDOWS == "yes") {
1056-
_GO_EXE_SUFFIX=.exe
1091+
macro _GO_MOCKGEN_MOCKS_IMPL(GEN_TOOL) {
1092+
PEERDIR(${GOSTD}/reflect)
1093+
PEERDIR(vendor/go.uber.org/mock/gomock)
1094+
1095+
.CMD=${cwd:BINDIR} ${tool:GEN_TOOL} -output gob.data && ${cwd:BINDIR} ${tool:_GO_TOOL_MOCKGEN} -package ${MOCKGEN_PACKAGE} -model_gob gob.data ${stdout;output:"main.go"} $_GO_TOOL_ENV ${hide;kv:"p GM"} ${hide;kv:"pc blue"}
10571096
}
10581097

10591098
# tag:go-specific
1099+
### @usage: GO_MOCKGEN_MOCKS()
1100+
###
1101+
### Part of Go mock module definition, reflect mode.
1102+
### Generates mocks, expect to have `gen` folder with GO_MOCKGEN_REFLECT
10601103
macro GO_MOCKGEN_MOCKS() {
1104+
_GO_MOCKGEN_MOCKS_IMPL(${MODDIR}/gen)
1105+
}
1106+
1107+
_GO_MOCKGEN_SOURCE_CMDLINE=\
1108+
$FS_TOOLS md ${BINDIR}/.arcadia/vendor && \
1109+
$FS_TOOLS md ${BINDIR}/.arcadia/$MOCKGEN_FROM && \
1110+
$COPY_CMD ${context=TEXT;input:_GO_GO_MOD} ${BINDIR}/.arcadia/go.mod && \
1111+
$COPY_CMD ${context=TEXT;input:_GO_MODULES_TXT} ${BINDIR}/.arcadia/vendor/modules.txt && \
1112+
$COPY_CMD ${context=TEXT;input:SOURCE} ${BINDIR}/.arcadia/$SOURCE && \
1113+
${cwd;suf=/.arcadia:BINDIR} ${tool:_GO_TOOL_MOCKGEN} -package ${MOCKGEN_PACKAGE} -source ${rootrel;context=TEXT;input:SOURCE} ${ARGS} \
1114+
$_GO_TOOL_ENV ${stdout;output;suf=.source.gen.go;noext:FILENAME} \
1115+
${hide;context=TEXT;input;suf=/.arcadia/go.mod:BINDIR} ${hide;context=TEXT;input;suf=/.arcadia/vendor/modules.txt:BINDIR} ${hide;context=TEXT;input:IN_NOPARSE} \
1116+
${hide;kv:"p GS"} ${hide;kv:"pc blue"}
1117+
1118+
# tag:go-specific
1119+
macro _GO_MOCKGEN_SOURCE_IMPL(SOURCE, FILENAME, ARGS[], IN_NOPARSE[]) {
10611120
PEERDIR(${GOSTD}/reflect)
1121+
PEERDIR(${GOSTD}/context)
10621122
PEERDIR(vendor/go.uber.org/mock/gomock)
1123+
.CMD=$_GO_MOCKGEN_SOURCE_CMDLINE
1124+
}
1125+
1126+
# tag:go-specific
1127+
### @usage: GO_MOCKGEN_SOURCE(FILE, ARGS[], IN_NOPARSE[])
1128+
###
1129+
### Part of Go mock module definition, source mode.
1130+
### Generates mocks from file from GO_MOCKGEN_FROM or GO_MOCKGEN_CONTRIB_FROM
1131+
### Can be placed multiple times in same ya.make
1132+
macro GO_MOCKGEN_SOURCE(FILE, ARGS[], IN_NOPARSE[]) {
1133+
_GO_MOCKGEN_SOURCE_IMPL($MOCKGEN_FROM/$FILE $FILE ARGS ${ARGS} IN_NOPARSE ${IN_NOPARSE})
1134+
}
1135+
1136+
macro _GO_OAPI_CODEGEN_IMPL(TOOL, IN, FILENAME, GENERATE="", PACKAGE="", TEMPLATES="", CONFIG="", IN_NOPARSE[], Args...) {
1137+
.CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:TOOL} ${pre=--generate :GENERATE} ${pre=--package :PACKAGE} ${pre=--templates :TEMPLATES} ${pre=--config :CONFIG} $Args ${context=TEXT;input:IN} ${hide;context=TEXT;input:IN_NOPARSE} ${stdout;output:FILENAME} ${_GO_TOOL_ENV} ${hide;kv:"p GC"} ${hide;kv:"pc blue"}
1138+
}
1139+
1140+
# tag:go-specific
1141+
### @usage: GO_OAPI_CODEGEN(GENERATE, PACKAGE, IN, IN_NOPARSE[], Args...)
1142+
###
1143+
### Go oapi-codegen module
1144+
### Generates GENERATE thing with PACKAGE package from file IN into STDOUT file
1145+
### Optional arguments will be passed into generator
1146+
### IN_NOPARSE - input files required for running generation, except IN
1147+
### Can be placed multiple times in same ya.make
1148+
macro GO_OAPI_CODEGEN(GENERATE, PACKAGE, IN, IN_NOPARSE[], Args...) {
1149+
_GO_OAPI_CODEGEN_IMPL(${_GO_TOOL_OAPI_CODEGEN} ${IN} ${suf=.gen.go:GENERATE} GENERATE ${GENERATE} PACKAGE ${PACKAGE} ${Args} IN_NOPARSE ${IN_NOPARSE})
1150+
}
10631151

1064-
# Unfortunately ${rootrel;tool:TOOL} doesn't work currently, so we use this ugly workaround $MODDIR/gen/gen$_GO_EXE_SUFFIX
1065-
RUN_PROGRAM(vendor/go.uber.org/mock/mockgen -package mocks -exec_only $MODDIR/gen/gen$_GO_EXE_SUFFIX ${GO_ARCADIA_PROJECT_PREFIX}${MOCKGEN_FROM} $MOCKGEN_TYPES STDOUT main.go TOOL $MODDIR/gen CWD $ARCADIA_BUILD_ROOT ENV PATH=${GO_TOOLS_ROOT}/bin GOROOT=${GO_TOOLS_ROOT} GOCACHE=${BINDIR}/.gocache)
1152+
# tag:go-specific
1153+
### private, taxi only
1154+
macro GO_OAPI_CODEGEN_TAXI(GENERATE, PACKAGE, IN, IN_NOPARSE[], OUT_SUFFIX="", Args...) {
1155+
_GO_OAPI_CODEGEN_IMPL(${_GO_TOOL_OAPI_CODEGEN_TAXI} ${IN} ${suf=${OUT_SUFFIX}.gen.go:GENERATE} GENERATE ${GENERATE} PACKAGE ${PACKAGE} ${Args} IN_NOPARSE ${IN_NOPARSE})
1156+
}
1157+
1158+
# tag:go-specific
1159+
### private, taxi only
1160+
macro GO_OAPI_CODEGEN_TAXI_1134(GENERATE="", PACKAGE="", TEMPLATES="", CONFIG="", IN, FILENAME, IN_NOPARSE[], Args...) {
1161+
_GO_OAPI_CODEGEN_IMPL(${_GO_TOOL_OAPI_CODEGEN_TAXI_1134} ${IN} ${suf=.gen.go:FILENAME} ${pre=GENERATE :GENERATE} ${pre=PACKAGE :PACKAGE} ${pre=TEMPLATES :TEMPLATES} ${pre=CONFIG :CONFIG} ${Args} IN_NOPARSE ${IN_NOPARSE})
10661162
}

build/conf/proto.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ macro _UPDATE_GO_PROTO_ENV(NAME, ENV[], DUMMY...) {
374374
macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
375375
SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
376376
SET_APPEND(GO_PROTO_OUTS \${hide;noauto;norel;output;suf=$EXT;nopath;noext:File})
377+
_UPDATE_GO_PROTO_ENV(${suf= ENV;ext=mdb-validators:NAME} PATH=${GO_TOOLS_ROOT}/bin GOROOT=${GO_TOOLS_ROOT} GOCACHE=${BINDIR}/.gocache)
378+
_UPDATE_GO_PROTO_ENV(${suf= ENV;ext=proto_validation:NAME} PATH=${GO_TOOLS_ROOT}/bin GOROOT=${GO_TOOLS_ROOT} GOCACHE=${BINDIR}/.gocache)
379+
_UPDATE_GO_PROTO_ENV(${suf= ENV;ext=mdb-dynforms:NAME} PATH=${GO_TOOLS_ROOT}/bin GOROOT=${GO_TOOLS_ROOT} GOCACHE=${BINDIR}/.gocache)
377380
PEERDIR(${DEPS})
378381
}
379382

build/conf/python.conf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,18 +302,16 @@ macro STYLE_DUMMY() {
302302
### Check python3 sources for style issues using black.
303303
macro STYLE_PYTHON(CONFIG_TYPE="") {
304304
.ALLOWED_IN_LINTERS_MAKE=yes
305-
_ADD_PY_LINTER_CHECK(NAME black LINTER tools/black_linter/black_linter FILE_PROCESSING_TIME $BLACK_FILE_PROCESSING_TIME CONFIGS $PYTHON_LINTERS_DEFAULT_CONFIGS CUSTOM_CONFIG $CONFIG_TYPE CONFIG_TYPE $CONFIG_TYPE)
305+
_ADD_PY_LINTER_CHECK(NAME black LINTER tools/black_linter/black_linter FILE_PROCESSING_TIME $BLACK_FILE_PROCESSING_TIME CONFIGS $PYTHON_LINTERS_DEFAULT_CONFIGS CONFIG_TYPE $CONFIG_TYPE)
306306
}
307307

308308
# tag:python-specific tag:test
309309
### @usage: STYLE_RUFF([CONFIG_TYPE config_type] [CHECK_FORMAT])
310310
###
311311
### Check python3 sources for style issues using ruff. `CHECK_FORMAT` enables `ruff format` check.
312-
RUFF_PROJECT_TO_CONFIG_MAP=build/config/tests/ruff/ruff_config_paths.json
313312
macro STYLE_RUFF(CONFIG_TYPE="", CHECK_FORMAT?"yes":"no") {
314313
.ALLOWED_IN_LINTERS_MAKE=yes
315-
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/${RUFF_PROJECT_TO_CONFIG_MAP})
316-
_ADD_PY_LINTER_CHECK(NAME ruff LINTER tools/ruff_linter/bin/ruff_linter GLOBAL_RESOURCES build/external_resources/ruff FILE_PROCESSING_TIME $RUFF_FILE_PROCESSING_TIME CONFIGS $PYTHON_LINTERS_DEFAULT_CONFIGS PROJECT_TO_CONFIG_MAP $RUFF_PROJECT_TO_CONFIG_MAP CONFIG_TYPE $CONFIG_TYPE EXTRA_PARAMS check_format=${CHECK_FORMAT})
314+
_ADD_PY_LINTER_CHECK(NAME ruff LINTER tools/ruff_linter/bin/ruff_linter GLOBAL_RESOURCES build/external_resources/ruff FILE_PROCESSING_TIME $RUFF_FILE_PROCESSING_TIME CONFIGS $PYTHON_LINTERS_DEFAULT_CONFIGS CONFIG_TYPE $CONFIG_TYPE EXTRA_PARAMS check_format=${CHECK_FORMAT})
317315
}
318316

319317
# tag:python-specific tag:test
@@ -746,6 +744,14 @@ module _BASE_PY_PROGRAM: _BASE_PROGRAM {
746744
SET(MODULE_LANG PY2)
747745
}
748746

747+
# tag:codenav tag:py2 tag:deprecated
748+
when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
749+
PY_PROGRAM_LINK_EXE=$LINK_EXE && ${hide;kv:"pyndex $TARGET"}
750+
}
751+
otherwise {
752+
PY_PROGRAM_LINK_EXE=$LINK_EXE
753+
}
754+
749755
# tag:python-specific tag:codenav
750756
when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
751757
PY3_PROGRAM_LINK_EXE=$LINK_EXE && ${hide;kv:"py3yndex $TARGET"}

build/export_generators/ide-gradle/build.gradle.kts.jinja

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
{%- macro PatchRoots(arg, depend = false) -%}
1+
{%- macro PatchRoots(arg, depend = false, output = false) -%}
22
{#- Always replace (arcadia_root) === (SOURCE_ROOT in ymake) to $project_root in Gradle -#}
33
{%- if depend -%}
44
{#- Replace (export_root) === (BUILD_ROOT in ymake) to $project_root in Gradle, because prebuilt tools in arcadia, not in build_root -#}
55
"{{ arg|replace(export_root, "$project_root")|replace(arcadia_root, "$project_root") }}"
6+
{%- elif output and arg[0] != '/' -%}
7+
{#- Relative outputs in buildDir -#}
8+
"$buildDir/{{ arg }}"
69
{%- else -%}
710
{#- Replace (export_root) === (BUILD_ROOT in ymake) to baseBuildDir in Gradle - root of all build folders for modules -#}
811
"{{ arg|replace(export_root, "$baseBuildDir")|replace(arcadia_root, "$project_root") }}"
@@ -25,6 +28,7 @@
2528
{%- include "[generator]/javadoc.jinja" -%}
2629
{%- include "[generator]/run_program.jinja" -%}
2730
{%- include "[generator]/run_java_program.jinja" -%}
31+
{%- include "[generator]/run_common.jinja" -%}
2832
{%- include "[generator]/dependencies.jinja" -%}
2933
{%- include "extra-tests.gradle.kts" ignore missing -%}
3034
{%- if publish -%}

build/export_generators/ide-gradle/build.gradle.kts.proto.jinja

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
{%- macro PatchRoots(arg, depend = false) -%}
1+
{%- macro PatchRoots(arg, depend = false, output = false) -%}
22
{#- Always replace (arcadia_root) === (SOURCE_ROOT in ymake) to $project_root in Gradle -#}
33
{%- if depend -%}
44
{#- Replace (export_root) === (BUILD_ROOT in ymake) to $project_root in Gradle, because prebuilt tools in arcadia, not in build_root -#}
55
"{{ arg|replace(export_root, "$project_root")|replace(arcadia_root, "$project_root") }}"
6+
{%- elif output and arg[0] != '/' -%}
7+
{#- Relative outputs in buildDir -#}
8+
"$buildDir/{{ arg }}"
69
{%- else -%}
710
{#- Replace (export_root) === (BUILD_ROOT in ymake) to baseBuildDir in Gradle - root of all build folders for modules -#}
811
"{{ arg|replace(export_root, "$baseBuildDir")|replace(arcadia_root, "$project_root") }}"
912
{%- endif -%}
1013
{%- endmacro -%}
1114

12-
{%- macro PatchGeneratedProto(arg) -%}
13-
"{{ arg|replace(export_root, "$mainExtractedIncludeProtosDir")|replace(arcadia_root, "$mainExtractedIncludeProtosDir") }}"
15+
{%- macro PatchGeneratedProto(arg, relative = false) -%}
16+
{%- if relative -%}
17+
"{{ arg|replace(export_root + "/", "")|replace(arcadia_root + "/", "") }}"
18+
{%- else -%}
19+
"{{ arg|replace(export_root, "$baseBuildDir")|replace(arcadia_root, "$baseBuildDir") }}"
20+
{%- endif -%}
1421
{%- endmacro -%}
1522

1623
{%- include "[generator]/proto_vars.jinja" -%}
@@ -27,6 +34,7 @@
2734
{%- include "[generator]/proto_prepare.jinja" -%}
2835
{%- include "[generator]/run_program.jinja" -%}
2936
{%- include "[generator]/run_java_program.jinja" -%}
37+
{%- include "[generator]/run_common.jinja" -%}
3038
{%- include "[generator]/javadoc.jinja" -%}
3139
{%- include "[generator]/proto_dependencies.jinja" -%}
3240
{%- include "[generator]/debug.jinja" ignore missing -%}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{#- empty string #}
2-
val baseBuildDir = "{{ export_root }}/gradle.build/"
3-
buildDir = file(baseBuildDir + project.path.replaceFirst(":", "/").replace(":", "."))
2+
val baseBuildDir = "{{ export_root }}/gradle.build"
3+
buildDir = file(baseBuildDir + "/" + project.path.replace(":", "/"))
44
subprojects {
5-
buildDir = file(baseBuildDir + project.path.replaceFirst(":", "/").replace(":", "."))
5+
buildDir = file(baseBuildDir + "/" + project.path.replace(":", "/"))
66
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{%- include "[generator]/builddir.jinja" %}
22
val mainProtosDir = File(buildDir, "main_protos")
3-
{%- if libraries|length %}
3+
{%- if extractLibrariesProtosTask %}
44
val mainExtractedIncludeProtosDir = File(buildDir, "extracted-include-protos/main")
55
{%- endif %}

build/export_generators/ide-gradle/proto_prepare.jinja

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,56 @@
1-
{#- empty string #}
2-
{%- if target.proto_files|length %}
1+
{%- if prepareProtosTask %}
2+
33
val prepareMainProtos = tasks.register<Copy>("prepareMainProtos") {
4+
{%- if target.proto_files|length %}
45
from("$project_root") {
56
{#- list of all current project proto files -#}
6-
{%- for proto in target.proto_files %}
7+
{%- for proto in target.proto_files %}
78
include("{{ proto }}")
8-
{%- endfor %}
9+
{%- endfor %}
10+
}
11+
{% endif -%}
12+
{%- if target.runs|length or target.custom_runs|length %}
13+
from("$baseBuildDir") {
14+
{%- for run in target.runs -%}
15+
{%- for out in run.out %}
16+
include({{ PatchGeneratedProto(out, true) }})
17+
{%- endfor -%}
18+
{%- for out_dir in run.out_dir %}
19+
include({{ PatchGeneratedProto(out_dir, true) }} + "/**/*.proto")
20+
{%- endfor -%}
21+
{%- endfor -%}
22+
{%- for custom_run in target.custom_runs -%}
23+
{%- for out in custom_run.outputs %}
24+
include({{ PatchGeneratedProto(out, true) }})
25+
{%- endfor -%}
26+
{%- endfor %}
927
}
28+
{% endif -%}
1029
into(mainProtosDir)
1130
}
12-
{%- endif %}
31+
{%- endif -%}
32+
33+
{%- if extractLibrariesProtosTask -%}
1334

14-
{% if libraries|length -%}
1535
val extractMainLibrariesProtos = tasks.register<Copy>("extractMainLibrariesProtos") {
36+
{%- if libraries|length -%}
1637
from("$project_root") {
1738
{#- list of all library directories -#}
1839
{%- for library in libraries -%}
1940
{%- set path_and_jar = rsplit(library.jar, '/', 2) %}
2041
include("{{ path_and_jar[0] }}/**/*.proto")
2142
{%- endfor %}
2243
}
44+
{% endif -%}
2345
into(mainExtractedIncludeProtosDir)
2446
}
47+
{%- endif %}
2548

26-
{% endif -%}
2749
afterEvaluate {
28-
{%- if target.proto_files|length %}
50+
{%- if prepareProtosTask %}
2951
tasks.getByName("extractProto").dependsOn(prepareMainProtos)
3052
{%- endif %}
31-
{%- if libraries|length %}
53+
{%- if extractLibrariesProtosTask %}
3254
tasks.getByName("extractProto").dependsOn(extractMainLibrariesProtos)
3355
{%- endif %}
3456
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{%- set publish = target.publish -%}
2-
{%- set libraries = target.consumer|selectattr('type', 'eq', 'library') -%}
32
{%- set with_kotlin = target.with_kotlin -%}
43
{%- set kotlin_version = target.kotlin_version -%}
54
{%- set proto_template = true -%}
5+
{%- set prepareProtosTask = target.proto_files|length or target.runs|length or target.custom_runs|length -%}
6+
{%- set libraries = target.consumer|selectattr('type', 'eq', 'library') -%}
7+
{%- set extractLibrariesProtosTask = libraries|length -%}
68

79
{%- include "[generator]/jdk.jinja" -%}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{%- if not proto_template and (target.runs|length or target.custom_runs|length) %}
2+
3+
tasks.getByName("sourcesJar").dependsOn(tasks.compileJava)
4+
{%- if with_kotlin %}
5+
tasks.getByName("sourcesJar").dependsOn(tasks.compileKotlin)
6+
{%- endif %}
7+
tasks.getByName("sourcesJar").mustRunAfter(tasks.compileTestJava)
8+
{%- if with_kotlin %}
9+
tasks.getByName("sourcesJar").mustRunAfter(tasks.compileTestKotlin)
10+
{%- endif -%}
11+
{%- endif -%}

0 commit comments

Comments
 (0)