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 /java | |
parent | 1b48842a4b83ba6234d26ff4c77a0884f5008f62 (diff) | |
download | android_build_soong-27b922f53e938896c0a693a1d9f50e6c9e686ad7.tar.gz android_build_soong-27b922f53e938896c0a693a1d9f50e6c9e686ad7.tar.bz2 android_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 'java')
-rw-r--r-- | java/aar.go | 8 | ||||
-rw-r--r-- | java/app.go | 3 | ||||
-rw-r--r-- | java/droiddoc.go | 72 | ||||
-rw-r--r-- | java/java.go | 45 |
4 files changed, 28 insertions, 100 deletions
diff --git a/java/aar.go b/java/aar.go index c30632ea..3f13e59c 100644 --- a/java/aar.go +++ b/java/aar.go @@ -64,10 +64,10 @@ type aaptProperties struct { Resource_dirs []string // list of zip files containing Android resources. - Resource_zips []string + Resource_zips []string `android:"path"` // path to AndroidManifest.xml. If unset, defaults to "AndroidManifest.xml". - Manifest *string + Manifest *string `android:"path"` } type aapt struct { @@ -180,8 +180,6 @@ func (a *aapt) deps(ctx android.BottomUpMutatorContext, sdkContext sdkContext) { if sdkDep.frameworkResModule != "" { ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule) } - - android.ExtractSourcesDeps(ctx, a.aaptProperties.Resource_zips) } func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext, extraLinkFlags ...string) { @@ -406,7 +404,7 @@ func AndroidLibraryFactory() android.Module { // type AARImportProperties struct { - Aars []string + Aars []string `android:"path"` Sdk_version *string Min_sdk_version *string diff --git a/java/app.go b/java/app.go index 2ff6c982..8a422fc2 100644 --- a/java/app.go +++ b/java/app.go @@ -459,9 +459,6 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { } func (a *AndroidTest) DepsMutator(ctx android.BottomUpMutatorContext) { - android.ExtractSourceDeps(ctx, a.testProperties.Test_config) - android.ExtractSourceDeps(ctx, a.testProperties.Test_config_template) - android.ExtractSourcesDeps(ctx, a.testProperties.Data) a.AndroidApp.DepsMutator(ctx) if a.appTestProperties.Instrumentation_for != nil { // The android_app dependency listed in instrumentation_for needs to be added to the classpath for javac, diff --git a/java/droiddoc.go b/java/droiddoc.go index 56117915..777cd9c3 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -157,7 +157,7 @@ var ( type JavadocProperties struct { // list of source files used to compile the Java module. May be .java, .logtags, .proto, // or .aidl files. - Srcs []string `android:"arch_variant"` + Srcs []string `android:"path,arch_variant"` // list of directories rooted at the Android.bp file that will // be added to the search paths for finding source files when passing package names. @@ -166,7 +166,7 @@ type JavadocProperties struct { // list of source files that should not be used to build the Java module. // This is most useful in the arch/multilib variants to remove non-common files // filegroup or genrule can be included within this property. - Exclude_srcs []string `android:"arch_variant"` + Exclude_srcs []string `android:"path,arch_variant"` // list of java libraries that will be in the classpath. Libs []string `android:"arch_variant"` @@ -205,7 +205,7 @@ type JavadocProperties struct { Java_version *string // local files that are used within user customized droiddoc options. - Arg_files []string + Arg_files []string `android:"path"` // user customized droiddoc args. // Available variables for substitution: @@ -220,12 +220,12 @@ type JavadocProperties struct { type ApiToCheck struct { // path to the API txt file that the new API extracted from source code is checked // against. The path can be local to the module or from other module (via :module syntax). - Api_file *string + Api_file *string `android:"path"` // path to the API txt file that the new @removed API extractd from source code is // checked against. The path can be local to the module or from other module (via // :module syntax). - Removed_api_file *string + Removed_api_file *string `android:"path"` // Arguments to the apicheck tool. Args *string @@ -243,11 +243,11 @@ type DroiddocProperties struct { // proofread file contains all of the text content of the javadocs concatenated into one file, // suitable for spell-checking and other goodness. - Proofread_file *string + Proofread_file *string `android:"path"` // a todo file lists the program elements that are missing documentation. // At some point, this might be improved to show more warnings. - Todo_file *string + Todo_file *string `android:"path"` // directory under current module source that provide additional resources (images). Resourcesdir *string @@ -260,14 +260,14 @@ type DroiddocProperties struct { Write_sdk_values *bool // index.html under current module will be copied to docs out dir, if not null. - Static_doc_index_redirect *string + Static_doc_index_redirect *string `android:"path"` // source.properties under current module will be copied to docs out dir, if not null. - Static_doc_properties *string + Static_doc_properties *string `android:"path"` // a list of files under current module source dir which contains known tags in Java sources. // filegroup or genrule can be included within this property. - Knowntags []string + Knowntags []string `android:"path"` // the tag name used to distinguish if the API files belong to public/system/test. Api_tag_name *string @@ -360,7 +360,7 @@ type DroidstubsProperties struct { } // user can specify the version of previous released API file in order to do compatibility check. - Previous_api *string + Previous_api *string `android:"path"` // is set to true, Metalava will allow framework SDK to contain annotations. Annotations_enabled *bool @@ -556,14 +556,6 @@ func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) { if j.properties.Srcs_lib != nil { ctx.AddVariationDependencies(nil, srcsLibTag, *j.properties.Srcs_lib) } - - android.ExtractSourcesDeps(ctx, j.properties.Srcs) - - // exclude_srcs may contain filegroup or genrule. - android.ExtractSourcesDeps(ctx, j.properties.Exclude_srcs) - - // arg_files may contains filegroup or genrule. - android.ExtractSourcesDeps(ctx, j.properties.Arg_files) } func (j *Javadoc) genWhitelistPathPrefixes(whitelistPathPrefixes map[string]bool) { @@ -873,27 +865,6 @@ func (d *Droiddoc) DepsMutator(ctx android.BottomUpMutatorContext) { if String(d.properties.Custom_template) != "" { ctx.AddDependency(ctx.Module(), droiddocTemplateTag, String(d.properties.Custom_template)) } - - // knowntags may contain filegroup or genrule. - android.ExtractSourcesDeps(ctx, d.properties.Knowntags) - - if String(d.properties.Static_doc_index_redirect) != "" { - android.ExtractSourceDeps(ctx, d.properties.Static_doc_index_redirect) - } - - if String(d.properties.Static_doc_properties) != "" { - android.ExtractSourceDeps(ctx, d.properties.Static_doc_properties) - } - - if apiCheckEnabled(d.properties.Check_api.Current, "current") { - android.ExtractSourceDeps(ctx, d.properties.Check_api.Current.Api_file) - android.ExtractSourceDeps(ctx, d.properties.Check_api.Current.Removed_api_file) - } - - if apiCheckEnabled(d.properties.Check_api.Last_released, "last_released") { - android.ExtractSourceDeps(ctx, d.properties.Check_api.Last_released.Api_file) - android.ExtractSourceDeps(ctx, d.properties.Check_api.Last_released.Removed_api_file) - } } func (d *Droiddoc) initBuilderFlags(ctx android.ModuleContext, implicits *android.Paths, @@ -1318,20 +1289,6 @@ func (d *Droidstubs) DepsMutator(ctx android.BottomUpMutatorContext) { ignoreMissingModules(ctx, &d.properties.Check_api.Last_released) } - if apiCheckEnabled(d.properties.Check_api.Current, "current") { - android.ExtractSourceDeps(ctx, d.properties.Check_api.Current.Api_file) - android.ExtractSourceDeps(ctx, d.properties.Check_api.Current.Removed_api_file) - } - - if apiCheckEnabled(d.properties.Check_api.Last_released, "last_released") { - android.ExtractSourceDeps(ctx, d.properties.Check_api.Last_released.Api_file) - android.ExtractSourceDeps(ctx, d.properties.Check_api.Last_released.Removed_api_file) - } - - if String(d.properties.Previous_api) != "" { - android.ExtractSourceDeps(ctx, d.properties.Previous_api) - } - if len(d.properties.Merge_annotations_dirs) != 0 { for _, mergeAnnotationsDir := range d.properties.Merge_annotations_dirs { ctx.AddDependency(ctx.Module(), metalavaMergeAnnotationsDirTag, mergeAnnotationsDir) @@ -1344,13 +1301,6 @@ func (d *Droidstubs) DepsMutator(ctx android.BottomUpMutatorContext) { } } - if String(d.properties.Validate_nullability_from_list) != "" { - android.ExtractSourceDeps(ctx, d.properties.Validate_nullability_from_list) - } - if String(d.properties.Check_nullability_warnings) != "" { - android.ExtractSourceDeps(ctx, d.properties.Check_nullability_warnings) - } - if len(d.properties.Api_levels_annotations_dirs) != 0 { for _, apiLevelsAnnotationsDir := range d.properties.Api_levels_annotations_dirs { ctx.AddDependency(ctx.Module(), metalavaAPILevelsAnnotationsDirTag, apiLevelsAnnotationsDir) diff --git a/java/java.go b/java/java.go index 0e1ae239..dcd6dbe9 100644 --- a/java/java.go +++ b/java/java.go @@ -62,11 +62,11 @@ func init() { type CompilerProperties struct { // list of source files used to compile the Java module. May be .java, .logtags, .proto, // or .aidl files. - Srcs []string `android:"arch_variant"` + Srcs []string `android:"path,arch_variant"` // list of source files that should not be used to build the Java 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 directories containing Java resources Java_resource_dirs []string `android:"arch_variant"` @@ -75,10 +75,10 @@ type CompilerProperties struct { Exclude_java_resource_dirs []string `android:"arch_variant"` // list of files to use as Java resources - Java_resources []string `android:"arch_variant"` + Java_resources []string `android:"path,arch_variant"` // list of files that should be excluded from java_resources and java_resource_dirs - Exclude_java_resources []string `android:"arch_variant"` + Exclude_java_resources []string `android:"path,arch_variant"` // don't build against the default libraries (bootclasspath, ext, and framework for device // targets) @@ -100,10 +100,10 @@ type CompilerProperties struct { Static_libs []string `android:"arch_variant"` // manifest file to be included in resulting jar - Manifest *string + Manifest *string `android:"path"` // if not blank, run jarjar using the specified rules file - Jarjar_rules *string `android:"arch_variant"` + Jarjar_rules *string `android:"path,arch_variant"` // If not blank, set the java version passed to javac as -source and -target Java_version *string @@ -126,7 +126,7 @@ type CompilerProperties struct { Openjdk9 struct { // List of source files that should only be used when passing -source 1.9 - Srcs []string + Srcs []string `android:"path"` // List of javac flags that should only be used when passing -source 1.9 Javacflags []string @@ -172,7 +172,7 @@ type CompilerProperties struct { Instrument bool `blueprint:"mutated"` // List of files to include in the META-INF/services folder of the resulting jar. - Services []string `android:"arch_variant"` + Services []string `android:"path,arch_variant"` } type CompilerDeviceProperties struct { @@ -241,7 +241,7 @@ type CompilerDeviceProperties struct { Proguard_flags []string // Specifies the locations of files containing proguard flags. - Proguard_flags_files []string + Proguard_flags_files []string `android:"path"` } // When targeting 1.9, override the modules to use with --system @@ -478,13 +478,6 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { {Mutator: "arch", Variation: ctx.Config().BuildOsCommonVariant}, }, pluginTag, j.properties.Plugins...) - android.ExtractSourcesDeps(ctx, j.properties.Srcs) - android.ExtractSourcesDeps(ctx, j.properties.Exclude_srcs) - android.ExtractSourcesDeps(ctx, j.properties.Java_resources) - android.ExtractSourceDeps(ctx, j.properties.Manifest) - android.ExtractSourceDeps(ctx, j.properties.Jarjar_rules) - android.ExtractSourcesDeps(ctx, j.properties.Services) - if j.hasSrcExt(".proto") { protoDeps(ctx, &j.protoProperties) } @@ -1530,15 +1523,15 @@ type testProperties 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"` // list of files or filegroup modules that provide data that should be installed alongside // the test - Data []string + Data []string `android:"path"` } type Test struct { @@ -1557,13 +1550,6 @@ func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.Library.GenerateAndroidBuildActions(ctx) } -func (j *Test) DepsMutator(ctx android.BottomUpMutatorContext) { - j.deps(ctx) - android.ExtractSourceDeps(ctx, j.testProperties.Test_config) - android.ExtractSourceDeps(ctx, j.testProperties.Test_config_template) - android.ExtractSourcesDeps(ctx, j.testProperties.Data) -} - // java_test builds a and links sources into a `.jar` file for the device, and possibly for the host as well, and // creates an `AndroidTest.xml` file to allow running the test with `atest` or a `TEST_MAPPING` file. // @@ -1614,7 +1600,7 @@ func TestHostFactory() android.Module { type binaryProperties struct { // installable script to execute the resulting jar - Wrapper *string + Wrapper *string `android:"path"` // Name of the class containing main to be inserted into the manifest as Main-Class. Main_class *string @@ -1670,8 +1656,6 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) { if ctx.Arch().ArchType == android.Common { j.deps(ctx) - } else { - android.ExtractSourceDeps(ctx, j.binaryProperties.Wrapper) } } @@ -1724,7 +1708,7 @@ func BinaryHostFactory() android.Module { // type ImportProperties struct { - Jars []string + Jars []string `android:"path"` Sdk_version *string @@ -1775,7 +1759,6 @@ func (j *Import) Name() string { } func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) { - android.ExtractSourcesDeps(ctx, j.properties.Jars) ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...) } |