Add missing soong_docs inputs
Specifically, make Android.bp.list and soong.variables explicit inputs While this is not a comprehensive list of all inputs of this action (as the action depends on all blueprint files in the source tree), this is closer to the truth. This is a rollforward CL, which was originally rolled back, as path validation failed for when OUT_DIR was an absolute path. Validation has now been relaxed. Test: Manually verified ninja output, checkbuild approved validation for aosp-crosshatch, and manually ran frameworks/rs/build_rs.py with patch fix Change-Id: I4eb0d517f57336dd54eaa4bd31f46df9e93e6da2
This commit is contained in:
parent
ec215e074e
commit
8f232a2702
5 changed files with 34 additions and 6 deletions
|
@ -93,8 +93,9 @@ type config struct {
|
|||
|
||||
deviceConfig *deviceConfig
|
||||
|
||||
srcDir string // the path of the root source directory
|
||||
buildDir string // the path of the build output directory
|
||||
srcDir string // the path of the root source directory
|
||||
buildDir string // the path of the build output directory
|
||||
moduleListFile string // the path to the file which lists blueprint files to parse.
|
||||
|
||||
env map[string]string
|
||||
envLock sync.Mutex
|
||||
|
@ -316,7 +317,7 @@ func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[st
|
|||
|
||||
// New creates a new Config object. The srcDir argument specifies the path to
|
||||
// the root source directory. It also loads the config file, if found.
|
||||
func NewConfig(srcDir, buildDir string) (Config, error) {
|
||||
func NewConfig(srcDir, buildDir string, moduleListFile string) (Config, error) {
|
||||
// Make a config with default options
|
||||
config := &config{
|
||||
ConfigFileName: filepath.Join(buildDir, configFileName),
|
||||
|
@ -328,7 +329,8 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
|
|||
buildDir: buildDir,
|
||||
multilibConflicts: make(map[ArchType]bool),
|
||||
|
||||
fs: pathtools.NewOsFs(absSrcDir),
|
||||
moduleListFile: moduleListFile,
|
||||
fs: pathtools.NewOsFs(absSrcDir),
|
||||
}
|
||||
|
||||
config.deviceConfig = &deviceConfig{
|
||||
|
|
|
@ -904,6 +904,22 @@ func (p OutputPath) buildDir() string {
|
|||
var _ Path = OutputPath{}
|
||||
var _ WritablePath = OutputPath{}
|
||||
|
||||
// toolDepPath is a Path representing a dependency of the build tool.
|
||||
type toolDepPath struct {
|
||||
basePath
|
||||
}
|
||||
|
||||
var _ Path = toolDepPath{}
|
||||
|
||||
// pathForBuildToolDep returns a toolDepPath representing the given path string.
|
||||
// There is no validation for the path, as it is "trusted": It may fail
|
||||
// normal validation checks. For example, it may be an absolute path.
|
||||
// Only use this function to construct paths for dependencies of the build
|
||||
// tool invocation.
|
||||
func pathForBuildToolDep(ctx PathContext, path string) toolDepPath {
|
||||
return toolDepPath{basePath{path, ctx.Config(), ""}}
|
||||
}
|
||||
|
||||
// PathForOutput joins the provided paths and returns an OutputPath that is
|
||||
// validated to not escape the build dir.
|
||||
// On error, it will return a usable, but invalid OutputPath, and report a ModuleError.
|
||||
|
|
|
@ -44,6 +44,10 @@ func primaryBuilderPath(ctx SingletonContext) Path {
|
|||
}
|
||||
|
||||
func (c *docsSingleton) GenerateBuildActions(ctx SingletonContext) {
|
||||
var deps Paths
|
||||
deps = append(deps, pathForBuildToolDep(ctx, ctx.Config().moduleListFile))
|
||||
deps = append(deps, pathForBuildToolDep(ctx, ctx.Config().ProductVariablesFileName))
|
||||
|
||||
// Generate build system docs for the primary builder. Generating docs reads the source
|
||||
// files used to build the primary builder, but that dependency will be picked up through
|
||||
// the dependency on the primary builder itself. There are no dependencies on the
|
||||
|
@ -63,6 +67,7 @@ func (c *docsSingleton) GenerateBuildActions(ctx SingletonContext) {
|
|||
ctx.Build(pctx, BuildParams{
|
||||
Rule: soongDocs,
|
||||
Output: docsFile,
|
||||
Inputs: deps,
|
||||
Args: map[string]string{
|
||||
"outDir": PathForOutput(ctx, "docs").String(),
|
||||
},
|
||||
|
|
|
@ -59,7 +59,7 @@ func main() {
|
|||
ctx := android.NewContext()
|
||||
ctx.Register()
|
||||
|
||||
configuration, err := android.NewConfig(srcDir, bootstrap.BuildDir)
|
||||
configuration, err := android.NewConfig(srcDir, bootstrap.BuildDir, bootstrap.ModuleListFile)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s", err)
|
||||
os.Exit(1)
|
||||
|
|
|
@ -66,6 +66,8 @@ func testForDanglingRules(ctx Context, config Config) {
|
|||
outDir := config.OutDir()
|
||||
bootstrapDir := filepath.Join(outDir, "soong", ".bootstrap")
|
||||
miniBootstrapDir := filepath.Join(outDir, "soong", ".minibootstrap")
|
||||
modulePathsDir := filepath.Join(outDir, ".module_paths")
|
||||
variablesFilePath := filepath.Join(outDir, "soong", "soong.variables")
|
||||
|
||||
danglingRules := make(map[string]bool)
|
||||
|
||||
|
@ -76,7 +78,10 @@ func testForDanglingRules(ctx Context, config Config) {
|
|||
// Leaf node is not in the out directory.
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(line, bootstrapDir) || strings.HasPrefix(line, miniBootstrapDir) {
|
||||
if strings.HasPrefix(line, bootstrapDir) ||
|
||||
strings.HasPrefix(line, miniBootstrapDir) ||
|
||||
strings.HasPrefix(line, modulePathsDir) ||
|
||||
line == variablesFilePath {
|
||||
// Leaf node is in one of Soong's bootstrap directories, which do not have
|
||||
// full build rules in the primary build.ninja file.
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue