Skip to content

Commit

Permalink
Handle duplicate JAR entries in deploy_jar (#17419)
Browse files Browse the repository at this point in the history
Rescues the jar-tool binary used in Pants v1 to generate JAR files with a duplicate policy
  • Loading branch information
alonsodomin authored Nov 2, 2022
1 parent 8fd8960 commit 4050ad0
Show file tree
Hide file tree
Showing 14 changed files with 688 additions and 559 deletions.
7 changes: 7 additions & 0 deletions src/python/pants/backend/experimental/java/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
from pants.jvm import util_rules as jvm_util_rules
from pants.jvm.dependency_inference import symbol_mapper
from pants.jvm.goals import lockfile
from pants.jvm.jar_tool import jar_tool
from pants.jvm.package import deploy_jar
from pants.jvm.package.war import rules as war_rules
from pants.jvm.resolve import coursier_fetch, jvm_tool
from pants.jvm.strip_jar import strip_jar
from pants.jvm.target_types import DeployJarTarget, JvmArtifactTarget, JvmWarTarget
from pants.jvm.target_types import build_file_aliases as jvm_build_file_aliases
from pants.jvm.test import junit


Expand All @@ -46,6 +48,7 @@ def rules():
*junit.rules(),
*strip_jar.rules(),
*deploy_jar.rules(),
*jar_tool.rules(),
*lockfile.rules(),
*coursier_fetch.rules(),
*java_parser.rules(),
Expand All @@ -62,3 +65,7 @@ def rules():
*java_bsp_rules.rules(),
*archive.rules(),
]


def build_file_aliases():
return jvm_build_file_aliases()
7 changes: 7 additions & 0 deletions src/python/pants/backend/experimental/kotlin/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
from pants.jvm import classpath, jdk_rules, resources, run_deploy_jar
from pants.jvm import util_rules as jvm_util_rules
from pants.jvm.goals import lockfile
from pants.jvm.jar_tool import jar_tool
from pants.jvm.package import deploy_jar, war
from pants.jvm.resolve import coursier_fetch, coursier_setup, jvm_tool
from pants.jvm.strip_jar import strip_jar
from pants.jvm.target_types import DeployJarTarget, JvmArtifactTarget, JvmWarTarget
from pants.jvm.target_types import build_file_aliases as jvm_build_file_aliases
from pants.jvm.test.junit import rules as jvm_junit_rules


Expand Down Expand Up @@ -56,8 +58,13 @@ def rules():
*source_files.rules(),
*strip_jar.rules(),
*deploy_jar.rules(),
*jar_tool.rules(),
*run_deploy_jar.rules(),
*war.rules(),
*jvm_junit_rules(),
*kotlin_junit_rules(),
]


def build_file_aliases():
return jvm_build_file_aliases()
7 changes: 7 additions & 0 deletions src/python/pants/backend/experimental/scala/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
from pants.jvm import classpath, jdk_rules, resources, run_deploy_jar
from pants.jvm import util_rules as jvm_util_rules
from pants.jvm.goals import lockfile
from pants.jvm.jar_tool import jar_tool
from pants.jvm.package import deploy_jar
from pants.jvm.package.war import rules as war_rules
from pants.jvm.resolve import coursier_fetch, coursier_setup, jvm_tool
from pants.jvm.strip_jar import strip_jar
from pants.jvm.target_types import DeployJarTarget, JvmArtifactTarget, JvmWarTarget
from pants.jvm.target_types import build_file_aliases as jvm_build_file_aliases
from pants.jvm.test import junit


Expand Down Expand Up @@ -53,6 +55,7 @@ def rules():
*junit.rules(),
*strip_jar.rules(),
*deploy_jar.rules(),
*jar_tool.rules(),
*lockfile.rules(),
*coursier_fetch.rules(),
*coursier_setup.rules(),
Expand All @@ -67,3 +70,7 @@ def rules():
*bsp_rules(),
*war_rules(),
]


def build_file_aliases():
return jvm_build_file_aliases()
10 changes: 10 additions & 0 deletions src/python/pants/jvm/jar_tool/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_sources(dependencies=[":lockfiles"])

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

python_tests(
name="tests",
)
Empty file.
158 changes: 158 additions & 0 deletions src/python/pants/jvm/jar_tool/jar_tool.default.lockfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# This lockfile was autogenerated by Pants. To regenerate, run:
#
# ./pants generate-lockfiles
#
# --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
# {
# "version": 1,
# "generated_with_requirements": [
# "org.pantsbuild:jar-tool:0.0.17,url=not_provided,jar=not_provided"
# ]
# }
# --- END PANTS LOCKFILE METADATA ---

[[entries]]
directDependencies = []
dependencies = []
file_name = "args4j_args4j_2.33.jar"

[entries.coord]
group = "args4j"
artifact = "args4j"
version = "2.33"
packaging = "jar"
[entries.file_digest]
fingerprint = "91ddeaba0b24adce72291c618c00bbdce1c884755f6c4dba9c5c46e871c69ed6"
serialized_bytes_length = 155379
[[entries]]
directDependencies = []
dependencies = []
file_name = "com.google.code.findbugs_jsr305_3.0.2.jar"

[entries.coord]
group = "com.google.code.findbugs"
artifact = "jsr305"
version = "3.0.2"
packaging = "jar"
[entries.file_digest]
fingerprint = "766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7"
serialized_bytes_length = 19936
[[entries]]
directDependencies = []
dependencies = []
file_name = "com.google.guava_guava_18.0.jar"

[entries.coord]
group = "com.google.guava"
artifact = "guava"
version = "18.0"
packaging = "jar"
[entries.file_digest]
fingerprint = "d664fbfc03d2e5ce9cab2a44fb01f1d0bf9dfebeccc1a473b1f9ea31f79f6f99"
serialized_bytes_length = 2256213
[[entries]]
file_name = "org.pantsbuild_args4j_0.0.21.jar"
[[entries.directDependencies]]
group = "args4j"
artifact = "args4j"
version = "2.33"
packaging = "jar"

[[entries.directDependencies]]
group = "com.google.code.findbugs"
artifact = "jsr305"
version = "3.0.2"
packaging = "jar"

[[entries.directDependencies]]
group = "com.google.guava"
artifact = "guava"
version = "18.0"
packaging = "jar"

[[entries.dependencies]]
group = "args4j"
artifact = "args4j"
version = "2.33"
packaging = "jar"

[[entries.dependencies]]
group = "com.google.code.findbugs"
artifact = "jsr305"
version = "3.0.2"
packaging = "jar"

[[entries.dependencies]]
group = "com.google.guava"
artifact = "guava"
version = "18.0"
packaging = "jar"


[entries.coord]
group = "org.pantsbuild"
artifact = "args4j"
version = "0.0.21"
packaging = "jar"
[entries.file_digest]
fingerprint = "337a765196b5370e54b34d9f586546e82e641b00c2239b947d352f76aaecf852"
serialized_bytes_length = 9769
[[entries]]
file_name = "org.pantsbuild_jar-tool_0.0.17.jar"
[[entries.directDependencies]]
group = "args4j"
artifact = "args4j"
version = "2.33"
packaging = "jar"

[[entries.directDependencies]]
group = "com.google.code.findbugs"
artifact = "jsr305"
version = "3.0.2"
packaging = "jar"

[[entries.directDependencies]]
group = "com.google.guava"
artifact = "guava"
version = "18.0"
packaging = "jar"

[[entries.directDependencies]]
group = "org.pantsbuild"
artifact = "args4j"
version = "0.0.21"
packaging = "jar"

[[entries.dependencies]]
group = "args4j"
artifact = "args4j"
version = "2.33"
packaging = "jar"

[[entries.dependencies]]
group = "com.google.code.findbugs"
artifact = "jsr305"
version = "3.0.2"
packaging = "jar"

[[entries.dependencies]]
group = "com.google.guava"
artifact = "guava"
version = "18.0"
packaging = "jar"

[[entries.dependencies]]
group = "org.pantsbuild"
artifact = "args4j"
version = "0.0.21"
packaging = "jar"


[entries.coord]
group = "org.pantsbuild"
artifact = "jar-tool"
version = "0.0.17"
packaging = "jar"
[entries.file_digest]
fingerprint = "bcaa7150845f7bba4b3146a3e01fcd425992d74d2cf14ff7bf2ad24b79c33320"
serialized_bytes_length = 72667
Loading

0 comments on commit 4050ad0

Please sign in to comment.