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
diff --git a/cc/compiler.go b/cc/compiler.go
index 53a60c7..df396e8 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -31,11 +31,11 @@
 	// 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 @@
 		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 @@
 		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 @@
 	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))
 	}
diff --git a/cc/library.go b/cc/library.go
index cf18ebf..71a9df6 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -30,8 +30,8 @@
 )
 
 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 @@
 	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 @@
 	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 @@
 	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) 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 @@
 		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
 }
 
diff --git a/cc/linker.go b/cc/linker.go
index 9d4a0e8..fd958ba 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -149,7 +149,7 @@
 	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 @@
 		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
 }
 
diff --git a/cc/ndk_headers.go b/cc/ndk_headers.go
index c0ce9c3..2024180 100644
--- a/cc/ndk_headers.go
+++ b/cc/ndk_headers.go
@@ -70,13 +70,13 @@
 	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
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index 686a85a..4c893d4 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -33,7 +33,7 @@
 	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.
diff --git a/cc/test.go b/cc/test.go
index 3ecc419..f0274e9 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -42,7 +42,7 @@
 
 	// 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 @@
 
 	// 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) 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 @@
 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 @@
 
 	// 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) 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
diff --git a/cc/test_data_test.go b/cc/test_data_test.go
index eead25b..7ba244e 100644
--- a/cc/test_data_test.go
+++ b/cc/test_data_test.go
@@ -166,7 +166,7 @@
 	android.ModuleBase
 	data       android.Paths
 	Properties struct {
-		Data []string
+		Data []string `android:"path"`
 	}
 }
 
@@ -177,10 +177,6 @@
 	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)
 }