Skip to content

Commit

Permalink
Attempt to fix python/java codegen interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
jlclx committed May 23, 2023
1 parent 4e9c824 commit d67078b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/python/pants/jvm/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from enum import Enum, auto
from typing import ClassVar, Iterable, Iterator, Sequence

from pants.backend.python.target_types import PythonRequirementDependenciesField
from pants.core.target_types import (
FilesGeneratingSourcesField,
FileSourceField,
Expand Down Expand Up @@ -432,12 +433,17 @@ def ignore_because_file(coarsened_dep: CoarsenedTarget) -> bool:
or t.has_field(RelocatedFilesOriginalTargetsField)
) == len(coarsened_dep.members)

def ignore_because_python_requirement(coarsened_dep: CoarsenedTarget) -> bool:
# Filter out python_requirements from the classpath as javac cannot handle them.
return any(t.has_field(PythonRequirementDependenciesField) for t in coarsened_dep.members)

return ClasspathEntryRequests(
classpath_entry_request.for_targets(
component=coarsened_dep, resolve=request.request.resolve
)
for coarsened_dep in request.request.component.dependencies
if not ignore_because_generated(coarsened_dep) and not ignore_because_file(coarsened_dep)
and not ignore_because_python_requirement(coarsened_dep)
)


Expand Down

0 comments on commit d67078b

Please sign in to comment.