26 lines
822 B
Text
26 lines
822 B
Text
genrule(
|
|
name = "generate_tts_client_rb",
|
|
srcs = [
|
|
"tts-client.rb.tpl",
|
|
"//experimental/users/acmcarther/llm/tts_grpc:tts_client_go",
|
|
],
|
|
outs = ["tts-client.rb"],
|
|
cmd = """
|
|
# Identify the binary. It's the file that doesn't end in .tpl
|
|
for f in $(locations //experimental/users/acmcarther/llm/tts_grpc:tts_client_go); do
|
|
BINARY=$$f
|
|
break
|
|
done
|
|
|
|
# Calculate SHA256
|
|
if command -v sha256sum >/dev/null 2>&1; then
|
|
HASH=$$(sha256sum $$BINARY | cut -d' ' -f1)
|
|
else
|
|
HASH=$$(shasum -a 256 $$BINARY | cut -d' ' -f1)
|
|
fi
|
|
|
|
# Substitute into template
|
|
sed "s/{SHA256}/$$HASH/g" $(location tts-client.rb.tpl) > $@
|
|
""",
|
|
visibility = ["//visibility:public"],
|
|
)
|