Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java_export to inherit testonly on its sub-targets #674

Merged
merged 1 commit into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
)