Skip to content

Commit

Permalink
Remove utils.h from libjvm runfiles
Browse files Browse the repository at this point in the history
Works around bazelbuild/bazel-skylib#326 by not
using copy_file for utils.h.
  • Loading branch information
fmeum committed Oct 16, 2021
1 parent 8e2ac90 commit 6b8ef88
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions jni/tools/libjvm_stub/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load(":current_java_runtime.bzl", "current_java_runtime")
load("//jni/internal:common.bzl", "merge_cc_infos")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")

merge_cc_infos(
name = "libjvm_stub_with_jni",
Expand Down Expand Up @@ -48,6 +47,10 @@ cc_library(
"libjvm_stub.c",
":utils",
],
copts = select({
"@platforms//os:windows": ["-I%s/windows" % package_name()],
"//conditions:default": ["-I%s/unix" % package_name()],
}),
includes = ["."],
linkopts = select({
"@platforms//os:windows": [],
Expand All @@ -58,13 +61,12 @@ cc_library(
],
)

copy_file(
filegroup(
name = "utils",
src = select({
"@platforms//os:windows": "utils_windows.h",
"//conditions:default": "utils_unix.h",
srcs = select({
"@platforms//os:windows": ["windows/utils.h"],
"//conditions:default": ["unix/utils.h"],
}),
out = "utils.h",
)

current_java_runtime(
Expand Down
2 changes: 1 addition & 1 deletion jni/tools/libjvm_stub/libjvm_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>

#include "jni/tools/libjvm_stub/utils.h"
#include "utils.h"

#define MSG_PREFIX "rules_jni: "

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 6b8ef88

Please sign in to comment.