Use Rule-local implicit dependencies
Depends on https://github.com/google/blueprint/pull/78 This uses the new CommandDeps field to move implicit dependencies embedded in the Command string next to the definition, instead of having to specify them in every BuildParam struct. This should make it easier to verify dependencies. Change-Id: I2711b160920e22fa962a436e1f7041272166f50f
This commit is contained in:
@@ -45,6 +45,7 @@ var (
|
||||
Depfile: "${out}.d",
|
||||
Deps: blueprint.DepsGCC,
|
||||
Command: "$relPwd $ccCmd -c $cFlags -MD -MF ${out}.d -o $out $in",
|
||||
CommandDeps: []string{"$ccCmd"},
|
||||
Description: "cc $out",
|
||||
},
|
||||
"ccCmd", "cFlags")
|
||||
@@ -53,6 +54,7 @@ var (
|
||||
blueprint.RuleParams{
|
||||
Command: "$ldCmd ${ldDirFlags} ${crtBegin} @${out}.rsp " +
|
||||
"${libFlags} ${crtEnd} -o ${out} ${ldFlags}",
|
||||
CommandDeps: []string{"$ldCmd"},
|
||||
Description: "ld $out",
|
||||
Rspfile: "${out}.rsp",
|
||||
RspfileContent: "${in}",
|
||||
@@ -62,6 +64,7 @@ var (
|
||||
partialLd = pctx.StaticRule("partialLd",
|
||||
blueprint.RuleParams{
|
||||
Command: "$ldCmd -r ${in} -o ${out}",
|
||||
CommandDeps: []string{"$ldCmd"},
|
||||
Description: "partialLd $out",
|
||||
},
|
||||
"ldCmd")
|
||||
@@ -69,6 +72,7 @@ var (
|
||||
ar = pctx.StaticRule("ar",
|
||||
blueprint.RuleParams{
|
||||
Command: "rm -f ${out} && $arCmd $arFlags $out @${out}.rsp",
|
||||
CommandDeps: []string{"$arCmd"},
|
||||
Description: "ar $out",
|
||||
Rspfile: "${out}.rsp",
|
||||
RspfileContent: "${in}",
|
||||
@@ -78,6 +82,7 @@ var (
|
||||
darwinAr = pctx.StaticRule("darwinAr",
|
||||
blueprint.RuleParams{
|
||||
Command: "rm -f ${out} && $arCmd $arFlags $out $in",
|
||||
CommandDeps: []string{"$arCmd"},
|
||||
Description: "ar $out",
|
||||
},
|
||||
"arCmd", "arFlags")
|
||||
@@ -85,6 +90,7 @@ var (
|
||||
darwinAppendAr = pctx.StaticRule("darwinAppendAr",
|
||||
blueprint.RuleParams{
|
||||
Command: "cp -f ${inAr} ${out}.tmp && $arCmd $arFlags ${out}.tmp $in && mv ${out}.tmp ${out}",
|
||||
CommandDeps: []string{"$arCmd"},
|
||||
Description: "ar $out",
|
||||
},
|
||||
"arCmd", "arFlags", "inAr")
|
||||
@@ -92,6 +98,7 @@ var (
|
||||
prefixSymbols = pctx.StaticRule("prefixSymbols",
|
||||
blueprint.RuleParams{
|
||||
Command: "$objcopyCmd --prefix-symbols=${prefix} ${in} ${out}",
|
||||
CommandDeps: []string{"$objcopyCmd"},
|
||||
Description: "prefixSymbols $out",
|
||||
},
|
||||
"objcopyCmd", "prefix")
|
||||
@@ -103,6 +110,7 @@ var (
|
||||
Depfile: "${out}.d",
|
||||
Deps: blueprint.DepsGCC,
|
||||
Command: "$copyGccLibPath $out $ccCmd $cFlags -print-file-name=${libName}",
|
||||
CommandDeps: []string{"$copyGccLibPath", "$ccCmd"},
|
||||
Description: "copy gcc $out",
|
||||
},
|
||||
"ccCmd", "cFlags", "libName")
|
||||
@@ -202,13 +210,11 @@ func TransformSourceToObj(ctx common.AndroidModuleContext, subdir string, srcFil
|
||||
ccCmd = gccCmd(flags.toolchain, ccCmd)
|
||||
}
|
||||
|
||||
objDeps := append([]string{ccCmd}, deps...)
|
||||
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: cc,
|
||||
Outputs: []string{objFile},
|
||||
Inputs: []string{srcFile},
|
||||
Implicits: objDeps,
|
||||
Implicits: deps,
|
||||
Args: map[string]string{
|
||||
"cFlags": moduleCflags,
|
||||
"ccCmd": ccCmd,
|
||||
@@ -230,7 +236,6 @@ func TransformObjToStaticLib(ctx common.AndroidModuleContext, objFiles []string,
|
||||
Rule: ar,
|
||||
Outputs: []string{outputFile},
|
||||
Inputs: objFiles,
|
||||
Implicits: []string{arCmd},
|
||||
Args: map[string]string{
|
||||
"arFlags": arFlags,
|
||||
"arCmd": arCmd,
|
||||
@@ -337,7 +342,6 @@ func TransformObjToDynamicBinary(ctx common.AndroidModuleContext,
|
||||
ldDirs = append(ldDirs, dir)
|
||||
}
|
||||
|
||||
deps = append(deps, ldCmd)
|
||||
deps = append(deps, sharedLibs...)
|
||||
deps = append(deps, staticLibs...)
|
||||
deps = append(deps, lateStaticLibs...)
|
||||
@@ -368,13 +372,10 @@ func TransformObjsToObj(ctx common.AndroidModuleContext, objFiles []string,
|
||||
|
||||
ldCmd := gccCmd(flags.toolchain, "ld")
|
||||
|
||||
deps := []string{ldCmd}
|
||||
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: partialLd,
|
||||
Outputs: []string{outputFile},
|
||||
Inputs: objFiles,
|
||||
Implicits: deps,
|
||||
Args: map[string]string{
|
||||
"ldCmd": ldCmd,
|
||||
},
|
||||
@@ -391,7 +392,6 @@ func TransformBinaryPrefixSymbols(ctx common.AndroidModuleContext, prefix string
|
||||
Rule: prefixSymbols,
|
||||
Outputs: []string{outputFile},
|
||||
Inputs: []string{inputFile},
|
||||
Implicits: []string{objcopyCmd},
|
||||
Args: map[string]string{
|
||||
"objcopyCmd": objcopyCmd,
|
||||
"prefix": prefix,
|
||||
@@ -405,10 +405,6 @@ func CopyGccLib(ctx common.AndroidModuleContext, libName string,
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: copyGccLib,
|
||||
Outputs: []string{outputFile},
|
||||
Implicits: []string{
|
||||
"$copyGccLibPath",
|
||||
gccCmd(flags.toolchain, "gcc"),
|
||||
},
|
||||
Args: map[string]string{
|
||||
"ccCmd": gccCmd(flags.toolchain, "gcc"),
|
||||
"cFlags": flags.globalFlags,
|
||||
|
@@ -38,6 +38,7 @@ var (
|
||||
blueprint.RuleParams{
|
||||
Command: "BISON_PKGDATADIR=$yaccDataDir $yaccCmd -d $yaccFlags -o $cppFile $in && " +
|
||||
"cp -f $hppFile $hFile",
|
||||
CommandDeps: []string{"$yaccCmd"},
|
||||
Description: "yacc $out",
|
||||
},
|
||||
"yaccFlags", "cppFile", "hppFile", "hFile")
|
||||
@@ -45,6 +46,7 @@ var (
|
||||
lex = pctx.StaticRule("lex",
|
||||
blueprint.RuleParams{
|
||||
Command: "$lexCmd -o$out $in",
|
||||
CommandDeps: []string{"$lexCmd"},
|
||||
Description: "lex $out",
|
||||
})
|
||||
)
|
||||
@@ -60,7 +62,6 @@ func genYacc(ctx common.AndroidModuleContext, yaccFile, yaccFlags string) (cppFi
|
||||
Rule: yacc,
|
||||
Outputs: []string{cppFile, headerFile},
|
||||
Inputs: []string{yaccFile},
|
||||
Implicits: []string{"$yaccCmd"},
|
||||
Args: map[string]string{
|
||||
"yaccFlags": yaccFlags,
|
||||
"cppFile": cppFile,
|
||||
@@ -81,7 +82,6 @@ func genLex(ctx common.AndroidModuleContext, lexFile string) (cppFile string) {
|
||||
Rule: lex,
|
||||
Outputs: []string{cppFile},
|
||||
Inputs: []string{lexFile},
|
||||
Implicits: []string{"$lexCmd"},
|
||||
})
|
||||
|
||||
return cppFile
|
||||
|
@@ -33,6 +33,7 @@ var (
|
||||
androidbp = pctx.StaticRule("androidbp",
|
||||
blueprint.RuleParams{
|
||||
Command: androidbpCmd + " ${srcDir}/Android.bp $in $out",
|
||||
CommandDeps: []string{androidbpCmd},
|
||||
Description: "androidbp $out",
|
||||
})
|
||||
|
||||
|
@@ -46,6 +46,7 @@ var (
|
||||
globRule = pctx.StaticRule("globRule",
|
||||
blueprint.RuleParams{
|
||||
Command: fmt.Sprintf(`%s -o $out $excludes "$glob"`, globCmd),
|
||||
CommandDeps: []string{globCmd},
|
||||
Description: "glob $glob",
|
||||
|
||||
Restat: true,
|
||||
@@ -97,7 +98,6 @@ func GlobRule(ctx globContext, globPattern string, excludes []string,
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: globRule,
|
||||
Outputs: []string{fileListFile},
|
||||
Implicits: []string{globCmd},
|
||||
Args: map[string]string{
|
||||
"glob": globPattern,
|
||||
"excludes": JoinWithPrefixAndQuote(excludes, "-e "),
|
||||
|
@@ -573,7 +573,6 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx blueprint.SingletonConte
|
||||
Rule: androidbp,
|
||||
Outputs: []string{transMk},
|
||||
Inputs: []string{bpFile},
|
||||
Implicits: []string{androidbpCmd},
|
||||
Optional: true,
|
||||
})
|
||||
|
||||
|
@@ -34,6 +34,7 @@ var (
|
||||
`$aaptCmd package -m $aaptFlags -P $publicResourcesFile -G $proguardOptionsFile ` +
|
||||
`-J $javaDir || ( rm -rf "$javaDir/*"; exit 41 ) && ` +
|
||||
`find $javaDir -name "*.java" > $javaFileList`,
|
||||
CommandDeps: []string{"$aaptCmd"},
|
||||
Description: "aapt create R.java $out",
|
||||
},
|
||||
"aaptFlags", "publicResourcesFile", "proguardOptionsFile", "javaDir", "javaFileList")
|
||||
@@ -41,6 +42,7 @@ var (
|
||||
aaptCreateAssetsPackage = pctx.StaticRule("aaptCreateAssetsPackage",
|
||||
blueprint.RuleParams{
|
||||
Command: `rm -f $out && $aaptCmd package $aaptFlags -F $out`,
|
||||
CommandDeps: []string{"$aaptCmd"},
|
||||
Description: "aapt export package $out",
|
||||
},
|
||||
"aaptFlags", "publicResourcesFile", "proguardOptionsFile", "javaDir", "javaFileList")
|
||||
@@ -49,6 +51,7 @@ var (
|
||||
blueprint.RuleParams{
|
||||
// TODO: add-jni-shared-libs-to-package
|
||||
Command: `cp -f $in $out.tmp && $aaptCmd package -u $aaptFlags -F $out.tmp && mv $out.tmp $out`,
|
||||
CommandDeps: []string{"$aaptCmd"},
|
||||
Description: "aapt package $out",
|
||||
},
|
||||
"aaptFlags")
|
||||
@@ -56,6 +59,7 @@ var (
|
||||
zipalign = pctx.StaticRule("zipalign",
|
||||
blueprint.RuleParams{
|
||||
Command: `$zipalignCmd -f $zipalignFlags 4 $in $out`,
|
||||
CommandDeps: []string{"$zipalignCmd"},
|
||||
Description: "zipalign $out",
|
||||
},
|
||||
"zipalignFlags")
|
||||
@@ -63,6 +67,7 @@ var (
|
||||
signapk = pctx.StaticRule("signapk",
|
||||
blueprint.RuleParams{
|
||||
Command: `java -jar $signapkCmd $certificates $in $out`,
|
||||
CommandDeps: []string{"$signapkCmd"},
|
||||
Description: "signapk $out",
|
||||
},
|
||||
"certificates")
|
||||
@@ -71,6 +76,7 @@ var (
|
||||
blueprint.RuleParams{
|
||||
Command: "java -classpath $androidManifestMergerCmd com.android.manifmerger.Main merge " +
|
||||
"--main $in --libs $libsManifests --out $out",
|
||||
CommandDeps: []string{"$androidManifestMergerCmd"},
|
||||
Description: "merge manifest files $out",
|
||||
},
|
||||
"libsManifests")
|
||||
@@ -96,8 +102,6 @@ func CreateResourceJavaFiles(ctx common.AndroidModuleContext, flags []string,
|
||||
publicResourcesFile := filepath.Join(common.ModuleOutDir(ctx), "public_resources.xml")
|
||||
proguardOptionsFile := filepath.Join(common.ModuleOutDir(ctx), "proguard.options")
|
||||
|
||||
deps = append([]string{"$aaptCmd"}, deps...)
|
||||
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: aaptCreateResourceJavaFile,
|
||||
Outputs: []string{publicResourcesFile, proguardOptionsFile, javaFileList},
|
||||
@@ -117,8 +121,6 @@ func CreateResourceJavaFiles(ctx common.AndroidModuleContext, flags []string,
|
||||
func CreateExportPackage(ctx common.AndroidModuleContext, flags []string, deps []string) string {
|
||||
outputFile := filepath.Join(common.ModuleOutDir(ctx), "package-export.apk")
|
||||
|
||||
deps = append([]string{"$aaptCmd"}, deps...)
|
||||
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: aaptCreateAssetsPackage,
|
||||
Outputs: []string{outputFile},
|
||||
@@ -140,7 +142,6 @@ func CreateAppPackage(ctx common.AndroidModuleContext, flags []string, jarFile s
|
||||
Rule: aaptAddResources,
|
||||
Outputs: []string{resourceApk},
|
||||
Inputs: []string{jarFile},
|
||||
Implicits: []string{"$aaptCmd"},
|
||||
Args: map[string]string{
|
||||
"aaptFlags": strings.Join(flags, " "),
|
||||
},
|
||||
@@ -157,7 +158,6 @@ func CreateAppPackage(ctx common.AndroidModuleContext, flags []string, jarFile s
|
||||
Rule: signapk,
|
||||
Outputs: []string{signedApk},
|
||||
Inputs: []string{resourceApk},
|
||||
Implicits: []string{"$signapkCmd"},
|
||||
Args: map[string]string{
|
||||
"certificates": strings.Join(certificateArgs, " "),
|
||||
},
|
||||
@@ -169,7 +169,6 @@ func CreateAppPackage(ctx common.AndroidModuleContext, flags []string, jarFile s
|
||||
Rule: zipalign,
|
||||
Outputs: []string{outputFile},
|
||||
Inputs: []string{signedApk},
|
||||
Implicits: []string{"$zipalignCmd"},
|
||||
Args: map[string]string{
|
||||
"zipalignFlags": "",
|
||||
},
|
||||
|
@@ -52,6 +52,7 @@ var (
|
||||
jar = pctx.StaticRule("jar",
|
||||
blueprint.RuleParams{
|
||||
Command: `$jarCmd -o $out $jarArgs`,
|
||||
CommandDeps: []string{"$jarCmd"},
|
||||
Description: "jar $out",
|
||||
},
|
||||
"jarCmd", "jarArgs")
|
||||
@@ -61,6 +62,7 @@ var (
|
||||
Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` +
|
||||
`$dxCmd --dex --output=$outDir $dxFlags $in || ( rm -rf "$outDir"; exit 41 ) && ` +
|
||||
`find "$outDir" -name "classes*.dex" > $out`,
|
||||
CommandDeps: []string{"$dxCmd"},
|
||||
Description: "dex $out",
|
||||
},
|
||||
"outDir", "dxFlags")
|
||||
@@ -68,6 +70,7 @@ var (
|
||||
jarjar = pctx.StaticRule("jarjar",
|
||||
blueprint.RuleParams{
|
||||
Command: "java -jar $jarjarCmd process $rulesFile $in $out",
|
||||
CommandDeps: []string{"$jarjarCmd", "$rulesFile"},
|
||||
Description: "jarjar $out",
|
||||
},
|
||||
"rulesFile")
|
||||
@@ -156,8 +159,6 @@ func TransformClassesToJar(ctx common.AndroidModuleContext, classes []jarSpec,
|
||||
jarArgs = append(jarArgs, "-m "+manifest)
|
||||
}
|
||||
|
||||
deps = append(deps, "$jarCmd")
|
||||
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: jar,
|
||||
Outputs: []string{outputFile},
|
||||
@@ -180,7 +181,6 @@ func TransformClassesJarToDex(ctx common.AndroidModuleContext, classesJar string
|
||||
Rule: dx,
|
||||
Outputs: []string{outputFile},
|
||||
Inputs: []string{classesJar},
|
||||
Implicits: []string{"$dxCmd"},
|
||||
Args: map[string]string{
|
||||
"dxFlags": flags.dxFlags,
|
||||
"outDir": outDir,
|
||||
@@ -205,8 +205,6 @@ func TransformDexToJavaLib(ctx common.AndroidModuleContext, resources []jarSpec,
|
||||
deps = append(deps, dexJarSpec.fileList)
|
||||
jarArgs = append(jarArgs, dexJarSpec.soongJarArgs())
|
||||
|
||||
deps = append(deps, "$jarCmd")
|
||||
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: jar,
|
||||
Outputs: []string{outputFile},
|
||||
@@ -225,7 +223,6 @@ func TransformJarJar(ctx common.AndroidModuleContext, classesJar string, rulesFi
|
||||
Rule: jarjar,
|
||||
Outputs: []string{outputFile},
|
||||
Inputs: []string{classesJar},
|
||||
Implicits: []string{"$jarjarCmd"},
|
||||
Args: map[string]string{
|
||||
"rulesFile": rulesFile,
|
||||
},
|
||||
|
@@ -44,6 +44,7 @@ var (
|
||||
aidl = pctx.StaticRule("aidl",
|
||||
blueprint.RuleParams{
|
||||
Command: "$aidlCmd -d$depFile $aidlFlags $in $out",
|
||||
CommandDeps: []string{"$aidlCmd"},
|
||||
Description: "aidl $out",
|
||||
},
|
||||
"depFile", "aidlFlags")
|
||||
@@ -51,12 +52,14 @@ var (
|
||||
logtags = pctx.StaticRule("logtags",
|
||||
blueprint.RuleParams{
|
||||
Command: "$logtagsCmd -o $out $in $allLogtagsFile",
|
||||
CommandDeps: []string{"$logtagsCmd"},
|
||||
Description: "logtags $out",
|
||||
})
|
||||
|
||||
mergeLogtags = pctx.StaticRule("mergeLogtags",
|
||||
blueprint.RuleParams{
|
||||
Command: "$mergeLogtagsCmd -o $out $in",
|
||||
CommandDeps: []string{"$mergeLogtagsCmd"},
|
||||
Description: "merge logtags $out",
|
||||
})
|
||||
)
|
||||
@@ -71,7 +74,6 @@ func genAidl(ctx common.AndroidModuleContext, aidlFile, aidlFlags string) string
|
||||
Rule: aidl,
|
||||
Outputs: []string{javaFile},
|
||||
Inputs: []string{aidlFile},
|
||||
Implicits: []string{"$aidlCmd"},
|
||||
Args: map[string]string{
|
||||
"depFile": depFile,
|
||||
"aidlFlags": aidlFlags,
|
||||
@@ -90,7 +92,6 @@ func genLogtags(ctx common.AndroidModuleContext, logtagsFile string) string {
|
||||
Rule: logtags,
|
||||
Outputs: []string{javaFile},
|
||||
Inputs: []string{logtagsFile},
|
||||
Implicits: []string{"$logtagsCmd"},
|
||||
})
|
||||
|
||||
return javaFile
|
||||
|
Reference in New Issue
Block a user