diff options
author | Colin Cross <ccross@android.com> | 2019-03-04 22:35:41 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2019-03-07 18:36:35 +0000 |
commit | 27b922f53e938896c0a693a1d9f50e6c9e686ad7 (patch) | |
tree | d3383cbdebb9fb78d8d96fa3a3023764620d483e /android | |
parent | 1b48842a4b83ba6234d26ff4c77a0884f5008f62 (diff) | |
download | build_soong-27b922f53e938896c0a693a1d9f50e6c9e686ad7.tar.gz build_soong-27b922f53e938896c0a693a1d9f50e6c9e686ad7.tar.bz2 build_soong-27b922f53e938896c0a693a1d9f50e6c9e686ad7.zip |
Annotate paths and deprecate ExtractSource(s)Deps
Add `android:"path"` to all properties that take paths to source
files, and remove the calls to ExtractSource(s)Deps, the
pathsDepsMutator will add the necessary SourceDepTag dependency.
Test: All soong tests
Change-Id: I488ba1a5d680aaa50b04fc38acf693e23c6d4d6d
Diffstat (limited to 'android')
-rw-r--r-- | android/filegroup.go | 9 | ||||
-rw-r--r-- | android/module.go | 22 | ||||
-rw-r--r-- | android/mutator.go | 5 | ||||
-rw-r--r-- | android/prebuilt.go | 3 | ||||
-rw-r--r-- | android/prebuilt_etc.go | 5 | ||||
-rw-r--r-- | android/prebuilt_test.go | 2 | ||||
-rw-r--r-- | android/sh_binary.go | 5 |
7 files changed, 18 insertions, 33 deletions
diff --git a/android/filegroup.go b/android/filegroup.go index b284ce02..76af804b 100644 --- a/android/filegroup.go +++ b/android/filegroup.go @@ -26,9 +26,9 @@ func init() { type fileGroupProperties struct { // srcs lists files that will be included in this filegroup - Srcs []string + Srcs []string `android:"path"` - Exclude_srcs []string + Exclude_srcs []string `android:"path"` // The base path to the files. May be used by other modules to determine which portion // of the path to use. For example, when a filegroup is used as data in a cc_test rule, @@ -59,11 +59,6 @@ func FileGroupFactory() Module { return module } -func (fg *fileGroup) DepsMutator(ctx BottomUpMutatorContext) { - ExtractSourcesDeps(ctx, fg.properties.Srcs) - ExtractSourcesDeps(ctx, fg.properties.Exclude_srcs) -} - func (fg *fileGroup) GenerateAndroidBuildActions(ctx ModuleContext) { fg.srcs = ctx.ExpandSourcesSubDir(fg.properties.Srcs, fg.properties.Exclude_srcs, String(fg.properties.Path)) } diff --git a/android/module.go b/android/module.go index 1e6cc838..64fbdacc 100644 --- a/android/module.go +++ b/android/module.go @@ -260,16 +260,16 @@ type commonProperties struct { Recovery *bool // init.rc files to be installed if this module is installed - Init_rc []string + Init_rc []string `android:"path"` // VINTF manifest fragments to be installed if this module is installed - Vintf_fragments []string + Vintf_fragments []string `android:"path"` // names of other modules to install if this module is installed Required []string `android:"arch_variant"` // relative path to a file to include in the list of notices for the device - Notice *string + Notice *string `android:"path"` Dist struct { // copy the output of this module to the $DIST_DIR when `dist` is specified on the @@ -1358,6 +1358,8 @@ var SourceDepTag sourceDependencyTag // Adds necessary dependencies to satisfy filegroup or generated sources modules listed in srcFiles // using ":module" syntax, if any. +// +// Deprecated: tag the property with `android:"path"` instead. func ExtractSourcesDeps(ctx BottomUpMutatorContext, srcFiles []string) { var deps []string set := make(map[string]bool) @@ -1378,6 +1380,8 @@ func ExtractSourcesDeps(ctx BottomUpMutatorContext, srcFiles []string) { // Adds necessary dependencies to satisfy filegroup or generated sources modules specified in s // using ":module" syntax, if any. +// +// Deprecated: tag the property with `android:"path"` instead. func ExtractSourceDeps(ctx BottomUpMutatorContext, s *string) { if s != nil { if m := SrcIsModule(*s); m != "" { @@ -1390,14 +1394,14 @@ type SourceFileProducer interface { Srcs() Paths } -// Returns a list of paths expanded from globs and modules referenced using ":module" syntax. -// ExtractSourcesDeps must have already been called during the dependency resolution phase. +// Returns a list of paths expanded from globs and modules referenced using ":module" syntax. The property must +// be tagged with `android:"path" to support automatic source module dependency resolution. func (ctx *androidModuleContext) ExpandSources(srcFiles, excludes []string) Paths { return ctx.ExpandSourcesSubDir(srcFiles, excludes, "") } -// Returns a single path expanded from globs and modules referenced using ":module" syntax. -// ExtractSourceDeps must have already been called during the dependency resolution phase. +// Returns a single path expanded from globs and modules referenced using ":module" syntax. The property must +// be tagged with `android:"path" to support automatic source module dependency resolution. func (ctx *androidModuleContext) ExpandSource(srcFile, prop string) Path { srcFiles := ctx.ExpandSourcesSubDir([]string{srcFile}, nil, "") if len(srcFiles) == 1 { @@ -1416,8 +1420,8 @@ func (ctx *androidModuleContext) ExpandSource(srcFile, prop string) Path { } // Returns an optional single path expanded from globs and modules referenced using ":module" syntax if -// the srcFile is non-nil. -// ExtractSourceDeps must have already been called during the dependency resolution phase. +// the srcFile is non-nil. The property must be tagged with `android:"path" to support automatic source module +// dependency resolution. func (ctx *androidModuleContext) ExpandOptionalSource(srcFile *string, prop string) OptionalPath { if srcFile != nil { return OptionalPathForPath(ctx.ExpandSource(*srcFile, prop)) diff --git a/android/mutator.go b/android/mutator.go index cd1a2d54..6c9f17a3 100644 --- a/android/mutator.go +++ b/android/mutator.go @@ -212,11 +212,6 @@ func (mutator *mutator) Parallel() MutatorHandle { func depsMutator(ctx BottomUpMutatorContext) { if m, ok := ctx.Module().(Module); ok && m.Enabled() { m.DepsMutator(ctx) - - // For filegroup-based notice file references. - if m.base().commonProperties.Notice != nil { - ExtractSourceDeps(ctx, m.base().commonProperties.Notice) - } } } diff --git a/android/prebuilt.go b/android/prebuilt.go index 47c5cf53..ea4870dd 100644 --- a/android/prebuilt.go +++ b/android/prebuilt.go @@ -137,9 +137,6 @@ func PrebuiltPostDepsMutator(ctx BottomUpMutatorContext) { } else { m.SkipInstall() } - if len(*p.srcs) > 0 { - ExtractSourceDeps(ctx, &(*p.srcs)[0]) - } } } diff --git a/android/prebuilt_etc.go b/android/prebuilt_etc.go index c58cc4f8..6c8fb314 100644 --- a/android/prebuilt_etc.go +++ b/android/prebuilt_etc.go @@ -35,7 +35,7 @@ func init() { type prebuiltEtcProperties struct { // Source file of this prebuilt. - Src *string `android:"arch_variant"` + Src *string `android:"path,arch_variant"` // optional subdirectory under which this file is installed into Sub_dir *string `android:"arch_variant"` @@ -85,9 +85,6 @@ func (p *PrebuiltEtc) DepsMutator(ctx BottomUpMutatorContext) { if p.properties.Src == nil { ctx.PropertyErrorf("src", "missing prebuilt source file") } - - // To support ":modulename" in src - ExtractSourceDeps(ctx, p.properties.Src) } func (p *PrebuiltEtc) SourceFilePath(ctx ModuleContext) Path { diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go index b30ca1a5..319c15df 100644 --- a/android/prebuilt_test.go +++ b/android/prebuilt_test.go @@ -196,7 +196,7 @@ type prebuiltModule struct { ModuleBase prebuilt Prebuilt properties struct { - Srcs []string + Srcs []string `android:"path"` } } diff --git a/android/sh_binary.go b/android/sh_binary.go index 39151939..eaedc9fd 100644 --- a/android/sh_binary.go +++ b/android/sh_binary.go @@ -32,7 +32,7 @@ func init() { type shBinaryProperties struct { // Source file of this prebuilt. - Src *string `android:"arch_variant"` + Src *string `android:"path,arch_variant"` // optional subdirectory under which this file is installed into Sub_dir *string `android:"arch_variant"` @@ -61,9 +61,6 @@ func (s *ShBinary) DepsMutator(ctx BottomUpMutatorContext) { if s.properties.Src == nil { ctx.PropertyErrorf("src", "missing prebuilt source file") } - - // To support ":modulename" in src - ExtractSourceDeps(ctx, s.properties.Src) } func (s *ShBinary) SourceFilePath(ctx ModuleContext) Path { |