Merge "Move fuzz phony to be make-defined, and add to dist."

This commit is contained in:
Treehugger Robot
2019-09-30 20:24:19 +00:00
committed by Gerrit Code Review

View File

@@ -16,8 +16,8 @@ package cc
import (
"path/filepath"
"strings"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
@@ -161,6 +161,7 @@ func NewFuzz(hod android.HostOrDeviceSupported) *Module {
// Responsible for generating GNU Make rules that package fuzz targets into
// their architecture & target/host specific zip file.
type fuzzPackager struct {
packages android.Paths
}
func fuzzPackagingFactory() android.Singleton {
@@ -220,15 +221,12 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
}
})
// List of architecture + host/device specific packages to build via. 'make fuzz'.
var archDirTargets android.Paths
for archDir, filesToZip := range archDirs {
arch := archDir.Base()
hostOrTarget := filepath.Base(filepath.Dir(archDir.String()))
builder := android.NewRuleBuilder()
outputFile := android.PathForOutput(ctx, "fuzz-"+hostOrTarget+"-"+arch+".zip")
archDirTargets = append(archDirTargets, outputFile)
s.packages = append(s.packages, outputFile)
command := builder.Command().BuiltTool(ctx, "soong_zip").
Flag("-j").
@@ -242,11 +240,12 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
builder.Build(pctx, ctx, "create-fuzz-package-"+arch+"-"+hostOrTarget,
"Create fuzz target packages for "+arch+"-"+hostOrTarget)
}
ctx.Build(pctx, android.BuildParams{
Rule: blueprint.Phony,
Output: android.PathForPhony(ctx, "fuzz"),
Implicits: archDirTargets,
Description: "Build all Android fuzz targets, and create packages.",
})
}
func (s *fuzzPackager) MakeVars(ctx android.MakeVarsContext) {
// TODO(mitchp): Migrate this to use MakeVarsContext::DistForGoal() when it's
// ready to handle phony targets created in Soong. In the meantime, this
// exports the phony 'fuzz' target and dependencies on packages to
// core/main.mk so that we can use dist-for-goals.
ctx.Strict("SOONG_FUZZ_PACKAGING_ARCH_MODULES", strings.Join(s.packages.Strings(), " "))
}