Skip to content

Commit

Permalink
Refine JNI bazel script to make it suitable for more systems (ray-pro…
Browse files Browse the repository at this point in the history
…ject#4060)

* Refine JNI bazel script to make it suitable for more systems

* Update BUILD.bazel

the script format has changed

* Update BUILD.plasma

the script format has changed

* Lint bazel/BUILD.plasma  BUILD.bazel
  • Loading branch information
ruifangChen authored and guoyuhong committed Feb 20, 2019
1 parent e7651b1 commit 67fa0b5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
21 changes: 13 additions & 8 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -353,22 +353,27 @@ pyx_library(
cc_binary(
name = "raylet_library_java.so",
srcs = [
"src/ray/id.h",
"src/ray/raylet/lib/java/org_ray_runtime_raylet_RayletClientImpl.cc",
"src/ray/raylet/lib/java/org_ray_runtime_raylet_RayletClientImpl.h",
"src/ray/raylet/lib/java/org_ray_runtime_raylet_RayletClientImpl.cc",
"src/ray/id.h",
"src/ray/raylet/raylet_client.h",
"src/ray/util/logging.h",
"@bazel_tools//tools/jdk:current_java_runtime",
],
"@bazel_tools//tools/jdk:jni_header",
] + select({
"@bazel_tools//src/conditions:windows": ["@bazel_tools//tools/jdk:jni_md_header-windows"],
"@bazel_tools//src/conditions:darwin": ["@bazel_tools//tools/jdk:jni_md_header-darwin"],
"//conditions:default": ["@bazel_tools//tools/jdk:jni_md_header-linux"],
}),
includes = [
"src",
"external/local_jdk/include",
"external/bazel_tools/tools/jdk/include",
] + select({
"@bazel_tools//src/conditions:darwin": ["external/local_jdk/include/darwin"],
"//conditions:default": ["external/local_jdk/include/linux"],
"@bazel_tools//src/conditions:windows": ["external/bazel_tools/tools/jdk/include/windows"],
"@bazel_tools//src/conditions:darwin": ["external/bazel_tools/tools/jdk/include/darwin"],
"//conditions:default": ["external/bazel_tools/tools/jdk/include/linux"],
}),
linkshared = 1,
linkstatic = 1,
linkstatic = 0,
deps = [
"//:raylet_lib",
"@plasma//:plasma_client",
Expand Down
30 changes: 23 additions & 7 deletions bazel/BUILD.plasma
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,36 @@ cc_binary(
srcs = [
"cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.cc",
"cpp/src/plasma/lib/java/org_apache_arrow_plasma_PlasmaClientJNI.h",
"@bazel_tools//tools/jdk:current_java_runtime",
":jni.h",
":jni_md.h",
],
includes = [
".",
"cpp/src",
"../../external/local_jdk/include",
] + select({
"@bazel_tools//src/conditions:darwin": ["../../external/local_jdk/include/darwin"],
"//conditions:default": ["../../external/local_jdk/include/linux"],
}),
],
linkshared = 1,
linkstatic = 1,
linkstatic = 0,
deps = [":plasma_client"],
)

genrule(
name = "copy_jni_h",
srcs = ["@bazel_tools//tools/jdk:jni_header"],
outs = ["jni.h"],
cmd = "cp -f $< $@",
)

genrule(
name = "copy_jni_md_h",
srcs = select({
"@bazel_tools//src/conditions:windows": ["@bazel_tools//tools/jdk:jni_md_header-windows"],
"@bazel_tools//src/conditions:darwin": ["@bazel_tools//tools/jdk:jni_md_header-darwin"],
"//conditions:default": ["@bazel_tools//tools/jdk:jni_md_header-linux"],
}),
outs = ["jni_md.h"],
cmd = "cp -f $< $@",
)

genrule(
name = "plasma-jni-darwin-compat",
srcs = [":plasma_client_java.so"],
Expand Down

0 comments on commit 67fa0b5

Please sign in to comment.