12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829 |
- macro _INPUT_WITH_FLAG(Flag, IN[]) {
- .CMD=$_INPUT_WITH_FLAG_IMPL(${pre=$Flag :IN} IN $IN)
- }
- macro _INPUT_WITH_FLAG_IMPL(IN{input}[], Args...) {
- .CMD=$Args ${input;hide:IN}
- }
- macro ACCELEO(XSD{input}[], MTL{input}[], MTL_ROOT="${MODDIR}", LANG{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], DEBUG?"stdout2stderr":"stderr2stdout") {
- .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
- .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input;pre=build/scripts/:DEBUG.py} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:"tools/acceleo"}${RUN_JAR_PROG_CP_SUF} ru.yandex.se.logsng.tool.Cli $_INPUT_WITH_FLAG(--xsd IN $XSD) $_INPUT_WITH_FLAG(--mtl IN $MTL) $_INPUT_WITH_FLAG(--lang IN $LANG) --output-dir $BINDIR --build-root ${ARCADIA_BUILD_ROOT} --source-root ${ARCADIA_ROOT} --mtl-root $MTL_ROOT ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
- }
- ### @usage: JAVA_LIBRARY()
- ###
- ### The module describing java library build.
- ###
- ### Documentation: https://wiki.yandex-team.ru/yatool/java/
- module JAVA_LIBRARY: JAR_LIBRARY {
- .SEM=BUILD_JAR_SEM
- }
- PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM=IGNORED
- ### @usage: JAVA_PROGRAM()
- ###
- ### The module describing java programs build.
- ### Output artifacts: .jar and directory with all the jar to the classpath of the formation.
- ###
- ### Documentation: https://wiki.yandex-team.ru/yatool/java/
- multimodule JAVA_PROGRAM {
- module JAR_RUNNABLE: _JAR_RUNNABLE {
- .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
- .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
- # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
- # * A -> B -> C -> lib-v1.4
- # | |-> DM(lib-v1.1)
- # | |-> EXCLUDE(lib-v1.4)
- # | |-> FORBID_CONFLICT_DM_RECENT = OK
- # |-> DM(lib-v1.1)
- # |-> FORBID_CONFLICT_DM_RECENT = FAIL (because downgrade from v1.4 to v1.1 is detected before understanding that v1.4 was excuded on the examined path)
- .IGNORED=RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION PROVIDES
- .ALIASES=JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
- .PEERDIRSELF=JAR_COMPILATION
- SET(MODULE_TYPE JAVA_PROGRAM)
- }
- module JAR_COMPILATION: JAR_LIBRARY {
- .IGNORED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
- .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
- .SEM=BUILD_JAR_SEM
- .FINAL_TARGET=no
- SET(MODULE_TYPE JAVA_PROGRAM)
- }
- }
- BUILD_JUNIT5_JAR_SEM=$BUILD_JAR_SEM && junit5_test
- multimodule JUNIT5 {
- # ATTENTION ya ide idea relies on this submodule name to find scope of `ya make` build before project generation
- module JAR_TESTABLE: _JAR_TEST {
- .ALLOWED=YT_SPEC
- # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
- # * A -> B -> C -> lib-v1.4
- # | |-> DM(lib-v1.1)
- # | |-> EXCLUDE(lib-v1.4)
- # | |-> FORBID_CONFLICT_DM_RECENT = OK
- # |-> DM(lib-v1.1)
- # |-> FORBID_CONFLICT_DM_RECENT = FAIL (because downgrade from v1.4 to v1.1 is detected before understanding that v1.4 was excuded on the examined path)
- .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
- .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
- .PEERDIRSELF=JAR_COMPILATION
- .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
- PEERDIR(devtools/jtest-annotations/junit5)
- SET(MODULE_TYPE JUNIT5)
- }
- module JAR_COMPILATION: JAR_LIBRARY {
- .ALLOWED=YT_SPEC
- .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
- .FINAL_TARGET=no
- .DEFAULT_NAME_GENERATOR=FullPath
- .SEM=BUILD_JUNIT5_JAR_SEM
- PEERDIR+=devtools/junit5-runner
- PEERDIR+=build/platform/java/jacoco-agent
- when ($OPENSOURCE != "yes") {
- PEERDIR+=devtools/jtest-annotations/junit5
- }
- SET(MODULE_TYPE JUNIT5)
- }
- }
- BUILD_JUNIT4_JAR_SEM=$BUILD_JAR_SEM && junit4_test
- multimodule JTEST {
- # ATTENTION ya ide idea relies on this submodule name to find scope of `ya make` build before project generation
- module JAR_TESTABLE: _JAR_TEST {
- .ALLOWED=YT_SPEC
- # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
- # * A -> B -> C -> lib-v1.4
- # | |-> DM(lib-v1.1)
- # | |-> EXCLUDE(lib-v1.4)
- # | |-> FORBID_CONFLICT_DM_RECENT = OK
- # |-> DM(lib-v1.1)
- # |-> FORBID_CONFLICT_DM_RECENT = FAIL (because downgrade from v1.4 to v1.1 is detected before understanding that v1.4 was excuded on the examined path)
- .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
- .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
- .PEERDIRSELF=JAR_COMPILATION
- .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
- SET(MODULE_TYPE JTEST)
- PEERDIR(devtools/junit-runner devtools/jtest-annotations/junit4)
- DEPENDENCY_MANAGEMENT(contrib/java/com/google/code/gson/gson/2.8.6 contrib/java/com/beust/jcommander/1.72 contrib/java/junit/junit/4.12)
- }
- module JAR_COMPILATION: JAR_LIBRARY {
- .ALLOWED=YT_SPEC
- .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
- .FINAL_TARGET=no
- .DEFAULT_NAME_GENERATOR=FullPath
- .SEM=BUILD_JUNIT4_JAR_SEM
- SET(MODULE_TYPE JTEST)
- DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
- PEERDIR+=build/platform/java/jacoco-agent
- when ($OPENSOURCE != "yes") {
- PEERDIR+=devtools/jtest-annotations/junit4
- }
- }
- }
- multimodule JTEST_FOR {
- # ATTENTION ya ide idea relies on this submodule name to find scope of `ya make` build before project generation
- module JAR_TESTABLE: _JAR_TEST {
- .ALLOWED=YT_SPEC
- # TODO(svidyuk) JAVA_DEPENDENCIES_CONFIGURATION must not be ignored here but there are diagnostics issues in case of ECLUDE in the middle:
- # * A -> B -> C -> lib-v1.4
- # | |-> DM(lib-v1.1)
- # | |-> EXCLUDE(lib-v1.4)
- # | |-> FORBID_CONFLICT_DM_RECENT = OK
- # |-> DM(lib-v1.1)
- # |-> FORBID_CONFLICT_DM_RECENT = FAIL (because downgrade from v1.4 to v1.1 is detected before understanding that v1.4 was excuded on the examined path)
- .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM JAVA_DEPENDENCIES_CONFIGURATION
- .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
- .PEERDIRSELF=JAR_COMPILATION
- .SEM=PROGRAM_AND_TESTS_CP_COLLECTING_NODES_SEM
- SET(MODULE_TYPE JTEST_FOR)
- PEERDIR(${UNITTEST_DIR} devtools/junit-runner)
- DEPENDENCY_MANAGEMENT(contrib/java/com/google/code/gson/gson/2.8.6 contrib/java/com/beust/jcommander/1.72 contrib/java/junit/junit/4.12)
- }
- module JAR_COMPILATION: JAR_LIBRARY {
- .ALLOWED=YT_SPEC
- .ALIASES=JAVA_TEST_PEERDIR=_NOOP_MACRO JAVA_TEST_EXCLUDE=_NOOP_MACRO
- .FINAL_TARGET=no
- .DEFAULT_NAME_GENERATOR=FullPath
- .SEM=BUILD_JUNIT4_JAR_SEM
- SET(MODULE_TYPE JTEST_FOR)
- DEPENDS(contrib/java/org/sonarsource/scanner/cli/sonar-scanner-cli/2.8)
- PEERDIR(devtools/junit-runner build/platform/java/jacoco-agent ${UNITTEST_DIR})
- }
- }
- multimodule JAVA_CONTRIB_PROGRAM {
- module JAR_RUNNABLE: _JAR_RUNNABLE {
- .IGNORED=JAVA_SRCS RUN_JAR_PROGRAM RUN_JAVA_PROGRAM JAR_RESOURCE SRC_RESOURCE LOCAL_JAR
- .PEERDIRSELF=JAR_COMPILATION
- SET(MODULE_TYPE JAVA_PROGRAM)
- ENABLE(DISABLE_SCRIPTGEN)
- }
- module JAR_COMPILATION: JAVA_CONTRIB {
- .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
- .FINAL_TARGET=no
- .SEM=BUILD_JAR_SEM
- }
- }
- # tag:java-specific
- JAVA_VCS_MF_ARG=
- COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $COMPILE_JAVA $MAVEN_EXPORT_CMD
- # tag:java-specific
- when ($EXT_JAVA_VCS_INFO == "yes") {
- JAVA_VCS_MF_ARG=--vcs-mf $VCS_JAVA
- COMPILE_JAVA_MF=${hide:JAVA_FAKEID} $GENERATE_VCS_JAVA_INFO_NODEP && $COMPILE_JAVA $MAVEN_EXPORT_CMD
- }
- # tag:java-specific
- EXT_JAVA_VCS_INFO=no
- ### @usage: EMBED_JAVA_VCS_INFO()
- ###
- ### Embed manifest with vcs info into `EXTERNAL_JAVA_LIBRARY`
- ### By default this is disabled.
- macro EMBED_JAVA_VCS_INFO() {
- .SEM=add_vcs_info_to_mf ${hide;output:"VcsInfoMfDummy.java"}
- ENABLE(EXT_JAVA_VCS_INFO)
- }
- # tag:java-specific tag:internal
- ### @usage: EXTERNAL_JAVA_LIBRARY() #internal
- ###
- ### EXTERNAL_JAVA_LIBRARY() is a module for creating a .jar file using non-Java code (generators etc.)
- ### Unlike regular JAVA_LIBRARY this module doesn't produce .pom file, so it cannot be exported to Maven itself.
- ### PEERDIR it from JAVA_LIBRARY or JAVA_PROGRAM for export to Maven.
- module EXTERNAL_JAVA_LIBRARY: _BASE_UNIT {
- .EXTS=.jsrc .java .jar .mf
- .NODE_TYPE=Bundle
- .CMD=COMPILE_JAVA_MF
- # TODO(YMAKE-27) all contribs involved into opensource export must be JAVA_CONTRIB modules
- # and this module must not be intended for export. Such hange will break JBUILD and thus is
- # blocked on YMAKE-27
- .SEM=JAVA_CONTRIB_SEM
- .PEERDIR_POLICY=as_build_from
- .FINAL_TARGET=no
- .ALIASES=SRCS=_SRCS_NO_GLOBAL
- .ALLOWED=EMBED_JAVA_VCS_INFO
- .RESTRICTED=EXTERNAL_JAR
- .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS
- PEERDIR(build/platform/java/jdk)
- PEERDIR+=$JDK_RESOURCE_PEERDIR $EXTERNAL_JAVA_EXTRA_PEERDIR
- when ($KOTLIN_PROTO == "yes") {
- PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION}
- }
- when ($MAVEN_EXPORT == "yes") {
- when ($MAVEN_DEPLOY == "yes") {
- PEERDIR+=build/external_resources/maven
- MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
- }
- 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}:
- }
- PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL PACKAGE_UNION
- HAS_MANAGEABLE_PEERS=yes
- DYNAMIC_LINK=yes
- MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
- MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
- MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
- when ($PACKAGE_PREFIX) {
- PACKAGE_PREFIX_ARGS=--package-prefix=$PACKAGE_PREFIX
- }
- DISABLE(NEED_PLATFORM_PEERDIRS)
- NO_PLATFORM()
- SET(MODULE_SUFFIX .jar)
- SET(MODULE_LANG JAVA)
- _WHEN_EXPORT_GRADLE()
- }
- # tag:java-specific
- ALL_JAR_SOURCES=
- LINT_JAVA_SOURCES=
- ALL_SRCDIRS=
- LINK_JAR_RESOURCES=
- LINK_JAR_JSOURCES=
- JAR_GEN_SRCS=
- JAR_GEN_JSRCS=
- macro _JAR_SRCS(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"yes":"no", Globs...) {
- _CHECK_JAVA_SRCDIR($SRCDIR)
- SET_APPEND(ALL_SRCDIRS $SRCDIR)
- SET(VAR_SALT $SRCDIR $Globs $EXCLUDE $PACKAGE_PREFIX $RESOURCES $FILES)
- SET(JAR_SRCS_GLOB uniq_${hash:VAR_SALT})
- _LATE_GLOB(${JAR_SRCS_GLOB} ${pre=${SRCDIR}/:Globs} EXCLUDE ${EXCLUDE})
- SET_APPEND(LINT_JAVA_SOURCES \${input;rootrel;ext=.java:${JAR_SRCS_GLOB}})
- SET_APPEND(ALL_JAR_SOURCES --jsources ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt --resources ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt --srcdir ${quo:SRCDIR} \${input:${JAR_SRCS_GLOB}} ${pre=\$\{input\:\";suf=\"\}:FILES})
- _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_RESOURCES ${quo:SRCDIR} ${BINDIR}/cls ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt)
- _FILL_JAR_COPY_RESOURCES_CMD(LINK_JAR_JSOURCES ${quo:SRCDIR} ${BINDIR}/src ${PACKAGE_PREFIX} ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt)
- _FILL_JAR_GEN_SRCS(JAR_GEN_SRCS JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.res.txt $Globs EXCLUDE $EXCLUDE)
- _FILL_JAR_GEN_SRCS(JAR_GEN_JSRCS SRC_JAR $SRCDIR ${BINDIR}/cls ${BINDIR}/all-java.srclst $KT_SRCLIST ${BINDIR}/misc/all-gr-sources.txt ${BINDIR}/misc/${tolower:JAR_SRCS_GLOB}.src.txt $Globs EXCLUDE $EXCLUDE)
- }
- macro IDEA_JAR_SRCS(Args...) {
- _JAR_SRCS($Args)
- SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
- }
- macro _HASH_HELPER(Args...) {
- .CMD=${hash:Args}
- .SEM=${hash:Args}
- }
- macro _GENTAR_HELPER(OUT_DIR[], Args...) {
- .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --pack ${OUT_DIR} --outs ${output;tared;suf=.$_HASH_HELPER($Args).gentar:OUT_DIR} ${kv;hide:"tared_kind nodir"}
- }
- # tag:java-specific
- RUN_JAR_PROG_CP_PRE=@
- RUN_JAR_PROG_CP_SUF=.cplst
- when($JDK_VERSION == "8") {
- RUN_JAR_PROG_CP_PRE=
- RUN_JAR_PROG_CP_SUF=
- }
- # tag:java-specific
- JDK_LATEST_VERSION=19
- JDK_LATEST_PEERDIR=build/platform/java/jdk/jdk${JDK_LATEST_VERSION}
- # tag:java-specific
- macro _DO_2_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq_", IN_DIRS_INPUTS[], IN{input}[], IN_NOPARSE{input}[], IN_DIR[], OUT_NOAUTO{output}[], OUT{output}[], TOOL{tool}[], OUT_DIR[], CLASSPATH[], ADD_SRCS_TO_CLASSPATH?"yes":"no", CWD="${ARCADIA_BUILD_ROOT}", STDOUT="", STDOUT_NOAUTO="", Args...) {
- _LATE_GLOB(${IN_DIRS_VAR} ${suf=/**/*:IN_DIR})
- _CHECK_RUN_JAVA_PROG_CLASSPATH($CLASSPATH)
- .PEERDIR=build/platform/java/jdk $JDK_RESOURCE_PEERDIR
- .CMD=${kv;hide:"p RJ"} ${kv;hide:"pc blue"} ${hide:JAVA_FAKEID} ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} ${OUT_DIR} && ${cwd:CWD} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} ${pre=--file=:STDOUT} ${output;hide:STDOUT} ${pre=--file=:STDOUT_NOAUTO} ${output;hide;noauto:STDOUT_NOAUTO} $YMAKE_PYTHON ${input:"build/scripts/fix_java_command_file_cp.py"} --build-root ${ARCADIA_BUILD_ROOT} $JDK_RESOURCE/bin/java -Dfile.encoding=utf8 -classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} ${Args} && $_GENTAR_HELPER($CLASSPATH $IN_DIR $IN $IN_NOPARSE $TOOL $Args OUT_DIR $OUT_DIR) ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output;noauto;hide:OUT_NOAUTO} ${output;hide:OUT} ${tool;hide:TOOL} ${IN_DIRS_INPUTS}
- }
- # tag:java-specific
- macro _DO_1_RUN_JAR_PROGRAM(IN_DIRS_VAR="uniq", Args...) {
- _DO_2_RUN_JAR_PROGRAM($Args IN_DIRS_VAR $IN_DIRS_VAR IN_DIRS_INPUTS ${"$"}{input;hide:$IN_DIRS_VAR})
- }
- # tag:java-specific
- macro RUN_JAVA_PROGRAM(Args...) {
- _DO_1_RUN_JAR_PROGRAM($Args IN_DIRS_VAR uniq_${hash:Args})
- }
- # tag:java-specific
- _JAR_ANN_PROCESSORS=
- _JAR_ANN_PROC_OPT_PREFIX=
- macro JAR_ANNOTATION_PROCESSOR(Classes...) {
- SET_APPEND(_JAR_ANN_PROCESSORS $Classes)
- SET(_JAR_ANN_PROC_OPT_PREFIX -processor)
- # for ya ide idea only
- SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Classes)
- }
- # tag:java-specific
- macro _JAR_ANN_PROC_OPTS(Classes...) {
- .CMD=$_JAR_ANN_PROC_OPT_PREFIX ${join=,:Classes}
- }
- # tag:java-specific
- macro _NOOP_MACRO(Args...) {
- ENABLE(UNUSED_MACRO)
- }
- # tag:java-specific
- module _JAR_BASE: _BARE_UNIT {
- .NODE_TYPE=Bundle
- .CMD=TOUCH_UNIT
- .PEERDIR_POLICY=as_build_from
- .FINAL_TARGET=no
- .ALIASES=SRCS=_SRCS_NO_GLOBAL
- .ALLOWED=EMBED_JAVA_VCS_INFO DEPENDENCY_MANAGEMENT EXCLUDE
- .DEFAULT_NAME_GENERATOR=TwoDirNames
- .RESTRICTED=WITH_JDK RESOURCE RESOURCE_FILES
- .GLOBAL=EXPORT_GRADLE_PROJECT_COORDS
- PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__
- HAS_MANAGEABLE_PEERS=yes
- DYNAMIC_LINK=yes
- MACRO_ALIAS(PROTO_CMD _JAVA_PROTO_CMD)
- MACRO_ALIAS(EVLOG_CMD _JAVA_EVLOG_CMD)
- MACRO_ALIAS(FBS_CMD _JAVA_FLATC_CMD)
- DISABLE(NEED_PLATFORM_PEERDIRS)
- NO_PLATFORM()
- VCS_JAVA=${suf=.__vcs_version__.mf:TARGET}
- SET(MODULE_LANG JAVA)
- _WHEN_EXPORT_GRADLE()
- }
- JAVA_CONTRIB_PROXY_SEM=IGNORED
- # tag:java-specific
- module JAVA_CONTRIB_PROXY: _JAR_BASE {
- .SEM=JAVA_CONTRIB_PROXY_SEM
- }
- # tag:java-specific
- macro _FETCH_CONTRIB(Id, Out, SBR="sbr:") {
- .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id --copy-to ${output:Out} ${input;hide:"build/scripts/fetch_from.py"} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
- ADD_CHECK(check.resource $Id)
- }
- # tag:java-specific
- LOCAL_JAR_PATH=
- LOCAL_SOURCES_JAR_PATH=
- JAR_RESOURCE_ID=
- SRC_RESOURCE_ID=
- FETCH_SRCS_JAR=
- FETCH_TARGET_JAR=
- FETCH_CONTRIB_JAR=${hide:JAVA_FAKEID} $FETCH_TARGET_JAR $FETCH_SRCS_JAR
- # tag:java-specific
- macro JAR_RESOURCE(Id) {
- SET(JAR_RESOURCE_ID $Id)
- }
- # tag:java-specific
- macro SRC_RESOURCE(Id) {
- SET(SRC_RESOURCE_ID $Id)
- }
- # tag:java-specific
- macro LOCAL_JAR(File) {
- SET(LOCAL_JAR_PATH $File)
- }
- # tag:java-specific
- macro LOCAL_SOURCES_JAR(File) {
- SET(LOCAL_SOURCES_JAR_PATH $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 && \
- IGNORED
- # tag:java-specific
- module JAVA_CONTRIB: _JAR_BASE {
- .CMD=FETCH_CONTRIB_JAR
- .PEERDIR_POLICY=as_include
- .SEM=JAVA_CONTRIB_SEM
- .FINAL_TARGET=yes
- .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS
- when ($JAR_RESOURCE_ID) {
- FETCH_TARGET_JAR= && $_FETCH_CONTRIB($JAR_RESOURCE_ID ${BINDIR}/${MODULE_PREFIX}${REALPRJNAME}${MODULE_SUFFIX})
- }
- otherwise {
- when ($LOCAL_JAR_PATH) {
- FETCH_TARGET_JAR= && $FS_TOOLS copy ${input:LOCAL_JAR_PATH} $TARGET
- }
- otherwise {
- FETCH_TARGET_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && ${cwd:BINDIR} $JDK_RESOURCE/bin/jar cfvm $TARGET $VCS_JAVA .
- PEERDIR+=build/platform/java/jdk
- PEERDIR+=$JDK_RESOURCE_PEERDIR
- }
- }
- when ($SRC_RESOURCE_ID) {
- FETCH_SRCS_JAR= && $_FETCH_CONTRIB($SRC_RESOURCE_ID ${BINDIR}/${REALPRJNAME}-sources.jar)
- }
- otherwise {
- when ($LOCAL_SOURCES_JAR_PATH) {
- FETCH_SRCS_JAR= && $FS_TOOLS copy ${input:LOCAL_SOURCES_JAR_PATH} {output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME}
- }
- otherwise {
- FETCH_SRCS_JAR= && $GENERATE_VCS_JAVA_INFO_NODEP && $FS_TOOLS md ${BINDIR}/fake-src && ${cwd;suf=/fake-src:BINDIR} $JDK_RESOURCE/bin/jar cfvm ${output;pre=${BINDIR}/;suf=-sources.jar:REALPRJNAME} $VCS_JAVA .
- PEERDIR+=build/platform/java/jdk
- PEERDIR+=$JDK_RESOURCE_PEERDIR
- }
- }
- when ($MAVEN_EXPORT == "yes") {
- _MAKEFILE_INCLUDE_LIKE_DEPS+=pom.xml
- FETCH_CONTRIB_JAR+= && $MAVEN_EXPORT_GEN_DEPLST
- }
- SET(MODULE_SUFFIX .jar)
- _SETUP_MAVEN_EXPORT_COORDS_IF_NEED($MODDIR)
- }
- MAKE_JAVA_CLASSPATH_FILE=$YMAKE_PYTHON ${input:"build/scripts/make_java_classpath_file.py"} ${input;hide:"build/scripts/process_command_files.py"}
- # tag:kotlin-specific
- KOTLINC_OPTS_VALUE=
- # tag:kotlin-specific
- KT_SRCLIST=${BINDIR}/misc/all-kt-sources.txt
- KT_SRSCLIST_FLAG=--kotlin $KT_SRCLIST
- KT_CLASSES_DIR=${BINDIR}/kt_cls
- KT_CLASSPATH=${BINDIR}/kt_cp.txt
- COLLECT_KT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/kt_bfg.txt -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file
- LINK_KT_CLASSPATH=${MAKE_JAVA_CLASSPATH_FILE} ${BINDIR}/kt_bfg.txt $KT_CLASSPATH && $FS_TOOLS md $KT_CLASSES_DIR
- COMPILE_KT= \
- ${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --kotlin --sources-list $KT_SRCLIST \
- $JDK_RESOURCE/bin/java -jar $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} \
- @$KT_SRCLIST -classpath @$KT_CLASSPATH $KOTLINC_FLAGS_VALUE -d $KT_CLASSES_DIR $KOTLINC_OPTS_VALUE
- ALL_KT_COMMANDS=
- KT_CLASSPATH_ITEM=
- # tag:kotlin-specific
- KT_KAPT_SOURCES_DIR=${BINDIR}/kapt_gen_src
- KT_KAPT_STUBS_DIR=${BINDIR}/kapt_gen_stubs
- KT_KAPT_AP_CLASSPATH=
- KT_KAPT_PLUGIN_OPTS=-P plugin:org.jetbrains.kotlin.kapt3:sources=${KT_KAPT_SOURCES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:classes=${KT_CLASSES_DIR} -P plugin:org.jetbrains.kotlin.kapt3:stubs=${KT_KAPT_STUBS_DIR} -P plugin:org.jetbrains.kotlin.kapt3:aptMode=stubsAndApt
- ### @usage: KAPT_OPTS(opts...)
- ###
- ### Used to specify annotation processor qualified class names.
- ### If specified multiple times, only last specification is used.
- macro KAPT_OPTS(Args...) {
- SET_APPEND(KT_KAPT_PLUGIN_OPTS ${pre=-P :Args})
- }
- ### @usage: KAPT_ANNOTATION_PROCESSOR(processors...)
- ###
- ### Used to specify annotation processor qualified class names.
- ### If specified multiple times, only last specification is used.
- macro KAPT_ANNOTATION_PROCESSOR(Args...) {
- KAPT_OPTS(${pre="plugin:org.jetbrains.kotlin.kapt3:processors=":Args})
- }
- ### @usage: KAPT_ANNOTATION_PROCESSOR_CLASSPATH(jars...)
- ###
- ### Used to specify classpath for annotation processors.
- ### If specified multiple times, all specifications are used.
- macro KAPT_ANNOTATION_PROCESSOR_CLASSPATH(Args...) {
- PEERDIR($Args)
- SET_APPEND(KT_KAPT_AP_CLASSPATH $Args)
- }
- # tag:java-specific
- JAVAC_CMD=$JDK_RESOURCE/bin/javac
- ERROR_PRONE_JAVAC_CMD=${YMAKE_PYTHON} ${input:"build/scripts/build_java_with_error_prone2.py"} $JDK_RESOURCE/bin/java $JDK_RESOURCE/bin/javac $ERROR_PRONE_RESOURCE/error_prone.jar
- # tag:java-specific tag:codenav
- JAVA_YNDEXING=no
- # tag:java-specific
- when ($USE_SYSTEM_KYTHE) {
- KYTHE_RESOURCE=$USE_SYSTEM_KYTHE
- }
- otherwise {
- KYTHE_RESOURCE=$KYTHE_RESOURCE_GLOBAL
- }
- # tag:java-specific tag:codenav
- _JAVA_YNDEXING_CMD=$YMAKE_PYTHON ${input:"build/scripts/build_java_codenav_index.py"} $TARGET $ARCADIA_BUILD_ROOT $ARCADIA_ROOT ${BINDIR}/all-java.srclst $JDK_RESOURCE/bin/java -jar $KYTHE_RESOURCE/kythe/extractors/javac_extractor.jar
- _DO_JAVA_YNDEXING=
- # tag:java-specific
- SOURCES_JAR=no
- when ($BUILD_TYPE == "DEBUG" && $NO_DEBUGINFO != "yes") {
- SOURCES_JAR=yes
- }
- _PACK_SRC_JAR_IMPL=&& $FS_TOOLS md ${BINDIR}/src $JAR_GEN_JSRCS $LINK_JAR_JSOURCES && ${cwd;suf=/src:BINDIR} $JDK_RESOURCE/bin/jar cfvm ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME} $VCS_JAVA .
- _PACK_SRC_JAR=
- # tag:java-specific
- _PACK_JNI=
- _PACK_JNI_CMD= && $FS_TOOLS link_or_copy_to_dir --ya-start-command-file ${ext=.so:MANAGED_PEERS_CLOSURE} ${ext=.dll:MANAGED_PEERS_CLOSURE} ${ext=.dylib:MANAGED_PEERS_CLOSURE} --ya-end-command-file ${BINDIR}/cls
- # tag:java-specific
- _MAKE_JSTYLE_FILE_LIST=
- # tag:java-specific
- _LINK_UBERJAR=
- _UBERJAR_SELF=
- _DO_LINK_UBERJAR= && $JDK_RESOURCE/bin/java -cp $UBERJAR_RESOURCE/devtools-java_shader.jar ru.yandex.devtools.emigrante.Main --out-jar $TARGET $_UBERJAR_SELF ${ext=.jar;pre=--jar :MANAGED_PEERS_CLOSURE} ${UBERJAR_PREFIX_FLAG} ${UBERJAR_HIDE_EXCLUDE_FLAGS} $UBERJAR_PATH_EXCLUDES ${UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG} ${UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS} ${UBERJAR_APPENDING_TRANSFORMER_FLAGS} ${UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG} \
- && $YMAKE_PYTHON ${input:"build/scripts/mkdir.py"} $BINDIR/_empty/META-INF \
- && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} $BINDIR/_empty/META-INF/MANIFEST.MF \
- && $UPDATE_VCS_JAVA_INFO_NODEP($TARGET) \
- && ${cwd;suf=/_empty:BINDIR} ${JDK_RESOURCE}/bin/jar ufv ${TARGET} META-INF/MANIFEST.MF \
- && $JDK_RESOURCE/bin/jar ufvm $TARGET $VCS_JAVA
- # tag:java-specific
- macro _PACK_JAR_HELPER(Out) {
- .CMD=${cwd;suf=/cls:BINDIR} ${env:"LC_ALL=en_US.UTF-8"} $JDK_RESOURCE/bin/jar cfvm $Out $VCS_JAVA .
- }
- # tag:java-specific
- macro _JAVAC_RUN_HELPER(JAVAC_CMD_WITH_ARGS...) {
- .CMD=${cwd:ARCADIA_BUILD_ROOT} ${env:"LC_ALL=en_US.UTF-8"} $YMAKE_PYTHON ${input:"build/scripts/with_pathsep_resolve.py"} $YMAKE_PYTHON ${input:"build/scripts/setup_java_tmpdir.py"} $YMAKE_PYTHON ${input:"build/scripts/run_javac.py"} --sources-list ${BINDIR}/all-java.srclst ${JAVAC_CMD_WITH_ARGS} @${BINDIR}/all-java.srclst -classpath ${ARCADIA_BUILD_ROOT}/bfg.jar -Xpkginfo:always ${JAVAC_OPTS} $_JAR_ANN_PROC_OPTS($_JAR_ANN_PROCESSORS) -d ${BINDIR}/cls -g -encoding UTF-8
- }
- macro _ADD_HIDDEN_INPUTS(Inputs...) {
- .CMD=${input;hide:Inputs}
- }
- # tag:java-specific
- ERROR_PRONE_JDK16_ADD_OPENS=-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
- ERROR_PRONE_2_7_1_FORCED_OPTS=-Xep:InlineMeInliner:OFF -Xep:SameNameButDifferent:OFF
- # tag:java-specific
- macro _ADD_OPTS_IF_NON_EMPTY(Opt, Args...) {
- .CMD=${pre=$Opt :Args}
- }
- macro _ADD_GEN_POM_FROM_COORD_FILES_ARGS(Deps...) {
- .CMD=${pre=--deps-coords ;ext=.jar;suf=.mvn_coords:Deps}
- }
- MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin/mvn
- MAVEN_EXPORT_OUT_DIR_FLAG=$_ADD_OPTS_IF_NON_EMPTY(--output-dir ${MAVEN_EXPORT_OUT_DIR})
- MAVEN_EXPORT_SOURCE_DIRS=$_ADD_OPTS_IF_NON_EMPTY(--source-dirs ${ALL_SRCDIRS})
- MAVEN_EXPORT_DEPS_COORS=$_ADD_GEN_POM_FROM_COORD_FILES_ARGS(${MANAGED_PEERS_CLOSURE})
- MAVEN_EXPORT_OUT_DIR=
- MAVEN_EXPORT=no
- MAVEN_DEPLOY=no
- MAVEN_DEPLOY_SOURCES=
- MAVEN_EXPORT_VERSION={vcs_revision}
- MAVEN_EXPORT_GEN_DEPLST= \
- $WRITER_PY \
- --file ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mvn_coords:REALPRJNAME} \
- --ya-start-command-file -m ${pre=D=:MAVEN_EXPORT_COORDS_GLOBAL} ${pre=E=:EXCLUDED_MAVEN_EXPORT_COORDS_GLOBAL} --ya-end-command-file \
- ${hide:APPLIED_EXCLUDES}
- MAVEN_EXPORT_GEN_POM=${kv;hide:"mvn_export yes"} \
- $YMAKE_PYTHON ${input:"build/scripts/generate_pom.py"} \
- --from-coord-files \
- --vcs-info $(VCS)/vcs.json \
- --target-path $MODDIR \
- $MAVEN_EXPORT_SOURCE_DIRS \
- $MAVEN_EXPORT_DEPS_COORS \
- $MAVEN_EXPORT_OUT_DIR_FLAG \
- --target-coords ${suf=.mvn_coords:TARGET} \
- --pom-path ${output:"pom.xml"}
- MAVEN_DEPLOY_CMD=$YMAKE_PYTHON ${input:"build/scripts/stdout2stderr.py"} $MAVEN_BIN \
- deploy:deploy-file -DpomFile=$BINDIR/pom.xml \
- -Dfile=$TARGET -DrepositoryId=$MAVEN_REPO_ID -Durl=$MAVEN_REPO_URL -Djava.net.preferIPv4Addresses=false -Djava.net.preferIPv6Addresses=true \
- ${MAVEN_DEPLOY_SOURCES} \
- $_ADD_OPTS_IF_NON_EMPTY(-gs $MAVEN_EXPORT_SETTINGS) \
- $_ADD_OPTS_IF_NON_EMPTY(-s $MAVEN_EXPORT_SETTINGS)
- MAVEN_EXPORT_CMD=
- # tag:java-specific
- JAVA_COVERAGE_SRCLIST_FLAG=--coverage ${output;pre=${MODULE_PREFIX};suf=.cpsf:REALPRJNAME} --source-root ${ARCADIA_ROOT}
- JAVA_COVERAGE_SRCLIST=
- PREPARE_JAVA_BUILD_DIRS=$FS_TOOLS md ${BINDIR}/cls && $FS_TOOLS md ${BINDIR}/misc
- EXTRACT_GENDIRS=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/autotar_gendirs.py"} --unpack --ext .gentar ${ext=.gentar:AUTO_INPUT}
- COLLECT_JAVA_SRCLIST=${YMAKE_PYTHON} ${input:"build/scripts/make_java_srclists.py"} ${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/java_pack_to_file.py"} --moddir ${CURDIR} --java ${BINDIR}/all-java.srclst ${KT_SRSCLIST} ${JAVA_COVERAGE_SRCLIST} --ya-start-command-file ${ALL_JAR_SOURCES} ${ext=.java:AUTO_INPUT} ${ext=.kt:AUTO_INPUT} --ya-end-command-file
- COLLECT_CLASSPATH=${WRITER_PY} --file ${BINDIR}/bfg.txt -m --ya-start-command-file ${rootrel:MANAGED_PEERS_CLOSURE} $KT_CLASSPATH_ITEM --ya-end-command-file
- LINK_CLASSPATH=${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/bfg.txt ${ARCADIA_BUILD_ROOT}/bfg.jar
- COMPILE_JAVA_SRCLIST=$_JAVAC_RUN_HELPER($JAVAC_CMD)
- PACK_JAR=$_PACK_JAR_HELPER($TARGET)
- # NOTE: No && before LINK_JAR_RESOURCES, ALL_KT_COMMANDS and JAR_GEN_SRCS needed since those vars either empty or starts with &&
- LINK_JAR=${hide:JAVA_FAKEID} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"} \
- $PREPARE_JAVA_BUILD_DIRS \
- && $EXTRACT_GENDIRS \
- && $COLLECT_JAVA_SRCLIST \
- $JAR_GEN_SRCS \
- $ALL_KT_COMMANDS \
- && $COLLECT_CLASSPATH \
- && $LINK_CLASSPATH \
- && $COMPILE_JAVA_SRCLIST \
- $LINK_JAR_RESOURCES \
- && ${cwd;suf=/cls:BINDIR} $GENERATE_VCS_JAVA_INFO_NODEP . \
- $_PACK_SRC_JAR \
- $_PACK_JNI \
- && $PACK_JAR \
- $_DO_JAVA_YNDEXING \
- $_MAKE_JSTYLE_FILE_LIST \
- $_LINK_UBERJAR \
- $MAVEN_EXPORT_CMD \
- $_ADD_HIDDEN_INPUTS($JAVA_EXTERNAL_DEPENDENCIES_VALUE)
- # tag:java-specific
- _EXT_SRC_JAR=
- _EXT_JAR=
- _COPY_EXT_SRC_JAR= && $FS_TOOLS md ${BINDIR}/empty && ${cwd;suf=/empty:BINDIR} $JDK_RESOURCE/bin/jar cfvM ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME} .
- _DO_USE_EXT_JAR=${hide:JAVA_FAKEID} $FS_TOOLS copy ${input:_EXT_JAR} $TARGET $_COPY_EXT_SRC_JAR $MAVEN_EXPORT_CMD
- _DO_COPY_EXT_SRC_JAR= && $FS_TOOLS copy $_EXT_SRC_JAR ${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
- macro JAVA_RESOURCE(JAR, SOURCES="") {
- SET(_EXT_SRC_JAR $SOURCES)
- SET(_EXT_JAR $JAR)
- }
- # tag:java-specific tag:fbs
- JAVA_FLATBUFFERS_VERSION = 2.0.0
- # tag:java-specific
- module _COMPILABLE_JAR_BASE : _JAR_BASE {
- # flatbuffers-java
- DEPENDENCY_MANAGEMENT(contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/flatbuffers/flatbuffers-java EXCEPT contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION})
- # protobuf-java
- DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java EXCEPT contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION})
- # protobuf-javalite
- DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-javalite EXCEPT contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION})
- # protobuf-java-util
- DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-java-util EXCEPT contrib/java/com/google/protobuf/protobuf-java-util/${JAVA_PROTO_RUNTIME_VERSION})
- }
- _JAR_MAIN_CLASS=
- macro JAR_MAIN_CLASS(Class) {
- SET(_JAR_MAIN_CLASS ${Class})
- }
- _JAR_MAIN_SEM=
- _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
- 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
- ### _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= \
- 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})
- # tag:java-specific tag:internal
- ### @usage: JAR_LIBRARY() #internal
- ###
- ### Reimplementation of the JAVA_LIBRARY with ymake.core.conf and ymake based dependency management
- module JAR_LIBRARY: _COMPILABLE_JAR_BASE {
- .EXTS=.jsrc .java .jar .mf .gentar .kt
- .CMD=LINK_JAR
- .SEM=BUILD_JAR_SEM
- .FINAL_TARGET=yes
- .ALIASES=JAVA_SRCS=IDEA_JAR_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
- .RESTRICTED=EXTERNAL_JAR
- .GLOBAL=MAVEN_EXPORT_COORDS EXPORT_GRADLE_PROJECT_COORDS
- MODULE_SUFFIX=.jar
- PEERDIR(build/platform/java/jdk)
- PEERDIR+=$JDK_RESOURCE_PEERDIR
- when ($_EXT_SRC_JAR) {
- _COPY_EXT_SRC_JAR=_DO_COPY_EXT_SRC_JAR
- }
- when ($_EXT_JAR) {
- LINK_JAR=$_DO_USE_EXT_JAR
- }
- when ($OPENSOURCE_EXPORT == "no") {
- BUILD_JAR_SEM=IGNORED
- }
- when ($_JAR_MAIN_CLASS) {
- _JAR_MAIN_SEM=$_ADD_JAR_MAIN_SEM
- }
- when ($GRADLE_EXPORT_PUBLISHING == "yes") {
- _GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
- }
- # in the ideal world this statement must be under condition bellow
- DEPENDENCY_MANAGEMENT(contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
- when ($WITH_KOTLIN_VALUE) {
- KT_SRSCLIST=$KT_SRSCLIST_FLAG
- _MAKE_LINT_KT_FILES_LIST = $YMAKE_PYTHON ${input:"build/scripts/kt_copy.py"} $KT_SRCLIST ${output;noauto:"all-kt-sources.txt"} $(SOURCE_ROOT) $(BUILD_ROOT)
- ALL_KT_COMMANDS=&& $COLLECT_KT_CLASSPATH && $LINK_KT_CLASSPATH
- when ($WITH_KAPT_VALUE == "yes") {
- # For Kapt usage see: https://kotlinlang.org/docs/kapt.html#using-in-cli
- # See for kapt.kotlin.generated: https://github.com/JetBrains/kotlin/blob/master/plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGeneration/build.txt
- _KAPT_OPTS=-Xplugin=${tool:"contrib/java/org/jetbrains/kotlin/kotlin-annotation-processing/1.8.20"} $KT_KAPT_PLUGIN_OPTS
- _RUN_KAPT=${YMAKE_PYTHON} ${input:"build/scripts/with_kapt_args.py"} ${pre=--ap-classpath :KT_KAPT_AP_CLASSPATH} -- $COMPILE_KT $_KAPT_OPTS
- _APPEND_KAPT_GENERATED_SRCS=$YMAKE_PYTHON ${input:"build/scripts/resolve_java_srcs.py"} -d $KT_KAPT_SOURCES_DIR --include-patterns '**/*.java' '**/*.kt' --resolve-kotlin --append -s ${BINDIR}/all-java.srclst -k $KT_SRCLIST -r ${BINDIR}/not-used.txt
- ALL_KT_COMMANDS+=&& $_RUN_KAPT && $_APPEND_KAPT_GENERATED_SRCS
- }
- ALL_KT_COMMANDS+=&& $COMPILE_KT && $_MAKE_LINT_KT_FILES_LIST
- LINK_JAR_RESOURCES+=&& $FS_TOOLS copy_all_files ${KT_CLASSES_DIR} ${BINDIR}/cls
- PEERDIR+=build/platform/java/kotlin contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8
- when($WITH_KOTLINC_PLUGIN_ALLOPEN) {
- KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-allopen-plugin.jar
- }
- when($WITH_KOTLINC_PLUGIN_LOMBOK) {
- KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-lombok-plugin.jar
- }
- when($WITH_KOTLINC_PLUGIN_NOARG) {
- KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-noarg-plugin.jar
- }
- when($WITH_KOTLINC_PLUGIN_SERIALIZATION) {
- KOTLINC_OPTS_VALUE+=-Xplugin=${KOTLIN_COMPILER_RESOURCE_GLOBAL}/plugins/kotlin-serialization-plugin.jar
- }
- # Must be in sync with KT_CLASSES_DIR!
- # There are problems in JDK13 with abs paths in classpath baked into jar file manifest. Using relative path
- # here assumes that jar file with classpath for javac located in the $ARCADIA_BUILD_ROOT
- KT_CLASSPATH_ITEM=$MODDIR/kt_cls
- }
- otherwise {
- KT_SRSCLIST=
- ALL_KT_COMMANDS=
- KT_CLASSES=
- }
- when ($MAVEN_EXPORT == "yes") {
- when ($MAVEN_DEPLOY == "yes") {
- PEERDIR+=build/external_resources/maven
- MAVEN_EXPORT_CMD= && $MAVEN_EXPORT_GEN_DEPLST && $MAVEN_EXPORT_GEN_POM && $MAVEN_DEPLOY_CMD
- }
- 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}:
- }
- when ($SOURCES_JAR == "yes") {
- _PACK_SRC_JAR=$_PACK_SRC_JAR_IMPL
- MAVEN_DEPLOY_SOURCES=-Dsources=${output;pre=${BINDIR}/${MODULE_PREFIX};suf=-sources.jar:REALPRJNAME}
- }
- when ($JAVA_COVERAGE == "yes") {
- JAVA_COVERAGE_SRCLIST=$JAVA_COVERAGE_SRCLIST_FLAG
- }
- when ($MAKE_UBERJAR_VALUE == "yes") {
- _LINK_UBERJAR=$_DO_LINK_UBERJAR
- PACK_JAR=$_PACK_JAR_HELPER(${BINDIR}/${REALPRJNAME}.lib.jar)
- # TODO: This condition is incorrect in case of autoinputs _UBERJAR_SELF should be empty only for
- # modules without AUTO_INPUT and without JAVA_SRCS added inputs.
- when($ALL_JAR_SOURCES) {
- _UBERJAR_SELF=--jar ${BINDIR}/${REALPRJNAME}.lib.jar
- }
- PEERDIR+=build/platform/java/uberjar
- PEERDIR+=$UBERJAR_RESOURCE_PEERDIR
- }
- when($JAVA_YNDEXING == "yes") {
- PEERDIR+=build/platform/java/kythe
- _DO_JAVA_YNDEXING=&& $_JAVAC_RUN_HELPER($_JAVA_YNDEXING_CMD) && ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} kindex.tar .kzip ${output;hide;tared:"kindex.tar"}
- }
- when($ERROR_PRONE_VALUE) {
- PEERDIR+=$ERROR_PRONE_PEERDIR
- JAVAC_CMD=$ERROR_PRONE_JAVAC_CMD
- }
- when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "16") {
- JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
- JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
- }
- when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "17") {
- JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
- JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
- }
- when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "18") {
- JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
- JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
- }
- when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "19") {
- JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
- JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
- }
- when($ERROR_PRONE_VALUE && $JDK_REAL_VERSION == "20") {
- JAVAC_FLAGS_VALUE+=$ERROR_PRONE_JDK16_ADD_OPENS
- JAVAC_OPTS+=$ERROR_PRONE_JDK16_ADD_OPENS
- }
- when($ERROR_PRONE_VALUE && $ERROR_PRONE_VERSION == "2.7.1") {
- JAVAC_FLAGS_VALUE+=$ERROR_PRONE_2_7_1_FORCED_OPTS
- JAVAC_OPTS+=$ERROR_PRONE_2_7_1_FORCED_OPTS
- }
- when ($JAVA_ADD_DLLS_VALUE == "yes") {
- CONSUME_NON_MANAGEABLE_PEERS=yes
- _PACK_JNI=$_PACK_JNI_CMD
- }
- when ($LINT_LEVEL_VALUE != "none") {
- _MAKE_JSTYLE_FILE_LIST= && ${WRITER_PY} --file ${output;noauto:"lint-java.srclst"} -m --ya-start-command-file $LINT_JAVA_SOURCES --ya-end-command-file
- }
- SET(MODULE_TYPE JAVA_LIBRARY)
- ENABLE(YMAKE_JAVA_TEST)
- _ADD_KOTLIN_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/all-kt-sources.txt REQUIREMENTS cpu:2)
- _ADD_JAVA_STYLE_CHECKS($(BUILD_ROOT)/$MODDIR/lint-java.srclst::$(SOURCE_ROOT))
- _ADD_CLASSPATH_CLASH_CHECK()
- JAVA_MODULE()
- }
- # tag:java-specific
- _SCRIPTGEN_FLAGS=
- macro _GEN_JAVA_SCRIPT_IMPL(Out, Template, Props...) {
- .CMD=$SCRIPTGEN_RESOURCE_GLOBAL/scriptgen --java $JDK_RESOURCE/bin/java --output ${output:Out} --template ${input:Template} ${_SCRIPTGEN_FLAGS} -D JAR_NAME=${REALPRJNAME}.jar -D CLASSPATH=${nopath;join;ext=.jar;pre="::":MANAGED_PEERS_CLOSURE} -D PROJECT_DIR=${MODDIR} -D JAR_BASENAME=${REALPRJNAME} $Props
- }
- # tag:java-specific
- _GEN_USERSCRIPTS=
- macro _ADD_GEN_JAVA_SCRIPT(Out, Template, Props...) {
- SET_APPEND(_GEN_USERSCRIPTS && \$_GEN_JAVA_SCRIPT_IMPL($Out $Template $Props))
- }
- # tag:java-specific
- _PACK_JDK=
- # tag:java-specific
- DO_GEN_JAVA_RUN_SH=
- _SOURCE_JARS=
- _SOURCE_JARS_CPLIST=
- GEN_JAVA_RUN_SH=$SCRIPTGEN_RESOURCE_GLOBAL/scriptgen --java $JDK_RESOURCE/bin/java --output ${output:"run.sh"} -D GENERATE_DEFAULT_RUNNER=yes -D JAR_NAME=${REALPRJNAME}.jar -D CLASSPATH=${nopath;join;pre="::":MANAGED_PEERS_CLOSURE} -D PROJECT_DIR=${REALPRJNAME} -D JAR_BASENAME=${REALPRJNAME}
- GEN_RUN_CP=${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${nopath;qe;pre=$REALPRJNAME/:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET}
- COLLECT_JAR_PROGRAM_CP=$FS_TOOLS link_or_copy_to_dir --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} ${ext=.so:MANAGED_PEERS_CLOSURE} ${ext=.dll:MANAGED_PEERS_CLOSURE} ${ext=.dylib:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS} --ya-end-command-file ${BINDIR}/${REALPRJNAME} ${hide;late_out;nopath;ext=.jar;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE}
- MAKE_JAR_PROGRAM_CPLST=${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} --ya-start-command-file ${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS_CPLIST} --ya-end-command-file
- TAR_CLASSPATH= && $YMAKE_PYTHON ${input:"build/scripts/find_and_tar.py"} ${output;pre=$MODULE_PREFIX;suf=.tar:REALPRJNAME} ${cwd;pre=$BINDIR/:REALPRJNAME}
- DO_TAR_CLASSPATH=
- LINK_JAR_PROGRAM=${hide:JAVA_FAKEID} $FS_TOOLS md ${BINDIR}/${REALPRJNAME} && $COLLECT_JAR_PROGRAM_CP && $DO_GEN_JAVA_RUN_SH && $GEN_RUN_CP && $MAKE_JAR_PROGRAM_CPLST $DO_TAR_CLASSPATH $_GEN_USERSCRIPTS $_PACK_JDK ${kv;hide:"p JP"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
- # tag:java-specific
- # UBERJAR program link command
- LINK_UBERJAR_PROGRAM=${hide:JAVA_FAKEID} ${kv;hide:"p UJ"} ${MAKE_JAVA_CLASSPATH_FILE} --from-args ${output;pre=$MODULE_PREFIX;suf=${MODULE_SUFFIX}.cplst:REALPRJNAME} $TARGET \
- && $FS_TOOLS md ${BINDIR}/${REALPRJNAME} \
- && $FS_TOOLS link_or_copy ${BINDIR}/${REALPRJNAME}.jar $TARGET \
- && $FS_TOOLS link_or_copy_to_dir --ya-start-command-file ${BINDIR}/${REALPRJNAME}.jar ${ext=.so:MANAGED_PEERS_CLOSURE} ${ext=.dll:MANAGED_PEERS_CLOSURE} ${ext=.dylib:MANAGED_PEERS_CLOSURE} ${_SOURCE_JARS} --ya-end-command-file ${BINDIR}/${REALPRJNAME} ${hide;output;ext=.jar;pre=$BINDIR/$REALPRJNAME/:REALPRJNAME} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/$REALPRJNAME/:MANAGED_PEERS_CLOSURE} \
- $DO_TAR_CLASSPATH \
- $_GEN_USERSCRIPTS \
- $_PACK_JDK
- # tag:java-specific
- RUN_WITH_SOURCES=no
- # TODO jbuild creates tar with all classpath deps by default and some projects rely on this. In ymake build this tar file creation is not needed and should be disabled by default in future
- TARED_CLASSPATH=yes
- _JAR_SRCS_CALLED=no
- # tag:java-specific
- macro _MARK_JAVA_PROG_WITH_SOURCES(Args...) {
- ENABLE(_JAR_SRCS_CALLED)
- }
- # tag:java-specific
- module _JAR_RUNNABLE: _COMPILABLE_JAR_BASE {
- .FINAL_TARGET=yes
- .CMD=LINK_JAR_PROGRAM
- .SEM=IGNORED
- .ALIASES=JAVA_SRCS=_MARK_JAVA_PROG_WITH_SOURCES GENERATE_SCRIPT=_YMAKE_GENERATE_SCRIPT
- .ALLOWED=WITH_JDK
- MODULE_SUFFIX=.run.cp.jar
- CONSUME_NON_MANAGEABLE_PEERS=yes
- when ($RUN_WITH_SOURCES == "yes") {
- _SOURCE_JARS=${ext=.jar;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE} ${hide;late_out;ext=.jar;nopath;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
- _SOURCE_JARS_CPLIST=${nopath;rootrel;ext=.jar;pre=$BINDIR/$REALPRJNAME/;noext;suf=-sources.jar:MANAGED_PEERS_CLOSURE}
- }
- when ($TARED_CLASSPATH == "yes") {
- DO_TAR_CLASSPATH=$TAR_CLASSPATH
- }
- when ($DISABLE_SCRIPTGEN) {
- DO_GEN_JAVA_RUN_SH=
- }
- otherwise {
- DO_GEN_JAVA_RUN_SH=$GEN_JAVA_RUN_SH
- PEERDIR+=build/platform/java/scriptgen
- }
- when ($WITH_JDK_VALUE) {
- _PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
- }
- when ($MAKE_UBERJAR_VALUE == "yes") {
- LINK_JAR_PROGRAM=$LINK_UBERJAR_PROGRAM
- DYNAMIC_LINK=no
- _SCRIPTGEN_FLAGS=-D IS_UBERJAR=yes
- }
- otherwise {
- _SCRIPTGEN_FLAGS=-D IS_UBERJAR=no
- }
- CHECK_PROVIDES()
- }
- # tag:java-specific
- multimodule JAR_PROGRAM {
- module JAR_RUNNABLE: _JAR_RUNNABLE {
- .ALLOWED=JAVA_RUNTIME_PEERDIR JAVA_RUNTIME_EXCLUDE
- .IGNORED=JAVA_SRCS RUN_JAVA_PROGRAM
- .ALIASES=EXCLUDE=_NOOP_MACRO PEERDIR=_NOOP_MACRO DEPENDENCY_MANAGEMENT=_NOOP_MACRO JAVA_RUNTIME_PEERDIR=PEERDIR JAVA_RUNTIME_EXCLUDE=EXCLUDE
- .PEERDIRSELF=JAR_COMPILATION
- SET(MODULE_TYPE JAVA_PROGRAM)
- }
- module JAR_COMPILATION: JAR_LIBRARY {
- .ALIASES=JAVA_RUNTIME_PEERDIR=_NOOP_MACRO JAVA_RUNTIME_EXCLUDE=_NOOP_MACRO
- .FINAL_TARGET=no
- SET(MODULE_TYPE JAVA_PROGRAM)
- }
- }
- # tag:java-specific
- LINK_JAR_TEST=${hide:JAVA_FAKEID} ${WRITER_PY} --file ${BINDIR}/run-bf.txt -Q -m --ya-start-command-file ${ext=.jar:MANAGED_PEERS_CLOSURE} --ya-end-command-file && ${YMAKE_PYTHON} ${input:"build/scripts/make_manifest_from_bf.py"} ${BINDIR}/run-bf.txt ${TARGET} ${kv;hide:"p JT"}
- YMAKE_JAVA_TEST=
- module _JAR_TEST: _COMPILABLE_JAR_BASE {
- .FINAL_TARGET=yes
- .CMD=LINK_JAR_TEST
- .DEFAULT_NAME_GENERATOR=FullPath
- CONSUME_NON_MANAGEABLE_PEERS=yes
- SET(MODULE_SUFFIX .test.cp.jar)
- ENABLE(YMAKE_JAVA_TEST)
- JAVA_TEST()
- CHECK_PROVIDES()
- SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
- }
- # tag:java-specific
- JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
- # tag:java-specific
- JDK_REAL_VERSION=
- JDK_VERSION=
- when ($JDK_VERSION == "20") {
- JDK_REAL_VERSION=20
- }
- elsewhen ($JDK_VERSION == "19") {
- JDK_REAL_VERSION=19
- }
- elsewhen ($JDK_VERSION == "18") {
- JDK_REAL_VERSION=18
- }
- elsewhen ($JDK_VERSION == "17") {
- JDK_REAL_VERSION=17
- }
- elsewhen ($JDK_VERSION == "16") {
- JDK_REAL_VERSION=16
- }
- elsewhen ($JDK_VERSION == "15") {
- JDK_REAL_VERSION=15
- }
- elsewhen ($JDK_VERSION == "11") {
- JDK_REAL_VERSION=11
- }
- elsewhen ($JDK_VERSION == "10") {
- JDK_REAL_VERSION=10
- }
- elsewhen ($JDK_VERSION == "8") {
- JDK_REAL_VERSION=8
- }
- elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
- JDK_REAL_VERSION=11
- }
- otherwise {
- JDK_REAL_VERSION=17
- }
- # tag:java-specific
- # remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
- when ($USE_SYSTEM_JDK) {
- JDK_RESOURCE_PEERDIR=
- }
- otherwise {
- when ($JDK_REAL_VERSION == "20") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk20 build/platform/java/jdk/jdk17
- }
- when ($JDK_REAL_VERSION == "19") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk19 build/platform/java/jdk/jdk17
- }
- when ($JDK_REAL_VERSION == "18") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk18 build/platform/java/jdk/jdk17
- }
- when ($JDK_REAL_VERSION == "17") {
- # need jdk11 for spare parts in "host" platform
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
- }
- when ($JDK_REAL_VERSION == "16") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk16 build/platform/java/jdk/jdk17
- }
- when ($JDK_REAL_VERSION == "15") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk15 build/platform/java/jdk/jdk17
- }
- when ($JDK_REAL_VERSION == "11") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
- }
- when ($JDK_REAL_VERSION == "10") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk10 build/platform/java/jdk/jdk17
- }
- when ($JDK_REAL_VERSION == "8") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
- }
- }
- # tag:java-specific
- when ($JDK_REAL_VERSION == "20") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar20
- }
- when ($JDK_REAL_VERSION == "19") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
- }
- when ($JDK_REAL_VERSION == "18") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
- }
- when ($JDK_REAL_VERSION == "17") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
- }
- when ($JDK_REAL_VERSION == "16") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar16
- }
- when ($JDK_REAL_VERSION == "15") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar15
- }
- when ($JDK_REAL_VERSION == "11") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
- }
- when ($JDK_REAL_VERSION == "10") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar10
- }
- when ($JDK_REAL_VERSION == "8") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar8
- }
- # tag:java-specific
- JAVAC_OPTS=
- when ($USE_SYSTEM_JDK) {
- JDK_RESOURCE=$USE_SYSTEM_JDK
- }
- otherwise {
- when ($JDK_REAL_VERSION == "20") {
- JDK_RESOURCE=$JDK20_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "19") {
- JDK_RESOURCE=$JDK19_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "18") {
- JDK_RESOURCE=$JDK18_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "17") {
- JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "16") {
- JDK_RESOURCE=$JDK16_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "15") {
- JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "11") {
- JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "10") {
- JDK_RESOURCE=$JDK10_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "8") {
- JDK_RESOURCE=$JDK8_RESOURCE_GLOBAL
- }
- }
- # tag:java-specific
- when (!$USE_SYSTEM_ERROR_PRONE) {
- # Still not done: DTCC-667
- when ($JDK_REAL_VERSION == "8" || $JDK_REAL_VERSION == "10") {
- ERROR_PRONE_VERSION=2.3.1
- ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.3.1
- ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_3_1_RESOURCE_GLOBAL
- }
- elsewhen ($JDK_REAL_VERSION == "11" || $JDK_REAL_VERSION == "15" || $JDK_REAL_VERSION == "16") {
- ERROR_PRONE_VERSION=2.7.1
- ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
- ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
- }
- elsewhen ($JDK_REAL_VERSION == "17") {
- ERROR_PRONE_VERSION=2.10.0
- ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
- ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
- }
- elsewhen ($JDK_REAL_VERSION == "18") {
- ERROR_PRONE_VERSION=2.14.0
- ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.14.0
- ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_14_0_RESOURCE_GLOBAL
- }
- elsewhen ($JDK_REAL_VERSION == "19") {
- ERROR_PRONE_VERSION=2.18.0
- ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
- ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
- }
- elsewhen ($JDK_REAL_VERSION == "20") {
- ERROR_PRONE_VERSION=2.18.0
- ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
- ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
- }
- otherwise {
- ERROR_PRONE_VERSION=2.7.1
- ERROR_PRONE_PEERDIR=build/platform/java/error_prone
- ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
- }
- }
- otherwise {
- ERROR_PRONE_VERSION=2.7.1
- ERROR_PRONE_PEERDIR=build/platform/java/error_prone
- ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
- }
- # tag:java-specific
- when ($USE_SYSTEM_UBERJAR) {
- UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
- }
- otherwise {
- when ($JDK_REAL_VERSION == "20") {
- UBERJAR_RESOURCE=$UBERJAR20_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "19") {
- UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "18") {
- UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "17") {
- UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "16") {
- UBERJAR_RESOURCE=$UBERJAR16_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "15") {
- UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "11") {
- UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "10") {
- UBERJAR_RESOURCE=$UBERJAR10_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "8") {
- UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
- }
- }
- # tag:java-specific
- when ($JDK_REAL_VERSION == "20") {
- WITH_JDK_RESOURCE=$WITH_JDK20_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "19") {
- WITH_JDK_RESOURCE=$WITH_JDK19_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "18") {
- WITH_JDK_RESOURCE=$WITH_JDK18_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "17") {
- WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "16") {
- WITH_JDK_RESOURCE=$WITH_JDK16_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "15") {
- WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "11") {
- WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "10") {
- WITH_JDK_RESOURCE=$WITH_JDK10_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "8") {
- WITH_JDK_RESOURCE=$WITH_JDK8_RESOURCE_GLOBAL
- }
- # tag:java-specific
- EXTERNAL_JAVA_JDK_RESOURCE=
- EXTERNAL_JAVA_EXTRA_PEERDIR=
- when ($USE_SYSTEM_JDK) {
- EXTERNAL_JAVA_EXTRA_PEERDIR=
- EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
- }
- elsewhen ($JDK_VERSION == "") {
- EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
- EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
- }
- otherwise {
- EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
- }
- COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --java-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/java --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar --kotlin-compiler $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar $JAVA_VCS_MF_ARG $PACKAGE_PREFIX_ARGS --jar-output $TARGET --srcs-jar-output ${output;suf=-sources.jar:REALPRJNAME} $AUTO_INPUT DELIM $JAVAC_OPTS DELIM $MANAGED_PEERS_CLOSURE DELIM -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} ${KOTLINC_OPTS_VALUE} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"}
- ARGS_DELIM="MACRO_CALLS_DELIM"
- SYSTEM_PROPERTIES_VALUE=
- ### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
- ###
- ### List of Key,Value pairs that will be available to test via System.getProperty().
- ### FILE means that parst should be read from file specifies as Path.
- ###
- ### Documentation: https://wiki.yandex-team.ru/yatool/test/
- macro SYSTEM_PROPERTIES(Args...) {
- SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
- }
- # tag:java-specific
- JVM_ARGS_VALUE=
- ### @usage: JVM_ARGS(Args...)
- ###
- ### Arguments to run Java programs in tests.
- ###
- ### Documentation: https://wiki.yandex-team.ru/yatool/test/
- macro JVM_ARGS(Args...) {
- SET_APPEND(JVM_ARGS_VALUE $Args)
- }
- # tag:java-specific
- CHECK_JAVA_DEPS_VALUE=
- ### @usage: CHECK_JAVA_DEPS(<yes|no>)
- ###
- ### Check for different classes with duplicate name in classpath.
- ###
- ### Documentation: https://wiki.yandex-team.ru/yatool/test/
- macro CHECK_JAVA_DEPS(Arg) {
- SET(CHECK_JAVA_DEPS_VALUE $Arg)
- }
- ERROR_PRONE_VALUE=
- ### @usage: USE_ERROR_PRONE()
- ###
- ### Use errorprone instead of javac for .java compilation.
- macro USE_ERROR_PRONE() {
- SET(ERROR_PRONE_VALUE yes)
- }
- # tag:java-specific
- MAKE_UBERJAR_VALUE=
- ### @usage: UBERJAR()
- ###
- ### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
- ### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
- ### Use UBERJAR inside JAVA_PROGRAM module.
- ###
- ### You can use the following macros to configure the archive:
- ### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
- ### 2. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
- ### 3. UBERJAR_PATH_EXCLUDE_PREFIX the prefix for classes that should not get into the jar archive (all classes are placed into the archive by default)
- ### 4. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
- ### 5. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
- ### 6. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
- ### 7. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
- ###
- ### Documentation: https://wiki.yandex-team.ru/yatool/java/
- ###
- ### @see: [JAVA_PROGRAM](#module_JAVA_PROGRAM), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX), [UBERJAR_HIDE_EXCLUDE_PATTERN](#macro_UBERJAR_HIDE_EXCLUDE_PATTERN), [UBERJAR_PATH_EXCLUDE_PREFIX](#macro_UBERJAR_PATH_EXCLUDE_PREFIX)
- macro UBERJAR() {
- SET(MAKE_UBERJAR_VALUE yes)
- DISABLE(PASS_PEERS)
- }
- # tag:java-specific
- UBERJAR_PREFIX_VALUE=
- UBERJAR_PREFIX_FLAG=
- ### @usage: UBERJAR_HIDING_PREFIX(Arg)
- ###
- ### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
- ### Classes remain in their packages by default.
- ###
- ### @see: [UBERJAR](#macro_UBERJAR)
- macro UBERJAR_HIDING_PREFIX(Arg) {
- SET(UBERJAR_PREFIX_VALUE $Arg)
- SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
- }
- # tag:java-specific
- UBERJAR_HIDE_EXCLUDE_VALUE=
- UBERJAR_HIDE_EXCLUDE_FLAGS=
- ### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
- ###
- ### Exclude classes matching this patterns from shading (if enabled).
- ### Pattern may contain '*' and '**' globs.
- ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
- ###
- ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
- macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
- SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
- SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
- }
- # tag:java-specific
- UBERJAR_PATH_EXCLUDES=
- UBERJAR_PATH_EXCLUDE_VALUE=
- ### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
- ###
- ### Exclude classes matching this patterns from UBERJAR.
- ### By default all dependencies of UBERJAR program will lend in a .jar archive.
- ###
- ### @see: [UBERJAR](#macro_UBERJAR)
- macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
- SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
- SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
- }
- # tag:java-specific
- UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
- UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
- ### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
- ###
- ### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
- ###
- ### @see: [UBERJAR](#macro_UBERJAR)
- macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
- SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
- SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
- }
- # tag:java-specific
- UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
- UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
- ### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
- ###
- ### Transform manifest.mf for UBERJAR() java programs, set attribute
- ###
- ### @see: [UBERJAR](#macro_UBERJAR)
- macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value) {
- SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Value)
- SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:${Value})
- }
- # tag:java-specific
- UBERJAR_APPENDING_TRANSFORMER_VALUE=
- UBERJAR_APPENDING_TRANSFORMER_FLAGS=
- ### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
- ###
- ### Add AppendingTransformer for UBERJAR() java programs
- ###
- ### Parameters:
- ### - Resource - Resource name
- ###
- ### @see: [UBERJAR](#macro_UBERJAR)
- macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
- SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
- SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
- }
- # tag:java-specific
- UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
- UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
- ### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
- ###
- ### Add ServicesResourceTransformer for UBERJAR() java programs
- ###
- ### @see: [UBERJAR](#macro_UBERJAR)
- macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
- SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
- SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
- }
- # tag:idea-specific
- IDEA_EXCLUDE_DIRS_VALUE=
- ### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
- ###
- ### Exclude specified directories from an idea project generated by ya ide idea
- ### Have no effect on regular build.
- macro IDEA_EXCLUDE_DIRS(Args...) {
- SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
- }
- # tag:idea-specific
- IDEA_RESOURCE_DIRS_VALUE=
- ### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
- ###
- ### Set specified resource directories in an idea project generated by ya ide idea
- ### Have no effect on regular build.
- macro IDEA_RESOURCE_DIRS(Args...) {
- SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
- }
- # tag:idea-specific
- IDEA_MODULE_NAME_VALUE=
- ### @usage: IDEA_MODULE_NAME(module_name)
- ###
- ### Set module name in an idea project generated by ya ide idea
- ### Have no effect on regular build.
- macro IDEA_MODULE_NAME(Name) {
- SET(IDEA_MODULE_NAME_VALUE $Name)
- }
- # tag:java-specific
- JAVAC_FLAGS_VALUE=
- ### @usage: JAVAC_FLAGS(Args...)
- ###
- ### Set additional Java compilation flags.
- macro JAVAC_FLAGS(Args...) {
- SET_APPEND(JAVAC_OPTS $Args)
- SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
- }
- # tag:java-specific
- ENABLE_PREVIEW_VALUE=
- ### @usage: ENABLE_PREVIEW()
- ###
- ### Enable java preview features.
- macro ENABLE_PREVIEW() {
- SET_APPEND(JVM_ARGS_VALUE --enable-preview)
- SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
- SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
- SET(ENABLE_PREVIEW_VALUE yes)
- }
- # tag:java-specific
- SAVE_JAVAC_GENERATED_SRCS=
- SAVE_JAVAC_GENERATED_SRCS_DIR=
- SAVE_JAVAC_GENERATED_SRCS_TAR=
- when ($SAVE_JAVAC_GENERATED_SRCS) {
- SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
- SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
- JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
- }
- # 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
- ### @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(PUBLISH_MAVEN_VERSION $VERSION)
- }
- # tag:java-specific
- ANNOTATION_PROCESSOR_VALUE=
- ### @usage: ANNOTATION_PROCESSOR(processors...)
- ###
- ### The macro is in development.
- ### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
- macro ANNOTATION_PROCESSOR(Args...) {
- SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $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)
- }
- # tag:java-specific
- JAVA_SRCS_VALUE=
- ### @usage: JAVA_SRCS(srcs)
- ###
- ### Specify java source files and resources. A macro can be contained in any of four java modules.
- ### Keywords:
- ### 1. X SRCDIR - specify the directory x is performed relatively to search the source code for these patterns. If there is no SRCDIR, the source will be searched relative to the module directory.
- ### 2. PACKAGE_PREFIX x - use if source paths relative to the SRCDIR does not coincide with the full class names. For example, if all sources of module are in the same package, you can create a directory package/name , and just put the source code in the SRCDIR and specify PACKAGE_PREFIX package.name.
- ###
- ### @example:
- ### - example/ya.make
- ###
- ### JAVA_PROGRAM()
- ### JAVA_SRCS(SRCDIR src/main/java **/*)
- ### END()
- ###
- ### - example/src/main/java/ru/yandex/example/HelloWorld.java
- ###
- ### package ru.yandex.example;
- ### public class HelloWorld {
- ### public static void main(String[] args) {
- ### System.out.println("Hello, World!");
- ### }
- ### }
- ###
- ### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
- macro JAVA_SRCS(Args...) {
- SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
- }
- # tag:java-specific
- JAVA_ADD_DLLS_VALUE=no
- macro ADD_DLLS_TO_JAR() {
- SET(JAVA_ADD_DLLS_VALUE yes)
- }
- # tag:java-specific
- MANAGED_PEERS=
- MANAGED_PEERS_CLOSURE=
- RUN_JAVA_PROGRAM_MANAGED=
- MANAGEABLE_PEERS_ROOTS=contrib/java
- HAS_MANAGEABLE_PEERS=no
- PROPAGATES_MANAGEABLE_PEERS=no
- # All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
- # All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
- # This variable is used by JUnit tests but not TestNG.
- TEST_CLASSPATH_VALUE=
- # Calculated and replaced by ymake can be used in DART DATA
- TEST_CLASSPATH_MANAGED=
- # tag:java-specific
- DEPENDENCY_MANAGEMENT_VALUE=
- ### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
- ###
- ### Lock version of the library from the contrib/java at some point, so that all unversioned PEERDIRs to this library refer to the specified version.
- ###
- ### For example, if the module has PEERDIR (contrib/java/junit/junit), and
- ### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
- ### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
- ### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
- ### with the default from contrib/java/junit/junit/ya.make.
- ### These defaults are always there and are supported by maven-import, which puts
- ### there the maximum version available in contrib/java.
- ###
- ### The property is transitive. That is, if module A PEERDIRs module B, and B has PEERDIR(contrib/java/junit/junit), and this junit was replaced by junit-4.12, then junit-4.12 will come to A through B.
- ###
- ### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
- ###
- ### Documentation: https://wiki.yandex-team.ru/yatool/java/
- macro DEPENDENCY_MANAGEMENT(Args...) {
- SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
- _GHOST_PEERDIR($Args)
- }
- # tag:java-specific
- WITH_JDK_VALUE=
- ### @usage: WITH_JDK()
- ###
- ### Add directory with JDK to JAVA_PROGRAM output
- macro WITH_JDK() {
- SET(WITH_JDK_VALUE yes)
- }
- # tag:kotlin-specific
- WITH_KOTLIN_VALUE=
- ### @usage: WITH_KOTLIN()
- ###
- ### Compile kotlin source code in this java module
- macro WITH_KOTLIN() {
- SET(WITH_KOTLIN_VALUE yes)
- }
- # tag:kotlin-specific
- WITH_KAPT_VALUE=
- ### @usage: WITH_KAPT()
- ###
- ### Use kapt for as annotation processor
- macro WITH_KAPT() {
- SET(WITH_KAPT_VALUE yes)
- }
- # tag:java-specific
- WITH_GROOVY_VALUE=
- ### @usage: WITH_GROOVY()
- ###
- ### Compile groovy source code in this java module
- macro WITH_GROOVY() {
- SET(WITH_GROOVY_VALUE yes)
- }
- # tag:kotlin-specific
- KOTLINC_FLAGS_VALUE=-Xjvm-default=all
- ### @usage: KOTLINC_FLAGS(-flags)
- ###
- ### Set additional Kotlin compilation flags.
- macro KOTLINC_FLAGS(Args...) {
- SET_APPEND(KOTLINC_OPTS_VALUE $Args)
- }
- # tag:kotlin-sppecific
- WITH_KOTLINC_PLUGIN_ALLOPEN=
- macro _WITH_KOTLINC_ALLOPEN(Options...) {
- SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
- SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
- }
- # tag:kotlin-specific
- ### @usage: WITH_KOTLINC_ALLOPEN(-flags)
- ###
- ### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
- macro WITH_KOTLINC_ALLOPEN(HEAD, TAIL...) {
- _WITH_KOTLINC_ALLOPEN($HEAD $TAIL)
- }
- # tag:kotlin-specific
- WITH_KOTLINC_PLUGIN_LOMBOK=
- ### @usage: WITH_KOTLINC_LOMBOK(-flags)
- ###
- ### Enable lombok kotlin compiler plugin https://kotlinlang.org/docs/lombok.html
- macro WITH_KOTLINC_LOMBOK(Options...) {
- SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.lombok\::Options})
- SET(WITH_KOTLINC_PLUGIN_LOMBOK yes)
- }
- # tag:kotlin-specific
- WITH_KOTLINC_PLUGIN_NOARG=
- ### @usage: WITH_KOTLINC_NOARG(-flags)
- ###
- ### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
- macro WITH_KOTLINC_NOARG(Options...) {
- SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
- SET(WITH_KOTLINC_PLUGIN_NOARG yes)
- }
- # tag:kotlin-specific
- WITH_KOTLINC_PLUGIN_SERIALIZATION=
- ### @usage: WITH_KOTLINC_SERIALIZATION()
- ###
- ### Enable serialization kotlin compiler plugin https://kotlinlang.org/docs/serialization.html
- macro WITH_KOTLINC_SERIALIZATION() {
- SET(WITH_KOTLINC_PLUGIN_SERIALIZATION yes)
- }
- # tag:kotlin-specific
- ### Also search for _KAPT_OPTS and change version there
- KOTLIN_VERSION=1.8.20
- KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.8.20/ya.dependency_management.inc
- GROOVY_VERSION=3.0.5
- # tag:java-specific
- DIRECT_DEPS_ONLY_VALUE=
- ### @usage: DIRECT_DEPS_ONLY
- ###
- ### Add direct PEERDIR's only in java compile classpath
- macro DIRECT_DEPS_ONLY() {
- SET(DIRECT_DEPS_ONLY_VALUE yes)
- }
- # tag:java-specific
- JAVA_EXTERNAL_DEPENDENCIES_VALUE=
- ### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
- ###
- ### Add non-source java external build dependency (like lombok config file)
- macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
- SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
- }
- # tag:java-specific
- JAVA_CLASSPATH_CMD_TYPE_VALUE=
- # tag:java-specific
- ### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
- ### Available types: MANIFEST(default), COMMAND_FILE, LIST
- ### Method for passing a classpath value to a java command line
- ### MANIFEST via empty jar file with manifest that contains Class-Path attribute
- ### COMMAND_FILE via @command_file
- ### LIST via flat args
- macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
- SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
- }
- # tag:java-specific
- IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
- JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
- # tag:java-specific
- ### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
- ### Validate contrib/java dependencies
- ### Valid arguments
- ### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
- ### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
- ### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
- ### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
- ### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
- macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
- SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
- }
- # tag:java-specific
- # TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
- JAVA_FORBIDDEN_LIBRARIES_VALUE=
- # tag:java-specific
- JAR_INCLUDE_FILTER_VALUE=
- JAR_EXCLUDE_FILTER_VALUE=
- # tag:java-specific
- ### @usage:JAR_INCLUDE(Filters...)
- ### Filter .jar file content: keep only matched files
- ### * and ** patterns are supported (like JAVA_SRCS)
- macro JAR_INCLUDE(Filters...) {
- SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
- }
- # tag:java-specific
- ### @usage:JAR_EXCLUDE(Filters...)
- ### Filter .jar file content: remove matched files
- ### * and ** patterns are supported (like JAVA_SRCS)
- macro JAR_EXCLUDE(Filters...) {
- SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
- }
- # tag:java-specific
- _COMPILE_JSRC=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_jsrc.py"} --input $AUTO_INPUT --output $TARGET --prefix $BINDIR ${kv;hide:"p JC"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
- # tag:java-specific
- COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
- # tag:java-specific tag:internal
- ### @usage: JSRC_LIBRARY() # internal
- module JSRC_LIBRARY: _BARE_UNIT {
- .CMD=COMPILE_JSRC_MF
- .EXTS=.java
- .PEERDIR_POLICY=as_include
- .FINAL_TARGET=no
- .ALIASES=SRCS=FILES
- PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
- MODULE_TYPE=LIBRARY
- SET(MODULE_SUFFIX .jsrc)
- SET(DONT_RESOLVE_INCLUDES yes)
- SET(NEED_PLATFORM_PEERDIRS no)
- SET(MODULE_LANG JAVA)
- NO_RUNTIME()
- }
- # tag:java-specific
- when ($JDK_REAL_VERSION == "10") {
- JDK10=yes # remove this later
- }
- JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
- when ($JDK_REAL_VERSION == "8") {
- JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
- }
- # tag:kotlin-specific
- KOTLIN_JVM_TARGET=
- when ($JDK_REAL_VERSION == "8") {
- KOTLIN_JVM_TARGET=1.8
- }
- elsewhen ($JDK_REAL_VERSION == "20") {
- # remove when kotlin starts supporting jdk20 bytecode
- # see also devtools/ya/jbuild/gen/actions/idea.py
- KOTLIN_JVM_TARGET=19
- }
- otherwise {
- KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
- }
- # tag:java-specific
- ### @usage: JDK_VERSION(Version)
- ###
- ### Specify JDK version for module
- macro JDK_VERSION(Arg) {
- .SEM=required_jdk $Arg ${output;hide:"JdkVersionFakeProp.java"}
- SET(JDK_REAL_VERSION $Arg)
- _JDK_VERSION_MACRO_CHECK($Arg)
- }
- # tag:java-specific
- # local jdk and tools
- USE_SYSTEM_JDK=
- USE_SYSTEM_UBERJAR=
- USE_SYSTEM_ERROR_PRONE=
|