python par: trim and convert the entry point at build time
Instead of doing these string operations in the C++ code at every startup of an embedded par, trim and convert the entry point file to a python module path at build time. Test: m Change-Id: I04a6459a80c84a704b8a25a144ab1e19622d6cc3
This commit is contained in:
@@ -54,7 +54,8 @@ var (
|
|||||||
|
|
||||||
embeddedPar = pctx.AndroidStaticRule("embeddedPar",
|
embeddedPar = pctx.AndroidStaticRule("embeddedPar",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
Command: `echo '$main' > $entryPoint &&` +
|
// `echo -n` to trim the newline, since the python code just wants the name
|
||||||
|
Command: `echo -n '$main' > $entryPoint &&` +
|
||||||
`$mergeParCmd -p --prefix $launcher -e $entryPoint $out $srcsZips && ` +
|
`$mergeParCmd -p --prefix $launcher -e $entryPoint $out $srcsZips && ` +
|
||||||
`chmod +x $out && (rm -f $entryPoint)`,
|
`chmod +x $out && (rm -f $entryPoint)`,
|
||||||
CommandDeps: []string{"$mergeParCmd"},
|
CommandDeps: []string{"$mergeParCmd"},
|
||||||
@@ -114,7 +115,7 @@ func registerBuildActionForParFile(ctx android.ModuleContext, embeddedLauncher b
|
|||||||
Output: binFile,
|
Output: binFile,
|
||||||
Implicits: implicits,
|
Implicits: implicits,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"main": main,
|
"main": strings.Replace(strings.TrimSuffix(main, pyExt), "/", ".", -1),
|
||||||
"entryPoint": entryPoint,
|
"entryPoint": entryPoint,
|
||||||
"srcsZips": strings.Join(srcsZips.Strings(), " "),
|
"srcsZips": strings.Join(srcsZips.Strings(), " "),
|
||||||
"launcher": launcherPath.String(),
|
"launcher": launcherPath.String(),
|
||||||
|
Reference in New Issue
Block a user