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
This commit is contained in:
Colin Cross
2019-03-04 22:35:41 -08:00
parent 1b48842a4b
commit 27b922f53e
23 changed files with 83 additions and 236 deletions

View File

@@ -31,11 +31,11 @@ type BaseCompilerProperties struct {
// list of source files used to compile the C/C++ module. May be .c, .cpp, or .S files.
// srcs may reference the outputs of other modules that produce source files like genrule
// or filegroup using the syntax ":module".
Srcs []string `android:"arch_variant"`
Srcs []string `android:"path,arch_variant"`
// list of source files that should not be used to build the C/C++ module.
// This is most useful in the arch/multilib variants to remove non-common files
Exclude_srcs []string `android:"arch_variant"`
Exclude_srcs []string `android:"path,arch_variant"`
// list of module-specific flags that will be used for C and C++ compiles.
Cflags []string `android:"arch_variant"`
@@ -136,11 +136,11 @@ type BaseCompilerProperties struct {
Vendor struct {
// list of source files that should only be used in the
// vendor variant of the C/C++ module.
Srcs []string
Srcs []string `android:"path"`
// list of source files that should not be used to
// build the vendor variant of the C/C++ module.
Exclude_srcs []string
Exclude_srcs []string `android:"path"`
// List of additional cflags that should be used to build the vendor
// variant of the C/C++ module.
@@ -149,11 +149,11 @@ type BaseCompilerProperties struct {
Recovery struct {
// list of source files that should only be used in the
// recovery variant of the C/C++ module.
Srcs []string
Srcs []string `android:"path"`
// list of source files that should not be used to
// build the recovery variant of the C/C++ module.
Exclude_srcs []string
Exclude_srcs []string `android:"path"`
// List of additional cflags that should be used to build the recovery
// variant of the C/C++ module.
@@ -221,9 +221,6 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps {
deps.GeneratedSources = append(deps.GeneratedSources, compiler.Properties.Generated_sources...)
deps.GeneratedHeaders = append(deps.GeneratedHeaders, compiler.Properties.Generated_headers...)
android.ExtractSourcesDeps(ctx, compiler.Properties.Srcs)
android.ExtractSourcesDeps(ctx, compiler.Properties.Exclude_srcs)
if compiler.hasSrcExt(".proto") {
deps = protoDeps(ctx, deps, &compiler.Proto, Bool(compiler.Properties.Proto.Static))
}

View File

@@ -30,8 +30,8 @@ import (
)
type StaticSharedLibraryProperties struct {
Srcs []string `android:"arch_variant"`
Cflags []string `android:"arch_variant"`
Srcs []string `android:"path,arch_variant"`
Cflags []string `android:"path,arch_variant"`
Enabled *bool `android:"arch_variant"`
Whole_static_libs []string `android:"arch_variant"`
@@ -48,11 +48,11 @@ type LibraryProperties struct {
Shared StaticSharedLibraryProperties `android:"arch_variant"`
// local file name to pass to the linker as -unexported_symbols_list
Unexported_symbols_list *string `android:"arch_variant"`
Unexported_symbols_list *string `android:"path,arch_variant"`
// local file name to pass to the linker as -force_symbols_not_weak_list
Force_symbols_not_weak_list *string `android:"arch_variant"`
Force_symbols_not_weak_list *string `android:"path,arch_variant"`
// local file name to pass to the linker as -force_symbols_weak_list
Force_symbols_weak_list *string `android:"arch_variant"`
Force_symbols_weak_list *string `android:"path,arch_variant"`
// rename host libraries to prevent overlap with system installed libraries
Unique_host_soname *bool
@@ -77,7 +77,7 @@ type LibraryProperties struct {
Stubs struct {
// Relative path to the symbol map. The symbol map provides the list of
// symbols that are exported for stubs variant of this library.
Symbol_file *string
Symbol_file *string `android:"path"`
// List versions to generate stubs libs for.
Versions []string
@@ -97,7 +97,7 @@ type LibraryProperties struct {
Header_abi_checker struct {
// Path to a symbol file that specifies the symbols to be included in the generated
// ABI dump file
Symbol_file *string
Symbol_file *string `android:"path"`
// Symbol versions that should be ignored from the symbol file
Exclude_symbol_versions []string
@@ -526,12 +526,6 @@ func (library *libraryDecorator) linkerInit(ctx BaseModuleContext) {
func (library *libraryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
deps = library.baseCompiler.compilerDeps(ctx, deps)
if library.static() {
android.ExtractSourcesDeps(ctx, library.Properties.Static.Srcs)
} else if library.shared() {
android.ExtractSourcesDeps(ctx, library.Properties.Shared.Srcs)
}
return deps
}
@@ -596,10 +590,6 @@ func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
deps.ReexportStaticLibHeaders = removeListFromList(deps.ReexportStaticLibHeaders, library.baseLinker.Properties.Target.Recovery.Exclude_static_libs)
}
android.ExtractSourceDeps(ctx, library.Properties.Unexported_symbols_list)
android.ExtractSourceDeps(ctx, library.Properties.Force_symbols_not_weak_list)
android.ExtractSourceDeps(ctx, library.Properties.Force_symbols_weak_list)
return deps
}

View File

@@ -149,7 +149,7 @@ type BaseLinkerProperties struct {
Pack_relocations *bool `android:"arch_variant"`
// local file name to pass to the linker as --version_script
Version_script *string `android:"arch_variant"`
Version_script *string `android:"path,arch_variant"`
// Local file name to pass to the linker as --symbol-ordering-file
Symbol_ordering_file *string `android:"arch_variant"`
@@ -281,16 +281,6 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
deps.LateStaticLibs = append(deps.LateStaticLibs, "libwinpthread")
}
// Version_script is not needed when linking stubs lib where the version
// script is created from the symbol map file.
if !linker.dynamicProperties.BuildStubs {
android.ExtractSourceDeps(ctx, linker.Properties.Version_script)
android.ExtractSourceDeps(ctx,
linker.Properties.Target.Vendor.Version_script)
}
android.ExtractSourceDeps(ctx, linker.Properties.Symbol_ordering_file)
return deps
}

View File

@@ -70,13 +70,13 @@ type headerProperties struct {
To *string
// List of headers to install. Glob compatible. Common case is "include/**/*.h".
Srcs []string
Srcs []string `android:"path"`
// Source paths that should be excluded from the srcs glob.
Exclude_srcs []string
Exclude_srcs []string `android:"path"`
// Path to the NOTICE file associated with the headers.
License *string
License *string `android:"path"`
// True if this API is not yet ready to be shipped in the NDK. It will be
// available in the platform for testing, but will be excluded from the

View File

@@ -33,7 +33,7 @@ type prebuiltLinker struct {
android.Prebuilt
properties struct {
Srcs []string `android:"arch_variant"`
Srcs []string `android:"path,arch_variant"`
// Check the prebuilt ELF files (e.g. DT_SONAME, DT_NEEDED, resolution of undefined
// symbols, etc), default true.

View File

@@ -42,7 +42,7 @@ type TestBinaryProperties struct {
// list of files or filegroup modules that provide data that should be installed alongside
// the test
Data []string
Data []string `android:"path"`
// list of compatibility suites (for example "cts", "vts") that the module should be
// installed into.
@@ -50,11 +50,11 @@ type TestBinaryProperties struct {
// the name of the test configuration (for example "AndroidTest.xml") that should be
// installed with the module.
Test_config *string `android:"arch_variant"`
Test_config *string `android:"path,arch_variant"`
// the name of the test configuration template (for example "AndroidTestTemplate.xml") that
// should be installed with the module.
Test_config_template *string `android:"arch_variant"`
Test_config_template *string `android:"path,arch_variant"`
}
func init() {
@@ -241,10 +241,6 @@ func (test *testBinary) linkerInit(ctx BaseModuleContext) {
}
func (test *testBinary) linkerDeps(ctx DepsContext, deps Deps) Deps {
android.ExtractSourcesDeps(ctx, test.Properties.Data)
android.ExtractSourceDeps(ctx, test.Properties.Test_config)
android.ExtractSourceDeps(ctx, test.Properties.Test_config_template)
deps = test.testDecorator.linkerDeps(ctx, deps)
deps = test.binaryDecorator.linkerDeps(ctx, deps)
return deps
@@ -338,7 +334,7 @@ func NewTestLibrary(hod android.HostOrDeviceSupported) *Module {
type BenchmarkProperties struct {
// list of files or filegroup modules that provide data that should be installed alongside
// the test
Data []string
Data []string `android:"path"`
// list of compatibility suites (for example "cts", "vts") that the module should be
// installed into.
@@ -346,11 +342,11 @@ type BenchmarkProperties struct {
// the name of the test configuration (for example "AndroidTest.xml") that should be
// installed with the module.
Test_config *string `android:"arch_variant"`
Test_config *string `android:"path,arch_variant"`
// the name of the test configuration template (for example "AndroidTestTemplate.xml") that
// should be installed with the module.
Test_config_template *string `android:"arch_variant"`
Test_config_template *string `android:"path,arch_variant"`
}
type benchmarkDecorator struct {
@@ -376,10 +372,6 @@ func (benchmark *benchmarkDecorator) linkerProps() []interface{} {
}
func (benchmark *benchmarkDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
android.ExtractSourcesDeps(ctx, benchmark.Properties.Data)
android.ExtractSourceDeps(ctx, benchmark.Properties.Test_config)
android.ExtractSourceDeps(ctx, benchmark.Properties.Test_config_template)
deps = benchmark.binaryDecorator.linkerDeps(ctx, deps)
deps.StaticLibs = append(deps.StaticLibs, "libgoogle-benchmark")
return deps

View File

@@ -166,7 +166,7 @@ type testDataTest struct {
android.ModuleBase
data android.Paths
Properties struct {
Data []string
Data []string `android:"path"`
}
}
@@ -177,10 +177,6 @@ func newTest() android.Module {
return m
}
func (test *testDataTest) DepsMutator(ctx android.BottomUpMutatorContext) {
android.ExtractSourcesDeps(ctx, test.Properties.Data)
}
func (test *testDataTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
test.data = ctx.ExpandSources(test.Properties.Data, nil)
}