Commit graph

12 commits

Author SHA1 Message Date
Usta
851a3271ce Use Module.GetProperties() instead of ModuleBase.generalProperties
ModuleBase.generalProperties served the pupose of being a subset
of ModuleBase.customizableProperties. But now with the removal of
the latter, the former is simply a redirection to Module.GetProperties()

Bug: 206961391
Test: m nothing and diff the ninja files
Change-Id: I6dd8b7ba74eb5e7ffb61029b0f9129eec2ccfdaf
2022-01-08 03:09:52 +00:00
Paul Duffin
40131a3f9e Support fully qualified names in android:"path" properties
Previously, a module reference in a path property would be parsed into
two parts, the module name and the optional output tag, which defaults
to an empty string if not specified. The output tag would be stored in
a sourceOrOutputDependencyTag which would then be used, along with the
module name to add a dependency on the module.

Later, when the paths were processed the same module reference would be
parsed into the same two parts again and the module name used to find a
matching Module by comparing it against the name returned by either
Module.Name(), ctx.OtherModuleName() or ModuleBase.BaseModuleName().
Once the module had been found then if it supported OutputFilesProducer
then the tag would be passed to its OutputFiles(tag) method. Otherwise,
it would fall back to treating it as SourceFilesProducer.

The problem with that is the module name retrieved from the module in
some way (either directly or through a context name) could be different
to that originally supplied when adding the dependency. e.g.
1. If the original dependency was added onto a source module but there
   existed a suitable and preferred prebuilt module then the dependency
   onto the source module would have been replaced by the prebuilt
   module which has a different name.
2. If the path property included a fully qualified name that included
   a qualifying path then it would not match the name retrieved from
   the module which would not include the qualifying path.

This change circumvents that whole issue by adding the module name that
was originally used to add the dependency into the DependencyTag. Now
the DependencyTag uniquely identifies the original module/outputTag
pair parsed from the module reference. The pathDepsMutator guarantees
that they are unique as it dedups them before adding the dependencies.

It is possible that calling ExtractSource(s)Deps() would add some
duplicate but if they did they would be identical, i.e. the same
sourceOrOutputDependencyTag would be used to add a dependency onto the
exact same module. In that case it would not matter which of the
dependencies was found as it would still return the same module.

Bug: 193228441
Test: m nothing
Change-Id: I661514a2984818e5c26577411cede53eb57bcd02
2021-07-14 23:58:49 +01:00
Liz Kammer
4562a3b218 Add bp2build arch-specific paths mutator
Adds deps for properties tagged `android:"path"` within arch, multilib,
and target properties.

Test: build/bazel/ci/bp2build.sh
Test: m nothing
Bug: 185217298
Change-Id: I0230da399d2c4e984b837f69523fa09eadba3ff1
2021-04-21 18:21:50 -04:00
Jaewoong Jung
1c1b6e6d95 Lineage properties support module references.
They should have had `android:"path"` tags attached so that users can
point them to filegroup modules.

Test: app_test.go & app_import_test.go
Bug: 182175153
Change-Id: I5580408488ffe5fc12c869cbfb7a468713dcbc96
2021-03-09 15:14:34 -08:00
Jiyong Park
66dd5c09e2 android:path attribute is respected for fields in a slice of struct
This change fixes a bug that android:path attribute is ignored when
annotated field is in a slice of struct.

blueprint now traverses fields whose type is slice of struct and
provides the index list in the case. Soong is modified so that it checks
whether the field being referenced is a slice of struct or not. If that
is the case, it gathers field values from each of the elements. If not,
it follows the original path.

Bug: 181018147
Test: m nothing
Change-Id: I220efb6feaa525a00939654459b2998e98e7ad56
2021-02-24 01:22:57 +09:00
Colin Cross
11c89c0e9e Add more comments to path_properties.go
Bug: 173449605
Test: m checkbuild
Change-Id: I2638da9cc56726f5d646424e72f52289ad093781
2020-11-19 14:28:46 -08:00
Colin Cross
08d6f8fd75 Revert "Skip creating variants for disabled OSes"
This reverts commit d976af0cb4.

Reason for revert: broke windows SDK build: missing bin/dexdump.exe

Bug: 173663545
Change-Id: Ibb541507650beabd2d94885dd8d66f724a358ca7
2020-11-19 02:33:19 +00:00
Colin Cross
d976af0cb4 Skip creating variants for disabled OSes
The documentation java_genrule_host states that it creates a single
variant, which would make it work with the single variant fallback
in AddDependency used by the data property, but it actually has a host
and a host-cross windows variant.  Modify osMutator to take the
OS-specific enabled properties into account to skip creating variants
that will immediately be disabled so there is a single variant.

Test: m checkbuild
Change-Id: Ic2daab29f4fa3a3797d7a08348fbfcf1036ec5dc
2020-11-17 14:24:24 -08:00
Colin Cross
527f3e5511 Dedup path properties across property structs
Listing a property in multiple property structs would cause it to
add multiple dependencies with the same dependency tag, which would
trip the panic in getDirectDepInternal when calling
PathForModuleSrc.  Dedup the properties with the android:"path"
struct tag across all property structs.

Test: path_properties_test.go
Change-Id: Ib6c0e7789443d340ee7551721df0135c5ee64c0f
2019-07-16 09:52:23 -07:00
Colin Cross
41955e8895 Support tagged module references
There are cases where a module needs to refer to an intermediate
output of another module instead of its final output.  For example,
a module may want to use the .jar containing .class files from
another module whose final output is a .jar containing classes.dex
files.  Support a new ":module{.tag}" format in any property that
is annotated with `android:"path"`, which will query the target
module for its ".tag" output(s).

Test: path_properties_test.go, paths_test.go
Test: no unexpected changes in build.ninja
Change-Id: Icd3c9b0d83ff125771767c04046fcffb9fc3f65a
2019-06-04 10:22:51 -07:00
Colin Cross
a3a97415d3 Don't add dependencies on modules referenced in unused arch variants
When extracting dependencies from properties tagged with
`android:"path"`, only look at the general property structs
and not the arch-specific ones.  The necessary arch-specific
values will be appended into the general property structs.

Fixes: 128377112
Test: path_properties_test.go
Change-Id: I35e35555d5b15473229a7458fcfc2c7dacaec889
2019-03-18 12:49:14 -07:00
Colin Cross
1b48842a4b Add path properties mutator
Add a mutator pass after DepsMutator that visits every property
struct in every module looking for properties that have a tag
`android:"path"`, and automatically add a SourceDepTag dependency
on any module references (":module-name") found.  Uses a cache to
store the mapping of property struct type to locations of
properties with the tag.

Test: android/path_properties_test.go
Change-Id: I38c0497843dde4890e9342c3a6f0b402c0720742
2019-03-07 18:36:24 +00:00