Skip to content

[SPARK-56364][BUILD][TESTS][FOLLOWUP] Expand pathing JARs in createJarWithScalaSources#55564

Closed
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:SPARK-56364-followup
Closed

[SPARK-56364][BUILD][TESTS][FOLLOWUP] Expand pathing JARs in createJarWithScalaSources#55564
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:SPARK-56364-followup

Conversation

@cloud-fan
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Followup to #55218.

When createJarWithScalaSources (introduced in #55218) is invoked in a process whose java.class.path is a single "pathing JAR" — a JAR with no class entries whose manifest Class-Path attribute lists the real dependencies — scala.tools.nsc.Main does not resolve the manifest entries. The compiler therefore cannot see scala-library.jar, and compilation fails with object scala in compiler mirror not found.

This PR adds an expandManifestClasspath helper that detects such JARs and resolves their manifest Class-Path entries (relative to the JAR's parent directory) before passing the classpath to scalac.

Why are the changes needed?

Pathing JARs are commonly emitted to work around platform-specific command-line length limits — most notably on Windows, where CMD's command-line limit forces tools to produce a single classpath JAR rather than a long -cp string. Some build/CI tooling does the same. Without this fix, createJarWithScalaSources is silently broken in those environments, even though a regular file-listing classpath continues to work.

Does this PR introduce any user-facing change?

No. Only test-utility code is affected.

How was this patch tested?

Verified that createJarWithScalaSources still succeeds with a normal classpath, and now also succeeds when invoked with a classpath consisting of a single pathing JAR whose manifest Class-Path lists the real dependencies. The expansion is a no-op for non-JAR URLs and for JARs that have no manifest Class-Path attribute, so the existing OSS test paths are unaffected.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7

…rWithScalaSources

Followup to apache#55218.

When createJarWithScalaSources is invoked in a process whose java.class.path
is a single 'pathing JAR' (a JAR with no class entries whose manifest
Class-Path attribute lists the real dependencies), scala.tools.nsc.Main does
not resolve the manifest entries and the compiler cannot see scala-library.jar,
failing with 'object scala in compiler mirror not found'. Pathing JARs are
emitted to work around platform-specific command-line length limits, most
notably on Windows.

Add an expandManifestClasspath helper that detects such JARs and resolves
their manifest Class-Path entries before passing the classpath to scalac.
@cloud-fan
Copy link
Copy Markdown
Contributor Author

@sarutak @HyukjinKwon

Copy link
Copy Markdown
Member

@sarutak sarutak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for following up!

@cloud-fan
Copy link
Copy Markdown
Contributor Author

thanks for the review, merging to master!

@cloud-fan cloud-fan closed this in 3d36468 Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants