ray/java/BUILD.bazel

248 lines
6.4 KiB
Text
Raw Normal View History

load("//bazel:ray.bzl", "define_java_module")
2019-11-08 15:58:28 -08:00
load("@rules_proto_grpc//java:defs.bzl", "java_proto_compile")
exports_files([
"testng.xml",
"checkstyle.xml",
"checkstyle-suppressions.xml",
])
all_modules = [
"api",
"runtime",
"test",
"tutorial",
]
java_import(
name = "all_modules",
jars = [
"libio_ray_ray_" + module + ".jar"
for module in all_modules
] + [
"libio_ray_ray_" + module + "-src.jar"
for module in all_modules
] + [
"all_tests_deploy.jar",
"all_tests_deploy-src.jar",
],
deps = [
":io_ray_ray_" + module
for module in all_modules
] + [
":all_tests",
],
)
define_java_module(
name = "api",
visibility = ["//visibility:public"],
deps = [
"@maven//:com_sun_xml_bind_jaxb_core",
"@maven//:com_sun_xml_bind_jaxb_impl",
"@maven//:javax_xml_bind_jaxb_api",
"@maven//:log4j_log4j",
"@maven//:org_slf4j_slf4j_log4j12",
],
)
define_java_module(
name = "runtime",
additional_resources = [
":java_native_deps",
],
additional_srcs = [
":all_java_proto",
],
define_test_lib = True,
exclude_srcs = [
"runtime/src/main/java/io/ray/runtime/generated/*.java",
],
test_deps = [
":io_ray_ray_api",
":io_ray_ray_runtime",
"@maven//:org_apache_commons_commons_lang3",
"@maven//:com_beust_jcommander",
"@maven//:org_testng_testng",
"@maven//:commons_io_commons_io",
],
visibility = ["//visibility:public"],
deps = [
":io_ray_ray_api",
"@maven//:com_google_guava_guava",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:com_typesafe_config",
"@maven//:commons_io_commons_io",
"@maven//:de_ruedigermoeller_fst",
2020-06-02 16:15:20 +08:00
"@maven//:log4j_log4j",
"@maven//:net_java_dev_jna_jna",
"@maven//:org_apache_commons_commons_lang3",
Cross language serialization for primitive types (#7711) * Cross language serialization for Java and Python * Use strict types when Python serializing * Handle recursive objects in Python; Pin msgpack >= 0.6.0, < 1.0.0 * Disable gc for optimizing msgpack loads * Fix merge bug * Java call Python use returnType; Fix ClassLoaderTest * Fix RayMethodsTest * Fix checkstyle * Fix lint * prepare_args raises exception if try to transfer a non-deserializable object to another language * Fix CrossLanguageInvocationTest.java, Python msgpack treat float as double * Minor fixes * Fix compile error on linux * Fix lint in java/BUILD.bazel * Fix test_failure * Fix lint * Class<?> to Class<T>; Refine metadata bytes. * Rename FST to Fst; sort java dependencies * Change Class<?>[] to Optional<Class<?>>; sort requirements in setup.py * Improve CrossLanguageInvocationTest * Refactor MessagePackSerializer.java * Refactor MessagePackSerializer.java; Refine CrossLanguageInvocationTest.java * Remove unnecessary dependencies for Java; Add getReturnType() for RayFunction in Java * Fix bug * Remove custom cross language type support * Replace Serializer.Meta with MutableBoolean * Remove @SuppressWarnings support from checkstyle.xml; Add null test in CrossLanguageInvocationTest.java * Refine MessagePackSerializer.pack * Ray.get support RayObject as input * Improve comments and error info * Remove classLoader argument from serializer * Separate msgpack from pickle5 in Python * Pair<byte[], MutableBoolean> to Pair<byte[], Boolean> * Remove public static <T> T get(RayObject<T> object), use RayObject.get() instead * Refine test * small fixes Co-authored-by: 刘宝 <po.lb@antfin.com> Co-authored-by: Hao Chen <chenh1024@gmail.com>
2020-04-08 21:10:57 +08:00
"@maven//:org_msgpack_msgpack_core",
"@maven//:org_ow2_asm_asm",
"@maven//:org_slf4j_slf4j_api",
"@maven//:org_slf4j_slf4j_log4j12",
"@maven//:org_testng_testng",
"@maven//:redis_clients_jedis",
],
)
define_java_module(
name = "tutorial",
deps = [
":io_ray_ray_api",
":io_ray_ray_runtime",
"@maven//:com_google_guava_guava",
],
)
define_java_module(
name = "test",
deps = [
":io_ray_ray_api",
":io_ray_ray_runtime",
"@maven//:com_google_code_gson_gson",
"@maven//:com_google_guava_guava",
"@maven//:com_sun_xml_bind_jaxb_core",
"@maven//:com_sun_xml_bind_jaxb_impl",
"@maven//:commons_io_commons_io",
"@maven//:javax_xml_bind_jaxb_api",
"@maven//:org_apache_commons_commons_lang3",
"@maven//:org_slf4j_slf4j_api",
"@maven//:org_testng_testng",
],
)
java_binary(
name = "all_tests",
args = ["java/testng.xml"],
data = ["testng.xml"],
main_class = "org.testng.TestNG",
runtime_deps = [
":io_ray_ray_runtime_test",
":io_ray_ray_test",
],
)
java_proto_compile(
name = "common_java_proto",
deps = ["@//:common_proto"],
)
java_proto_compile(
name = "gcs_java_proto",
deps = ["@//:gcs_proto"],
)
filegroup(
name = "all_java_proto",
srcs = [
":common_java_proto",
":gcs_java_proto",
],
)
2019-12-20 14:45:51 +08:00
# plasma_store_server binary should be located in jar root path
# and keep in sync with mvn resource
genrule(
name = "cp_plasma_store_server",
srcs = [
2020-06-03 17:44:34 -07:00
"//:plasma_store_server",
2019-12-20 14:45:51 +08:00
],
outs = ["plasma_store_server"],
cmd = """
2020-06-03 17:44:34 -07:00
cp -f $(location //:plasma_store_server) $@
""",
2019-12-20 14:45:51 +08:00
)
filegroup(
name = "java_native_deps",
srcs = [
":cp_plasma_store_server",
"//:core_worker_library_java",
2020-02-05 12:06:25 +08:00
"//:gcs_server",
"//:libray_redis_module.so",
"//:raylet",
"//:redis-server",
],
)
# Generates the dependencies needed by maven.
genrule(
name = "gen_maven_deps",
srcs = [
":all_java_proto",
":java_native_deps",
":copy_pom_file",
],
outs = ["gen_maven_deps.out"],
cmd = """
WORK_DIR="$$(pwd)"
# Copy protobuf-generated files.
rm -rf "$$WORK_DIR/java/runtime/src/main/java/io/ray/runtime/generated"
for f in $(locations //java:all_java_proto); do
unzip "$$f" -x META-INF/MANIFEST.MF -d "$$WORK_DIR/java/runtime/src/main/java"
done
# Copy native dependecies.
NATIVE_DEPS_DIR="$$WORK_DIR/java/runtime/native_dependencies/"
rm -rf "$$NATIVE_DEPS_DIR"
mkdir -p "$$NATIVE_DEPS_DIR"
for f in $(locations //java:java_native_deps); do
chmod +w "$$f"
cp "$$f" "$$NATIVE_DEPS_DIR"
done
date > $@
""",
local = 1,
tags = ["no-cache"],
)
genrule(
name = "copy_pom_file",
srcs = [
"//java:io_ray_ray_" + module + "_pom"
for module in all_modules
],
outs = ["copy_pom_file.out"],
cmd = """
WORK_DIR="$$(pwd)"
cp -f $(location //java:io_ray_ray_api_pom) "$$WORK_DIR/java/api/pom.xml"
cp -f $(location //java:io_ray_ray_runtime_pom) "$$WORK_DIR/java/runtime/pom.xml"
cp -f $(location //java:io_ray_ray_tutorial_pom) "$$WORK_DIR/java/tutorial/pom.xml"
cp -f $(location //java:io_ray_ray_test_pom) "$$WORK_DIR/java/test/pom.xml"
date > $@
""",
local = 1,
tags = ["no-cache"],
)
java_binary(
name = "ray_dist",
# This rule is used to package all Ray Java code and the third-party dependencies into a
# fat jar file. It's not really an executable jar. So we set its `main_class` to empty.
main_class = "",
runtime_deps = [
"//java:io_ray_ray_api",
"//java:io_ray_ray_runtime",
"//streaming/java:io_ray_ray_streaming-api",
"//streaming/java:io_ray_ray_streaming-runtime",
],
)
genrule(
name = "ray_java_pkg",
srcs = [
"//java:ray_dist_deploy.jar",
"//java:gen_maven_deps",
"//streaming/java:gen_maven_deps",
],
outs = ["ray_java_pkg.out"],
cmd = """
WORK_DIR="$$(pwd)"
rm -rf "$$WORK_DIR/python/ray/jars" && mkdir -p "$$WORK_DIR/python/ray/jars"
cp -f $(location //java:ray_dist_deploy.jar) "$$WORK_DIR/python/ray/jars/ray_dist.jar"
date > $@
""",
local = 1,
tags = ["no-cache"],
)