Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds jvm_jdk field to protobufs when the Scala backend is enabled #14891

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/python/pants/backend/codegen/protobuf/scala/rules.py
Expand Up @@ -11,6 +11,8 @@
from pants.backend.codegen.protobuf.target_types import (
ProtobufDependenciesField,
ProtobufSourceField,
ProtobufSourcesGeneratorTarget,
ProtobufSourceTarget,
)
from pants.backend.scala.target_types import ScalaSourceField
from pants.core.goals.generate_lockfiles import GenerateToolLockfileSentinel
Expand Down Expand Up @@ -49,6 +51,7 @@
from pants.jvm.resolve.common import ArtifactRequirements, Coordinate, GatherJvmCoordinatesRequest
from pants.jvm.resolve.coursier_fetch import ToolClasspath, ToolClasspathRequest
from pants.jvm.resolve.jvm_tool import GenerateJvmLockfileFromTool
from pants.jvm.target_types import JvmJdkField
from pants.source.source_root import SourceRoot, SourceRootRequest
from pants.util.logging import LogLevel
from pants.util.ordered_set import FrozenOrderedSet
Expand Down Expand Up @@ -333,10 +336,16 @@ def generate_scalapbc_lockfile_request(
return GenerateJvmLockfileFromTool.create(tool)


class PrefixedJvmJdkField(JvmJdkField):
alias = "jvm_jdk"


def rules():
return [
*collect_rules(),
*lockfile.rules(),
UnionRule(GenerateSourcesRequest, GenerateScalaFromProtobufRequest),
UnionRule(GenerateToolLockfileSentinel, ScalapbcToolLockfileSentinel),
ProtobufSourceTarget.register_plugin_field(PrefixedJvmJdkField),
ProtobufSourcesGeneratorTarget.register_plugin_field(PrefixedJvmJdkField),
]