Skip to content

Commit

Permalink
Fix propagation of testonly
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Mar 10, 2022
1 parent cc76643 commit 8a35f5b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jni/internal/cc_jni_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def cc_jni_library(
tags = cc_binary_args.pop("tags", default = None)
visibility = cc_binary_args.pop("visibility", default = None)

# Arguments to be set on all targets.
testonly = cc_binary_args.pop("testonly", default = None)

# Simple concatenation is compatible with select, append is not.
cc_binary_args.setdefault("deps", [])
cc_binary_args["deps"] += [Label("//jni")]
Expand All @@ -182,6 +185,7 @@ def cc_jni_library(
linkshared = True,
linkstatic = True,
tags = ["manual"],
testonly = testonly,
visibility = ["//visibility:private"],
**cc_binary_args
)
Expand All @@ -190,6 +194,7 @@ def cc_jni_library(
linkshared = True,
linkstatic = True,
tags = ["manual"],
testonly = testonly,
visibility = ["//visibility:private"],
**cc_binary_args
)
Expand All @@ -198,6 +203,7 @@ def cc_jni_library(
linkshared = True,
linkstatic = True,
tags = ["manual"],
testonly = testonly,
visibility = ["//visibility:private"],
**cc_binary_args
)
Expand All @@ -213,6 +219,7 @@ def cc_jni_library(
cpu = SELECT_TARGET_CPU,
os = SELECT_TARGET_OS,
tags = ["manual"],
testonly = testonly,
visibility = ["//visibility:private"],
)

Expand All @@ -223,6 +230,7 @@ def cc_jni_library(
original_name = name,
platforms = platforms,
tags = ["manual"],
testonly = testonly,
visibility = ["//visibility:private"],
)

Expand All @@ -231,5 +239,6 @@ def cc_jni_library(
resources = [":" + multi_platform_artifact_name],
resource_strip_prefix = _maven_resource_prefix_if_present(),
tags = tags,
testonly = testonly,
visibility = visibility,
)
6 changes: 6 additions & 0 deletions jni/internal/java_jni_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def java_jni_library(
tags = java_library_args.pop("tags", default = None)
visibility = java_library_args.pop("visibility", default = None)

# Arguments to be set on all targets.
testonly = java_library_args.pop("testonly", default = None)

java_library_deps_arg = "deps" if java_library_args.get("srcs") else "runtime_deps"

# Simple concatenation is compatible with select, append is not.
Expand All @@ -63,13 +66,15 @@ def java_jni_library(
name = original_name,
tags = ["manual"],
visibility = ["//visibility:private"],
testonly = testonly,
**java_library_args
)

jni_headers(
name = headers_name,
lib = ":" + original_name,
tags = ["manual"],
testonly = testonly,
visibility = visibility,
)

Expand All @@ -79,5 +84,6 @@ def java_jni_library(
":" + original_name,
] + native_libs,
tags = tags,
testonly = testonly,
visibility = visibility,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ load("@fmeum_rules_jni//jni:defs.bzl", "java_jni_library")

java_jni_library(
name = "os",
testonly = True,
srcs = [
"OsUtils.java",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ load("@fmeum_rules_jni//jni:defs.bzl", "cc_jni_library")

cc_jni_library(
name = "os",
testonly = True,
srcs = [
"onload.cpp",
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cc_library(
name = "os_impl",
testonly = True,
srcs = ["os.cpp"],
tags = ["manual"],
visibility = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cc_library(
name = "os_impl",
testonly = True,
srcs = ["os.cpp"],
tags = ["manual"],
visibility = [
Expand Down

0 comments on commit 8a35f5b

Please sign in to comment.