diff options
| author | iniklyaev <[email protected]> | 2026-05-26 01:06:23 +0300 |
|---|---|---|
| committer | iniklyaev <[email protected]> | 2026-05-26 01:44:00 +0300 |
| commit | b24e4a4105f85b5bbeff7eed04607ae562edad06 (patch) | |
| tree | d6311c3b25c6db9c45568a3aa0aeda1acbb95b34 /build/scripts | |
| parent | ad3c7a94d64009852dd9ed883f4e002692137c6f (diff) | |
remap -Xfriend-paths to interface jar when ijar is active
When ijar compilation is active, the classpath contains X-interface.jar
instead of X.jar. Kotlin only grants 'internal' visibility access via
-Xfriend-paths when the specified path matches a classpath entry.
Fix: in run_javac.py, for Kotlin compilations, rewrite any
-Xfriend-paths=X.jar argument to -Xfriend-paths=X-interface.jar when
X-interface.jar exists on disk. This restores access to 'internal'
members for test modules that use -Xfriend-paths without requiring
changes to user ya.make files.
commit_hash:a11a6acd8994258a32090a71de9a55d5aeccc5dd
Diffstat (limited to 'build/scripts')
| -rw-r--r-- | build/scripts/run_javac.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/build/scripts/run_javac.py b/build/scripts/run_javac.py index a640d590889..79a82a1f704 100644 --- a/build/scripts/run_javac.py +++ b/build/scripts/run_javac.py @@ -65,6 +65,25 @@ def main(): if opts.kotlin: input_files = [i for i in input_files if i.endswith('.kt')] + # When ijar is active, compilation classpaths contain X-interface.jar instead of X.jar. + # Rewrite -Xfriend-paths=X.jar -> -Xfriend-paths=X-interface.jar when the interface + # jar exists, so that Kotlin grants 'internal' access from the correct classpath entry. + + def _remap_friend_paths(arg): + prefix = '-Xfriend-paths=' + if not arg.startswith(prefix): + return arg + parts = re.split(r'([:,])', arg[len(prefix) :]) + remapped = [] + for p in parts: + if p.endswith('.jar') and not p.endswith('-interface.jar'): + ijar_path = p[: -len('.jar')] + '-interface.jar' + if os.path.exists(ijar_path): + p = ijar_path + remapped.append(p) + return prefix + ''.join(remapped) + + cmd = [_remap_friend_paths(a) for a in cmd] if not input_files: if opts.verbose: |
