Skip to main content

prebuilt_jar

name

def name(
*,
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
_apple_platforms: dict[str, str] = ...,
_build_only_native_code: bool = ...,
_dex_min_sdk_version: None | int = ...,
_dex_toolchain: str = ...,
_exec_os_type: str = ...,
_prebuilt_jar_toolchain: str = ...,
binary_jar: str,
contacts: list[str] = ...,
default_host_platform: None | str = ...,
deps: list[str] = ...,
desugar_deps: list[str] = ...,
generate_abi: bool = ...,
is_executable: bool = ...,
javadoc_url: None | str = ...,
labels: list[str] = ...,
licenses: list[str] = ...,
maven_coords: None | str = ...,
never_mark_as_unused_dependency: bool = ...,
required_for_source_only_abi: bool = ...,
source_jar: None | str = ...,
) -> None

A prebuilt_jar() rule is used to identify a JAR file that is checked into our repository as a precompiled binary rather than one that is built from source by Buck. Frequently, these are used to reference third-party JAR files (such as junit.jar) and are used as dependencies of java_library() rules.

Parameters

  • name: name of the target
  • default_target_platform: specifies the default target platform, used when no platforms are specified on the command line
  • target_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configuration
  • compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configuration
  • exec_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
  • visibility: a list of visibility patterns restricting what targets can depend on this one
  • within_view: a list of visibility patterns restricting what this target can depend on
  • metadata: a key-value map of metadata associated with this target
  • tests: a list of targets that provide tests for this one
  • modifiers: an array of modifiers associated with this target
  • binary_jar: Path to the pre-built JAR file.
  • deps: Rules that must be built before this rule. Because the binary_jar is already built, there should be nothing to build, so this should be empty.
  • javadoc_url: URL to the Javadoc for the .class files in the binary_jar.
  • source_jar: Path to a JAR file that contains the .java files to create the .class in the binary_jar. This is frequently provided for debugging purposes.

Details

Examples:


prebuilt_jar(
name = 'junit',
binary_jar = 'junit-4.8.2.jar',
source_jar = 'junit-4.8.2-sources.jar',
javadoc_url = 'http://kentbeck.github.com/junit/javadoc/4.8/',
)

java_library(
name = 'tests',
srcs = glob(['tests/**/*Test.java']),
deps = [
':junit',
],
)