Add DistPath to reference the dist folder
Instead of open-coding the logic of whether there is one, or where to
find it.
Test: diff out/soong/build.ninja without dist
Test: diff out/soong/build.ninja with dist specified
Change-Id: Ia3f1ef335e2d6e2175343338d04867d778a50300
diff --git a/cc/builder.go b/cc/builder.go
index 142a326..7543915 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -200,10 +200,9 @@
func(ctx android.PackageRuleContext) blueprint.RuleParams {
commandStr := "($sAbiDiffer $allowFlags -lib $libName -arch $arch -check-all-apis -o ${out} -new $in -old $referenceDump)"
- distDir := ctx.Config().ProductVariables.DistDir
- if distDir != nil && *distDir != "" {
- distAbiDiffDir := *distDir + "/abidiffs/"
- commandStr += " || (mkdir -p " + distAbiDiffDir + " && cp ${out} " + distAbiDiffDir + " && exit 1)"
+ distAbiDiffDir := android.PathForDist(ctx, "abidiffs")
+ if distAbiDiffDir.Valid() {
+ commandStr += " || (mkdir -p " + distAbiDiffDir.String() + " && cp ${out} " + distAbiDiffDir.String() + " && exit 1)"
}
return blueprint.RuleParams{
Command: commandStr,