1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068 |
- 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 FEATURE_VERSION
- .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)
- when ($OPENSOURCE == "yes" && $AUTOCHECK == "yes") {
- # FIXME: Replace AUTOCHECK == yes with _not a host platform_ check after YMAKE-218
- MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
- MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION REQUIRE_MODIFICATIONS_DISCLOSURE
- when ($MAKE_UBERJAR_VALUE == "yes") {
- # At the time LICENCE_RESTRICTION does not properly distinct static / dynamic linkage in UBERJAR() modules.
- # Hence we forbid using UBERJAR() in OPENSOURCE()
- #
- # Should be fixed in YMAKE-1043
- _OK = no
- }
- }
- when ($OS_IOS == "yes" || $OS_ANDROID == "yes" || $MAPSMOBI_BUILD_TARGET == "yes") {
- MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
- MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION
- }
- ASSERT(_OK "UBERJAR() macro can not be used in this configuration, see YMAKE-1043")
- }
- }
- ### Usage JUNIT_TESTS_JAR(path/to/some/peer realname.jar)
- ###
- ### Specifies jar to search test suites and test cases. By default tests are
- ### searched in the jar compild by JTEST or JUNIT5 module sources. This macro
- ### allows to specify diferent jar to search tests.
- ###
- ### Only one jar file is used to search tests. If this macro invoked multiple
- ### times (which is not reccomended practice) only the last invocation will
- ### have effect.
- ###
- ### If this macro is used no test from the module build by current ya.make
- ### will be searched and executed.
- macro JUNIT_TESTS_JAR(Dir, Jar) {
- SET(UNITTEST_DIR $Dir)
- PEERDIR($Dir)
- SET(UNITTEST_MOD $Dir/$Jar)
- }
- 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 PROVIDES FEATURE_VERSION
- .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
- .IGNORED=JUNIT_TESTS_JAR
- PEERDIR+=devtools/junit5-runner
- PEERDIR+=build/platform/java/jacoco-agent
- when ($OPENSOURCE != "yes") {
- PEERDIR+=devtools/jtest-annotations/junit5
- }
- SET(MODULE_TYPE JUNIT5)
- when ($OPENSOURCE == "yes" && $AUTOCHECK == "yes") {
- # FIXME: Replace AUTOCHECK == yes with _not a host platform_ check after YMAKE-218
- MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
- MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION REQUIRE_MODIFICATIONS_DISCLOSURE
- when ($MAKE_UBERJAR_VALUE == "yes") {
- # At the time LICENCE_RESTRICTION does not properly distinct static / dynamic linkage in UBERJAR() modules.
- # Hence we forbid using UBERJAR() in OPENSOURCE()
- #
- # Should be fixed in YMAKE-1043
- _OK = no
- }
- }
- ASSERT(_OK "UBERJAR() macro can not be used in this condfiguration, see YMAKE-1043")
- }
- }
- 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 PROVIDES FEATURE_VERSION
- .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.10.1 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
- .IGNORED=JUNIT_TESTS_JAR
- 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
- }
- when ($OPENSOURCE == "yes" && $AUTOCHECK == "yes") {
- # FIXME: Replace AUTOCHECK == yes with _not a host platform_ check after YMAKE-218
- MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
- MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION REQUIRE_MODIFICATIONS_DISCLOSURE
- when ($MAKE_UBERJAR_VALUE == "yes") {
- # At the time LICENCE_RESTRICTION does not properly distinct static / dynamic linkage in UBERJAR() modules.
- # Hence we forbid using UBERJAR() in OPENSOURCE()
- #
- # Should be fixed in YMAKE-1043
- _OK = no
- }
- }
- ASSERT(_OK "UBERJAR() macro can not be used in this configuration, see YMAKE-1043")
- }
- }
- 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 PROVIDES FEATURE_VERSION
- .ALIASES=JAVA_TEST_PEERDIR=PEERDIR JAVA_TEST_EXCLUDE=EXCLUDE
- .RESTRICTED=JUNIT_TESTS_JAR
- .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
- .RESTRICTED=JUNIT_TESTS_JAR
- 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
- 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_GROUP_ID:${MODULE_PREFIX}${REALPRJNAME}:${MAVEN_EXPORT_VERSION}:
- }
- PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL PACKAGE_UNION
- HAS_MANAGEABLE_PEERS=yes
- DYNAMIC_LINK=yes
- _PROTO_CMDLINE=$_JAVA_PROTO_CMDLINE
- _EVLOG_CMDLINE=$_JAVA_EVLOG_CMDLINE
- _FBS_CMDLINE=$_JAVA_FLATC_CMDLINE
- 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 _JAVA_SRCS(RESOURCES?"yes":"no", SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], SKIP_CHECK_SRCDIR?"SKIP_CHECK_SRCDIR":"", Globs...) {
- _CHECK_JAVA_SRCDIR($SKIP_CHECK_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)
- }
- # tag:java-specific
- # Fill semantic jar_source_set by JAVA_SRCS() Args
- SEM_JAR_SOURCE_SET=
- macro _SEM_JAR_SOURCE_SET(SRCDIR=".", PACKAGE_PREFIX="", EXCLUDE[], FILES[], RESOURCES?"RESOURCES":"", SKIP_CHECK_SRCDIR?"SKIP_CHECK_SRCDIR":"", Globs...) {
- # Now ignore SKIP_CHECK_SRCDIR, PACKAGE_PREFIX, EXCLUDE, RESOURCES, FILES
- SET_APPEND(SEM_JAR_SOURCE_SET && jar_source_set ${pre=${SRCDIR}\::Globs})
- }
- ### Fill JAVA_SRCS to value for ya ide idea and real apply for late globs
- macro FULL_JAVA_SRCS(Args...) {
- _IDEA_JAVA_SRCS_VALUE($Args)
- _JAVA_SRCS($Args)
- }
- # tag:java-specific
- ### @usage: DEFAULT_JAVA_SRCS_LAYOUT()
- ###
- ### DEFAULT_JAVA_SRCS_LAYOUT() declare all source files can be find at maven/gradle standard path src/main/java **/*.java
- ### and all resources an be find at maven/gradle standard path src/main/resources **/*
- macro DEFAULT_JAVA_SRCS_LAYOUT() {
- # Maven default source paths, supported by gradle too
- # JAVA_SRCS may be alias of FULL_JAVA_SRCS
- FULL_JAVA_SRCS(SRCDIR src/main/java **/*.java SKIP_CHECK_SRCDIR)
- FULL_JAVA_SRCS(RESOURCES SRCDIR src/main/resources **/* SKIP_CHECK_SRCDIR)
- }
- # tag:java-specific
- ### @usage: DEFAULT_JUNIT_JAVA_SRCS_LAYOUT()
- ###
- ### DEFAULT_JUNIT_JAVA_SRCS_LAYOUT() declare all test source files can be find at maven/gradle standard path src/test/java **/*.java
- ### and all resources can be find at maven/gradle standard path src/test/resources **/*
- macro DEFAULT_JUNIT_JAVA_SRCS_LAYOUT() {
- # Maven default test source paths, supported by gradle too
- # JAVA_SRCS may be alias of FULL_JAVA_SRCS
- FULL_JAVA_SRCS(SRCDIR java **/*.java SKIP_CHECK_SRCDIR)
- FULL_JAVA_SRCS(RESOURCES SRCDIR resources **/* SKIP_CHECK_SRCDIR)
- }
- 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
- # Fill semantic by RUN_JAVA_PROGRAM()
- _SEM_RUN_JAVA_PROGRAM= \
- && runs-ITEM \
- && runs-args ${Args} \
- && runs-classpath ${RUN_JAR_PROG_CP_PRE}${tool:CLASSPATH}${RUN_JAR_PROG_CP_SUF} \
- && runs-cwd ${cwd:CWD} \
- && runs-in ${IN} \
- && runs-in_dir ${IN_DIR} \
- && runs-in_dirs_inputs ${IN_DIRS_INPUTS} \
- && runs-in_noparse ${IN_NOPARSE} \
- && runs-out ${OUT} \
- && runs-out_dir ${OUT_DIR} \
- && runs-tool ${TOOL}
- 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}
- .SEM=_SEM_RUN_JAVA_PROGRAM
- }
- # 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
- PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL DLL JAR_COMPILATION __EMPTY__ RESOURCE_LIB
- HAS_MANAGEABLE_PEERS=yes
- DYNAMIC_LINK=yes
- _PROTO_CMDLINE=$_JAVA_PROTO_CMDLINE
- _EVLOG_CMDLINE=$_JAVA_EVLOG_CMDLINE
- _FBS_CMDLINE=$_JAVA_FLATC_CMDLINE
- 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
- _DONT_REQUIRE_LICENSE()
- }
- # 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= \
- ${hide:TARGET} ${hide:AUTO_INPUT} \
- consumer-classpath $EXPORT_GRADLE_CLASSPATH \
- && consumer-jar ${MODDIR}/${REALPRJNAME}.jar \
- && consumer-type contrib \
- && 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
- 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
- }
- # 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 = 23.5.26
- _KOTLIN_ALLOWED_VERSIONS = contrib/java/org/jetbrains/kotlin/kotlin-allopen/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-allopen-compiler-plugin/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-annotation-processing/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-compiler/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-compiler-embeddable/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-daemon-client/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-daemon-embeddable/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-gradle-plugin-api/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-gradle-plugin-model/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-lombok-compiler-plugin/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-main-kts/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-maven-allopen/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-maven-lombok/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-maven-noarg/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-maven-serialization/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-noarg-compiler-plugin/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-osgi-bundle/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-reflect/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-scripting-common/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-scripting-compiler-embeddable/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-scripting-compiler-impl-embeddable/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-scripting-ide-services/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-scripting-jsr223/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm-host/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-script-runtime/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-script-util/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-serialization-compiler-plugin/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-stdlib/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-stdlib-common/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk7/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-stdlib-js/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-test/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-test-annotations-common/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-test-common/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-test-js/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-test-junit/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-test-junit5/${KOTLIN_VERSION} \
- contrib/java/org/jetbrains/kotlin/kotlin-test-testng/${KOTLIN_VERSION}
- # tag:java-specific
- module _COMPILABLE_JAR_BASE : _JAR_BASE {
- _GHOST_PEERDIR($_FORCED_DEPENDENCY_MANAGEMENT_VALUE)
- # 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})
- # protobuf-kotlin
- DEPENDENCY_MANAGEMENT(contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/com/google/protobuf/protobuf-kotlin EXCEPT contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION})
- # kotlin
- DEPENDENCY_MANAGEMENT($_KOTLIN_ALLOWED_VERSIONS)
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk7 EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk7/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8 EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib-jdk8/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib-js EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib-js/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-stdlib-common EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-stdlib-common/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-reflect EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-reflect/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-osgi-bundle EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-osgi-bundle/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-junit EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-junit/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-junit5 EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-junit5/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-testng EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-testng/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-js EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-js/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-common EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-common/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-test-annotations-common EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-test-annotations-common/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-main-kts EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-main-kts/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-script-runtime EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-script-runtime/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-script-util EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-script-util/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-common EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-common/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-jsr223 EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-jsr223/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm-host EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-jvm-host/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-scripting-ide-services EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-scripting-ide-services/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-compiler EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-compiler/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-compiler-embeddable EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-compiler-embeddable/${KOTLIN_VERSION})
- CHECK_DEPENDENT_DIRS(DENY PEERDIRS contrib/java/org/jetbrains/kotlin/kotlin-daemon-client EXCEPT contrib/java/org/jetbrains/kotlin/kotlin-daemon-client/${KOTLIN_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 \
- && publish_group $MAVEN_EXPORT_GROUP_ID \
- && publish_version $PUBLISH_MAVEN_VERSION
- BUILD_JAR_SEM= \
- ${hide:TARGET} ${hide:AUTO_INPUT} ${hide:APPLIED_EXCLUDES} \
- jar $MODDIR $REALPRJNAME \
- && consumer-classpath $EXPORT_GRADLE_CLASSPATH \
- && consumer-jar ${MODDIR}/${REALPRJNAME}.jar \
- && consumer-type library \
- $_KOTLIN_SEM \
- $_JAR_MAIN_SEM \
- $_GRADLE_EXPORT_PUBLISHING_SEM \
- $SEM_JAR_SOURCE_SET
- BUILD_PROTO_JAR_SEM= \
- ${hide:target} ${hide:AUTO_INPUT} \
- jar_proto $MODDIR $REALPRJNAME \
- $_JAVA_PROTO_SEM \
- && consumer-classpath $EXPORT_GRADLE_CLASSPATH \
- && consumer-jar ${MODDIR}/${REALPRJNAME}.jar \
- && consumer-type library \
- $_KOTLIN_SEM
- # 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=FULL_JAVA_SRCS ANNOTATION_PROCESSOR=JAR_ANNOTATION_PROCESSOR
- .RESTRICTED=EXTERNAL_JAR
- .GLOBAL=MAVEN_EXPORT_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.9.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_GROUP_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 == "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 && $JDK_REAL_VERSION == "21") {
- 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
- .PEERDIR_POLICY=as_build_from
- 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 ($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
- 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 == "21") {
- JDK_REAL_VERSION=21
- }
- elsewhen ($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 == "15") {
- JDK_REAL_VERSION=15
- }
- elsewhen ($JDK_VERSION == "11") {
- JDK_REAL_VERSION=11
- }
- 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 == "21") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk21 build/platform/java/jdk/jdk17
- }
- 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 == "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 == "8") {
- JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
- }
- }
- # tag:java-specific
- when ($JDK_REAL_VERSION == "21") {
- UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar21
- }
- 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 == "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 == "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 == "21") {
- JDK_RESOURCE=$JDK21_RESOURCE_GLOBAL
- }
- 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 == "15") {
- JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "11") {
- JDK_RESOURCE=$JDK11_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") {
- 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") {
- 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
- }
- elsewhen ($JDK_REAL_VERSION == "21") {
- 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 == "21") {
- UBERJAR_RESOURCE=$UBERJAR21_RESOURCE_GLOBAL
- }
- 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 == "15") {
- UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "11") {
- UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "8") {
- UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
- }
- }
- # tag:java-specific
- when ($JDK_REAL_VERSION == "21") {
- WITH_JDK_RESOURCE=$WITH_JDK21_RESOURCE_GLOBAL
- }
- 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 == "15") {
- WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
- }
- when ($JDK_REAL_VERSION == "11") {
- WITH_JDK_RESOURCE=$WITH_JDK11_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, Values...) {
- SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Values)
- SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:'${Values}')
- }
- # 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_GROUP_ID=ru.yandex
- ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
- ###
- ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
- ### Have no effect on regular build.
- macro MAVEN_GROUP_ID(Arg, VERSION="no") {
- SET(MAVEN_GROUP_ID_VALUE $Arg)
- SET(MAVEN_EXPORT_GROUP_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)
- ###
- ### 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=
- ### Fill JAVA_SRCS_VALUE for ya ide idea, skip SKIP_CHECK_SRCDIR option
- macro _IDEA_JAVA_SRCS_VALUE(RESOURCES?"RESOURCES":"", SKIP_CHECK_SRCDIR?"SKIP_CHECK_SRCDIR":"", Args...) {
- # RESOURCES must be at first position, else ya ide idea will fault
- SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $RESOURCES $Args)
- }
- ### @usage: JAVA_SRCS(srcs)
- ###
- ### Specify java source files and resources. A macro can be contained in any of four java modules.
- ### Keywords:
- ### 1. SRCDIR x - 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...) {
- # TODO Use FULL_JAVA_SRCS
- _IDEA_JAVA_SRCS_VALUE($Args)
- # Fill semantic for non-standard sources/resources
- _SEM_JAR_SOURCE_SET($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() {
- when ($REALPRJNAME == "jdk") {
- _OK=no
- }
- otherwise {
- _PACK_JDK= && ${YMAKE_PYTHON} ${input:"build/scripts/tar_directory.py"} ${output;tared:"jdk.tar"} $WITH_JDK_RESOURCE $WITH_JDK_RESOURCE
- WITH_JDK_VALUE=yes
- }
- ASSERT(_OK [[alt1]]jdk[[rst]] name is prohibited for [[imp]]JAVA_PROGRAM[[rst]] module when [[imp]]WITH_JDK[[rst]] is used, [[imp]]WITH_JDK[[rst]] will be ignored.)
- }
- # 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.9.20
- KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.9.20/ya.dependency_management.inc
- GROOVY_VERSION=3.0.5
- _KOTLIN_SEM= \
- && kotlin_version ${KOTLIN_VERSION} \
- && with_kotlin ${WITH_KOTLIN_VALUE} \
- && with_kotlinc_plugin_allopen ${WITH_KOTLINC_PLUGIN_ALLOPEN} \
- && with_kotlinc_plugin_lombok ${WITH_KOTLINC_PLUGIN_LOMBOK} \
- && with_kotlinc_plugin_noarg ${WITH_KOTLINC_PLUGIN_NOARG} \
- && with_kotlinc_plugin_serialization ${WITH_KOTLINC_PLUGIN_SERIALIZATION}
- _JAVA_PROTO_GRPC_SEM=
- when ($_GRPC_ENABLED == "yes") {
- _JAVA_PROTO_GRPC_SEM= && proto_grpc && proto_grpc_version ${JAVA_GRPC_VERSION}
- }
- _JAVA_PROTO_NAMESPACE_SEM=
- when ($PROTO_NAMESPACE != "") {
- _JAVA_PROTO_NAMESPACE_SEM= && proto_namespace $PROTO_NAMESPACE
- }
- _JAVA_PROTO_SEM= \
- ${_JAVA_PROTO_NAMESPACE_SEM} \
- && proto_compiler_version ${JAVA_PROTO_COMPILER_VERSION} \
- && proto_runtime_version ${JAVA_PROTO_RUNTIME_VERSION} \
- && proto_common_version ${JAVA_PROTO_COMMON_VERSION} \
- ${_JAVA_PROTO_GRPC_SEM}
- # tag:java-specific
- DIRECT_DEPS_ONLY_VALUE=
- ### @usage: DIRECT_DEPS_ONLY
- ###
- ### 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
- 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 == "22") {
- # remove when kotlin starts supporting jdk21 bytecode
- # see also devtools/ya/jbuild/gen/actions/idea.py
- KOTLIN_JVM_TARGET=21
- }
- 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
- ### @usage: DEFAULT_JDK_VERSION(Version)
- ###
- ### Specify JDK version for module, can be overridden by setting the JDK_VERSION variable
- macro DEFAULT_JDK_VERSION(Arg) {
- _SET_FIRST_VALUE(_JDK_VERSION $JDK_VERSION $Arg)
- JDK_VERSION($_JDK_VERSION)
- }
- # tag:java-specific
- # local jdk and tools
- USE_SYSTEM_JDK=
- USE_SYSTEM_UBERJAR=
- USE_SYSTEM_ERROR_PRONE=
- # tag:kotlin-specific
- _USE_KTLINT_OLD=no
- # tag:kotlin-specific
- ### @usage: USE_KTLINT_OLD()
- ### Marks that need use the old version of ktlint
- macro USE_KTLINT_OLD() {
- ENABLE(_USE_KTLINT_OLD)
- }
- # tag:kotlin-specific
- _KTLINT_BASELINE_FILE=
- # tag:kotlin-specific
- ### @usage: #deprecated KTLINT_BASELINE_FILE(ktlint-baseline.xml "https://st.yandex-team.ru/REMOVE-BASELINE-1")
- ### Path to baseline file for ktlint test and ticket to fix all ktlint warnings in file and then remove it
- macro KTLINT_BASELINE_FILE(File, Ticket) {
- SET(_KTLINT_BASELINE_FILE $File)
- }
|