Merge "Add support for remote-execution / caching of signapk actions"
This commit is contained in:
commit
8f37ec82d9
4 changed files with 43 additions and 18 deletions
|
@ -289,6 +289,7 @@ bootstrap_go_package {
|
||||||
"soong-dexpreopt",
|
"soong-dexpreopt",
|
||||||
"soong-genrule",
|
"soong-genrule",
|
||||||
"soong-java-config",
|
"soong-java-config",
|
||||||
|
"soong-remoteexec",
|
||||||
"soong-tradefed",
|
"soong-tradefed",
|
||||||
],
|
],
|
||||||
srcs: [
|
srcs: [
|
||||||
|
|
|
@ -582,19 +582,27 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
a.outputFile = android.PathForModuleOut(ctx, a.Name()+suffix)
|
a.outputFile = android.PathForModuleOut(ctx, a.Name()+suffix)
|
||||||
|
rule := java.Signapk
|
||||||
|
args := map[string]string{
|
||||||
|
"certificates": a.container_certificate_file.String() + " " + a.container_private_key_file.String(),
|
||||||
|
"flags": "-a 4096", //alignment
|
||||||
|
}
|
||||||
|
implicits := android.Paths{
|
||||||
|
a.container_certificate_file,
|
||||||
|
a.container_private_key_file,
|
||||||
|
}
|
||||||
|
if ctx.Config().IsEnvTrue("RBE_SIGNAPK") {
|
||||||
|
rule = java.SignapkRE
|
||||||
|
args["implicits"] = strings.Join(implicits.Strings(), ",")
|
||||||
|
args["outCommaList"] = a.outputFile.String()
|
||||||
|
}
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: java.Signapk,
|
Rule: rule,
|
||||||
Description: "signapk",
|
Description: "signapk",
|
||||||
Output: a.outputFile,
|
Output: a.outputFile,
|
||||||
Input: unsignedOutputFile,
|
Input: unsignedOutputFile,
|
||||||
Implicits: []android.Path{
|
Implicits: implicits,
|
||||||
a.container_certificate_file,
|
Args: args,
|
||||||
a.container_private_key_file,
|
|
||||||
},
|
|
||||||
Args: map[string]string{
|
|
||||||
"certificates": a.container_certificate_file.String() + " " + a.container_private_key_file.String(),
|
|
||||||
"flags": "-a 4096", //alignment
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Install to $OUT/soong/{target,host}/.../apex
|
// Install to $OUT/soong/{target,host}/.../apex
|
||||||
|
|
|
@ -26,16 +26,23 @@ import (
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
"android/soong/remoteexec"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Signapk = pctx.AndroidStaticRule("signapk",
|
Signapk, SignapkRE = remoteexec.StaticRules(pctx, "signapk",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
Command: `${config.JavaCmd} ${config.JavaVmFlags} -Djava.library.path=$$(dirname ${config.SignapkJniLibrary}) ` +
|
Command: `$reTemplate${config.JavaCmd} ${config.JavaVmFlags} -Djava.library.path=$$(dirname ${config.SignapkJniLibrary}) ` +
|
||||||
`-jar ${config.SignapkCmd} $flags $certificates $in $out`,
|
`-jar ${config.SignapkCmd} $flags $certificates $in $out`,
|
||||||
CommandDeps: []string{"${config.SignapkCmd}", "${config.SignapkJniLibrary}"},
|
CommandDeps: []string{"${config.SignapkCmd}", "${config.SignapkJniLibrary}"},
|
||||||
},
|
},
|
||||||
"flags", "certificates")
|
&remoteexec.REParams{Labels: map[string]string{"type": "tool", "name": "signapk"},
|
||||||
|
ExecStrategy: "${config.RESignApkExecStrategy}",
|
||||||
|
Inputs: []string{"${config.SignapkCmd}", "$in", "$$(dirname ${config.SignapkJniLibrary})", "$implicits"},
|
||||||
|
OutputFiles: []string{"$outCommaList"},
|
||||||
|
ToolchainInputs: []string{"${config.JavaCmd}"},
|
||||||
|
Platform: map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"},
|
||||||
|
}, []string{"flags", "certificates"}, []string{"implicits", "outCommaList"})
|
||||||
)
|
)
|
||||||
|
|
||||||
var combineApk = pctx.AndroidStaticRule("combineApk",
|
var combineApk = pctx.AndroidStaticRule("combineApk",
|
||||||
|
@ -78,22 +85,30 @@ func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, u
|
||||||
deps = append(deps, c.Pem, c.Key)
|
deps = append(deps, c.Pem, c.Key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outputFiles := android.WritablePaths{signedApk}
|
||||||
var flags []string
|
var flags []string
|
||||||
if lineageFile != nil {
|
if lineageFile != nil {
|
||||||
flags = append(flags, "--lineage", lineageFile.String())
|
flags = append(flags, "--lineage", lineageFile.String())
|
||||||
deps = append(deps, lineageFile)
|
deps = append(deps, lineageFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rule := Signapk
|
||||||
|
args := map[string]string{
|
||||||
|
"certificates": strings.Join(certificateArgs, " "),
|
||||||
|
"flags": strings.Join(flags, " "),
|
||||||
|
}
|
||||||
|
if ctx.Config().IsEnvTrue("RBE_SIGNAPK") {
|
||||||
|
rule = SignapkRE
|
||||||
|
args["implicits"] = strings.Join(deps.Strings(), ",")
|
||||||
|
args["outCommaList"] = strings.Join(outputFiles.Strings(), ",")
|
||||||
|
}
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: Signapk,
|
Rule: rule,
|
||||||
Description: "signapk",
|
Description: "signapk",
|
||||||
Output: signedApk,
|
Outputs: outputFiles,
|
||||||
Input: unsignedApk,
|
Input: unsignedApk,
|
||||||
Implicits: deps,
|
Implicits: deps,
|
||||||
Args: map[string]string{
|
Args: args,
|
||||||
"certificates": strings.Join(certificateArgs, " "),
|
|
||||||
"flags": strings.Join(flags, " "),
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@ func init() {
|
||||||
pctx.VariableFunc("RED8ExecStrategy", remoteexec.EnvOverrideFunc("RBE_D8_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
pctx.VariableFunc("RED8ExecStrategy", remoteexec.EnvOverrideFunc("RBE_D8_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
||||||
pctx.VariableFunc("RER8ExecStrategy", remoteexec.EnvOverrideFunc("RBE_R8_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
pctx.VariableFunc("RER8ExecStrategy", remoteexec.EnvOverrideFunc("RBE_R8_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
||||||
pctx.VariableFunc("RETurbineExecStrategy", remoteexec.EnvOverrideFunc("RBE_TURBINE_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
pctx.VariableFunc("RETurbineExecStrategy", remoteexec.EnvOverrideFunc("RBE_TURBINE_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
||||||
|
pctx.VariableFunc("RESignApkExecStrategy", remoteexec.EnvOverrideFunc("RBE_SIGNAPK_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
||||||
|
|
||||||
pctx.HostJavaToolVariable("JacocoCLIJar", "jacoco-cli.jar")
|
pctx.HostJavaToolVariable("JacocoCLIJar", "jacoco-cli.jar")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue