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

[internal] add JvmToolBase for lockfile handling for JVM tools #13777

Merged
merged 7 commits into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/python/pants/backend/experimental/java/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pants.jvm import util_rules as jvm_util_rules
from pants.jvm.dependency_inference import symbol_mapper
from pants.jvm.goals import coursier
from pants.jvm.resolve import coursier_fetch, coursier_setup
from pants.jvm.resolve import coursier_fetch, coursier_setup, jvm_tool
from pants.jvm.target_types import JvmArtifact, JvmDependencyLockfile


Expand Down Expand Up @@ -53,4 +53,5 @@ def rules():
*jvm_util_rules.rules(),
*jdk_rules.rules(),
*target_types_rules(),
*jvm_tool.rules(),
]
3 changes: 2 additions & 1 deletion src/python/pants/backend/experimental/scala/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pants.jvm import classpath, jdk_rules
from pants.jvm import util_rules as jvm_util_rules
from pants.jvm.goals import coursier
from pants.jvm.resolve import coursier_fetch, coursier_setup
from pants.jvm.resolve import coursier_fetch, coursier_setup, jvm_tool
from pants.jvm.target_types import JvmArtifact, JvmDependencyLockfile


Expand Down Expand Up @@ -55,4 +55,5 @@ def rules():
*jdk_rules.rules(),
*dep_inf_rules.rules(),
*target_types_rules(),
*jvm_tool.rules(),
]
16 changes: 13 additions & 3 deletions src/python/pants/backend/java/subsystems/junit.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from pants.jvm.resolve.jvm_tool import JvmToolBase
from pants.option.custom_types import shell_str
from pants.option.subsystem import Subsystem
from pants.util.docutil import git_url


class JUnit(Subsystem):
class JUnit(JvmToolBase):
options_scope = "junit"
help = "The JUnit test framework (https://junit.org)"

default_version = "5.7.2"
default_artifacts = [
"org.junit.platform:junit-platform-console:1.7.2",
"org.junit.jupiter:junit-jupiter-engine:{version}",
"org.junit.vintage:junit-vintage-engine:{version}",
]
default_lockfile_resource = ("pants.backend.java.test", "junit.default.lockfile.txt")
default_lockfile_path = "src/python/pants/backend/java/test/junit.default.lockfile.txt"
default_lockfile_url = git_url(default_lockfile_path)

@classmethod
def register_options(cls, register):
super().register_options(register)
Expand Down
4 changes: 3 additions & 1 deletion src/python/pants/backend/java/test/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_sources()
python_sources(dependencies=[":lockfiles"])
python_tests(name="tests", timeout=240)

resources(name="lockfiles", sources=["*.lockfile.txt"])
Loading