Fix mac build w/echo -n
Soong doesn't wrap everything in bash, but relies on the ninja default
of /bin/sh. We should probably improve that in the future, but for now,
just fix the build.
On Mac, /bin/sh and /bin/bash are both bash, but /bin/sh implies `set -o
posix`, and ignores the `-n` flag.
Test: treehugger
Test: build on a mac
Change-Id: Icf41b1c5a1ce9eb0a56e39e68c433fc80b53620f
diff --git a/python/builder.go b/python/builder.go
index 7ecd4b5..cbbe56e 100644
--- a/python/builder.go
+++ b/python/builder.go
@@ -54,8 +54,10 @@
embeddedPar = pctx.AndroidStaticRule("embeddedPar",
blueprint.RuleParams{
- // `echo -n` to trim the newline, since the python code just wants the name
- Command: `echo -n '$main' > $entryPoint &&` +
+ // `echo -n` to trim the newline, since the python code just wants the name.
+ // /bin/sh (used by ninja) on Mac turns off posix mode, and stops supporting -n.
+ // Explicitly use bash instead.
+ Command: `/bin/bash -c "echo -n '$main' > $entryPoint" &&` +
`$mergeParCmd -p --prefix $launcher -e $entryPoint $out $srcsZips && ` +
`chmod +x $out && (rm -f $entryPoint)`,
CommandDeps: []string{"$mergeParCmd"},