summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsvidyuk <[email protected]>2025-01-29 07:18:43 +0300
committersvidyuk <[email protected]>2025-01-29 07:36:34 +0300
commit113dd3cb3952d8d3b5fdec92013800f2a05e242c (patch)
tree52fd52d45782c8b32059166dd15b0553b128b7fd
parentf562d654c2fe8cfc407e8a6e596474c3975a2204 (diff)
Migrate DLL_JAVA to JAR_LIBRARY module
commit_hash:748b6900bfb14824d834071a0ab51d873960eae6
-rw-r--r--build/conf/java.conf3
-rw-r--r--build/conf/swig.conf2
-rw-r--r--build/scripts/prepare_jar_build.py25
-rw-r--r--build/scripts/resolve_java_srcs.py4
4 files changed, 30 insertions, 4 deletions
diff --git a/build/conf/java.conf b/build/conf/java.conf
index bfcb263fe26..acee912cfe7 100644
--- a/build/conf/java.conf
+++ b/build/conf/java.conf
@@ -841,7 +841,8 @@ PREPARE_JAR_BUILD=${cwd:BINDIR} ${YMAKE_PYTHON3} ${input:"build/scripts/prepare_
--bindir ${BINDIR} --moddir ${CURDIR} \
--java ${BINDIR}/all-java.srclst ${KT_SRSCLIST} ${JAVA_COVERAGE_SRCLIST} \
--ya-start-command-file \
- ${ext=.gentar:AUTO_INPUT} ${ALL_JAR_SOURCES} ${ext=.java:AUTO_INPUT} ${ext=.kt:AUTO_INPUT} \
+ ${ext=.jsrc:AUTO_INPUT} ${ext=.gentar:AUTO_INPUT} \
+ ${ALL_JAR_SOURCES} ${ext=.java:AUTO_INPUT} ${ext=.kt:AUTO_INPUT} \
$JAR_GEN_SRCS $JAR_GEN_JSRCS \
--ya-end-command-file \
${hide;input:"build/scripts/process_command_files.py"} \
diff --git a/build/conf/swig.conf b/build/conf/swig.conf
index 6c3061e3081..ab33d887981 100644
--- a/build/conf/swig.conf
+++ b/build/conf/swig.conf
@@ -85,7 +85,7 @@ multimodule DLL_JAVA {
.SEM=_SWIG_JNI_BINDINGS_SEM
SWIG_LANG=jni_cpp
}
- module JAR_COMPILATION: EXTERNAL_JAVA_LIBRARY {
+ module JAR_COMPILATION: JAR_LIBRARY {
.ARGS_PARSER=DLL
.ALIASES=SRCS=_JNI_JAVA_SWIG_SRCS PEERDIR=_NOOP_MACRO
.PEERDIRSELF=JNI_DLL
diff --git a/build/scripts/prepare_jar_build.py b/build/scripts/prepare_jar_build.py
index 7c7a47fab18..f2db5544d6a 100644
--- a/build/scripts/prepare_jar_build.py
+++ b/build/scripts/prepare_jar_build.py
@@ -1,5 +1,6 @@
import os
import sys
+import shutil
import argparse
# Explicitly enable local imports
@@ -154,10 +155,15 @@ def main():
with_kotlin=True if args.kotlin else False,
with_coverage=True if args.coverage else False)
+ jsrcs_dir = None
for src in src_sorter.sort_args(remaining_args):
if src.endswith(".gentar"):
unpack_dir(src, os.path.dirname(src))
continue
+ if src.endswith(".jsrc"):
+ jsrcs_dir = os.path.join(args.bindir, 'jsrcs')
+ unpack_dir(src, jsrcs_dir)
+ continue
src_consumer.consume(src, src_sorter)
@@ -173,6 +179,25 @@ def main():
for rargs in resolve_args:
resolve.cli_main(rargs, force_skip_source_jars=not args.with_sources_jar)
+ if jsrcs_dir is not None:
+ resolve.resolve_sources_and_fill_filelists(
+ directory=jsrcs_dir,
+ sources_file=args.java,
+ resources_file=os.path.join(args.bindir, 'default.res.txt'),
+ kotlin_sources_file=args.kotlin if args.kotlin else None,
+ include_patterns=['**/*'],
+ exclude_patterns=[],
+ resolve_kotlin=True if args.kotlin else False,
+ append=True,
+ all_resources=False,
+ )
+ if args.with_sources_jar:
+ # TODO ugly hack here. Once jar directory preparation will be handled in a single script
+ # sources copying should use common API here as well. Current "common API" is to populate
+ # file with files to be copied by another script. It can't be uses here since there is no
+ # way to send filelist to that external script from current point in code
+ shutil.copytree(jsrcs_dir, os.path.join(args.bindir, 'src'), dirs_exist_ok=True)
+
return 0
diff --git a/build/scripts/resolve_java_srcs.py b/build/scripts/resolve_java_srcs.py
index 4cce49136f3..3127886e3c0 100644
--- a/build/scripts/resolve_java_srcs.py
+++ b/build/scripts/resolve_java_srcs.py
@@ -80,7 +80,7 @@ def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources,
return sorted(result['java']), sorted(result['not_java']), sorted(result['kotlin'])
-def do_it(
+def resolve_sources_and_fill_filelists(
directory,
sources_file,
resources_file,
@@ -115,7 +115,7 @@ def cli_main(argv, force_skip_source_jars=False):
if force_skip_source_jars and args.all_resources:
return
- do_it(**vars(args))
+ resolve_sources_and_fill_filelists(**vars(args))
if __name__ == '__main__':