bazel run program
-
-
Save izzyleung/df49c388d87e1647638926fc1ca3d79b to your computer and use it in GitHub Desktop.
Extract Resource file from Jar file in a Bazel repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
py_binary( | |
name = "program", | |
srcs = ["program.py"], | |
data = ["@auto_value//:autovalue.vm"], | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('../auto_value/autovalue.vm') as vm: | |
print(vm.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new_http_archive( | |
name = "auto_value", | |
url = "http://central.maven.org/maven2/com/google/auto/value/auto-value/1.6.2/auto-value-1.6.2.jar", | |
build_file_content = """\ | |
genrule( | |
name = "auto_value_template", | |
srcs = ["com/google/auto/value/processor/autovalue.vm"], | |
outs = ["autovalue.vm"], | |
visibility = ["//visibility:public"], | |
cmd = "cp $< $@" | |
) | |
""", | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment