Remove SymlinkOutputs
symlink_outputs was added so bazel could run ninja files, but we abanoned that approach in roboleaf, and then roboleaf was cancelled entirely. Remove this feature so we're more compatible with upstream ninja / n2. Bug: 160568334 Test: Presubmits Change-Id: Ic368c48dd01b68e51c471c3fe90d0c02c55956e9
This commit is contained in:
@@ -16,11 +16,12 @@ package android
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
// BuildParameters describes the set of potential parameters to build a Ninja rule.
|
||||
@@ -44,10 +45,6 @@ type BuildParams struct {
|
||||
// Outputs is a slice of output file of the action. When using this field, references to $out in
|
||||
// the Ninja command will refer to these files.
|
||||
Outputs WritablePaths
|
||||
// SymlinkOutput is an output file specifically that is a symlink.
|
||||
SymlinkOutput WritablePath
|
||||
// SymlinkOutputs is a slice of output files specifically that is a symlink.
|
||||
SymlinkOutputs WritablePaths
|
||||
// ImplicitOutput is an output file generated by the action. Note: references to `$out` in the
|
||||
// Ninja command will NOT include references to this file.
|
||||
ImplicitOutput WritablePath
|
||||
@@ -255,25 +252,6 @@ func (m *moduleContext) ModuleBuild(pctx PackageContext, params ModuleBuildParam
|
||||
m.Build(pctx, BuildParams(params))
|
||||
}
|
||||
|
||||
func validateBuildParams(params blueprint.BuildParams) error {
|
||||
// Validate that the symlink outputs are declared outputs or implicit outputs
|
||||
allOutputs := map[string]bool{}
|
||||
for _, output := range params.Outputs {
|
||||
allOutputs[output] = true
|
||||
}
|
||||
for _, output := range params.ImplicitOutputs {
|
||||
allOutputs[output] = true
|
||||
}
|
||||
for _, symlinkOutput := range params.SymlinkOutputs {
|
||||
if !allOutputs[symlinkOutput] {
|
||||
return fmt.Errorf(
|
||||
"Symlink output %s is not a declared output or implicit output",
|
||||
symlinkOutput)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert build parameters from their concrete Android types into their string representations,
|
||||
// and combine the singular and plural fields of the same type (e.g. Output and Outputs).
|
||||
func convertBuildParams(params BuildParams) blueprint.BuildParams {
|
||||
@@ -283,7 +261,6 @@ func convertBuildParams(params BuildParams) blueprint.BuildParams {
|
||||
Deps: params.Deps,
|
||||
Outputs: params.Outputs.Strings(),
|
||||
ImplicitOutputs: params.ImplicitOutputs.Strings(),
|
||||
SymlinkOutputs: params.SymlinkOutputs.Strings(),
|
||||
Inputs: params.Inputs.Strings(),
|
||||
Implicits: params.Implicits.Strings(),
|
||||
OrderOnly: params.OrderOnly.Strings(),
|
||||
@@ -298,9 +275,6 @@ func convertBuildParams(params BuildParams) blueprint.BuildParams {
|
||||
if params.Output != nil {
|
||||
bparams.Outputs = append(bparams.Outputs, params.Output.String())
|
||||
}
|
||||
if params.SymlinkOutput != nil {
|
||||
bparams.SymlinkOutputs = append(bparams.SymlinkOutputs, params.SymlinkOutput.String())
|
||||
}
|
||||
if params.ImplicitOutput != nil {
|
||||
bparams.ImplicitOutputs = append(bparams.ImplicitOutputs, params.ImplicitOutput.String())
|
||||
}
|
||||
@@ -316,7 +290,6 @@ func convertBuildParams(params BuildParams) blueprint.BuildParams {
|
||||
|
||||
bparams.Outputs = proptools.NinjaEscapeList(bparams.Outputs)
|
||||
bparams.ImplicitOutputs = proptools.NinjaEscapeList(bparams.ImplicitOutputs)
|
||||
bparams.SymlinkOutputs = proptools.NinjaEscapeList(bparams.SymlinkOutputs)
|
||||
bparams.Inputs = proptools.NinjaEscapeList(bparams.Inputs)
|
||||
bparams.Implicits = proptools.NinjaEscapeList(bparams.Implicits)
|
||||
bparams.OrderOnly = proptools.NinjaEscapeList(bparams.OrderOnly)
|
||||
@@ -374,13 +347,6 @@ func (m *moduleContext) Build(pctx PackageContext, params BuildParams) {
|
||||
}
|
||||
|
||||
bparams := convertBuildParams(params)
|
||||
err := validateBuildParams(bparams)
|
||||
if err != nil {
|
||||
m.ModuleErrorf(
|
||||
"%s: build parameter validation failed: %s",
|
||||
m.ModuleName(),
|
||||
err.Error())
|
||||
}
|
||||
m.bp.Build(pctx.PackageContext, bparams)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user