Skip to content

Commit

Permalink
java_export to inherit testonly (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsawada committed Mar 24, 2022
1 parent 156ba5b commit 20857b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions private/rules/java_export.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def java_export(
pom_template = None,
visibility = None,
tags = [],
testonly = False,
**kwargs):
"""Extends `java_library` to allow maven artifacts to be uploaded.
Expand Down Expand Up @@ -71,6 +72,7 @@ def java_export(
native.java_library(
name = lib_name,
tags = tags + maven_coordinates_tags,
testonly = testonly,
**kwargs
)

Expand All @@ -82,6 +84,7 @@ def java_export(
pom_template,
visibility,
tags,
testonly,
lib_name,
javadocopts
)
Expand All @@ -94,6 +97,7 @@ def maven_export(
pom_template,
visibility,
tags,
testonly,
lib_name,
javadocopts):

Expand All @@ -115,6 +119,7 @@ def maven_export(
target = ":%s" % lib_name,
deploy_env = deploy_env,
tags = tags + maven_coordinates_tags,
testonly = testonly,
)

native.filegroup(
Expand All @@ -124,6 +129,7 @@ def maven_export(
],
output_group = "maven_artifact",
tags = tags,
testonly = testonly,
)

native.filegroup(
Expand All @@ -133,6 +139,7 @@ def maven_export(
],
output_group = "maven_source",
tags = tags,
testonly = testonly,
)

docs_jar = None
Expand All @@ -145,13 +152,15 @@ def maven_export(
],
javadocopts = javadocopts,
tags = tags,
testonly = testonly,
)

pom_file(
name = "%s-pom" % name,
target = ":%s" % lib_name,
pom_template = pom_template,
tags = tags,
testonly = testonly,
)

maven_publish(
Expand All @@ -163,6 +172,7 @@ def maven_export(
source_jar = ":%s-maven-source" % name,
visibility = visibility,
tags = tags,
testonly = testonly,
)

# Finally, alias the primary output
Expand All @@ -171,4 +181,5 @@ def maven_export(
actual = ":%s-project" % name,
visibility = visibility,
tags = tags,
testonly = testonly,
)
3 changes: 3 additions & 0 deletions private/rules/kt_jvm_export.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def kt_jvm_export(
pom_template = None,
visibility = None,
tags = [],
testonly = False,
**kwargs):
"""Extends `kt_jvm_library` to allow maven artifacts to be uploaded. This
rule is the Kotlin JVM version of `java_export`.
Expand Down Expand Up @@ -69,6 +70,7 @@ def kt_jvm_export(
kt_jvm_library(
name = lib_name,
tags = tags + maven_coordinates_tags,
testonly = testonly,
**kwargs
)

Expand All @@ -80,6 +82,7 @@ def kt_jvm_export(
pom_template,
visibility,
tags,
testonly,
lib_name,
javadocopts
)

0 comments on commit 20857b0

Please sign in to comment.