| Commit message (Collapse) | Author | Age |
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 179425421
|
|
|
|
|
|
|
|
| |
The ResourceDependencies constructor takes in two NestedSet<Artifact> objects,
and I was putting them in the wrong order.
RELNOTES: none
PiperOrigin-RevId: 176648259
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Whether a resource is accepted or rejected by density-based resource filtering
is dependent on what other resources are available. When filtering resources in
execution, this was taken into account - resources were filtered after merging.
To replicate this behavior when filtering in analysis, we must look at both
local and transitive resources before we actually filter anything.
This process makes filtering with dynamic configuration extremely inefficient, since the NestedSet of transitive resources must be collapsed at each library target. We can fix this by only looking at the transitive resources at the top-level target, even when using dynamic filtering. I'm not implementing that in this change, however, since dynamic filtering is relatively low priority and this review is already pretty big.
Note that some of the messiness around filtering ResourceDependencies and
NestedSet<ResourceContainer> will go away once those NestedSets are removed.
Also, stop filtering resources in android_test, since android_test can never specify resource filters.
RELNOTES: none
PiperOrigin-RevId: 174474491
|
|
|
|
|
|
|
|
|
|
|
| |
In the next review, to handle issues around density filtering, ResourceFilterFactory will return another object that actually handles filtering. To ensure stuff is named properly, rename ResourceFilter to ResourceFilterFactory now so that the new class can be called ResourceFilter.
This is a straightforward automated refactor, followed with some automated reformatting to make linting happy.
I used the name ResourceFilterFactory, rather than the more concise ResourceFilters, as this class actually contains state (both around what filtering should currently do and about what resources were filtered out) and isn't just a helper class.
RELNOTES: none
PiperOrigin-RevId: 174049618
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recent changes:
1) Started passing all resources to processors, ignoring the filtered
ResourceContainers, and
2) Started loading an unfiltered LocalResourceContainer into binary resource
processing, in addition to the filtered container.
Fix both of these. To fix the former, we need to split the misleadingly-named
'transitiveResourceRoots' (actually transitive resource and assets artifacts)
into transitive resources and assets.
Update resource filtering tests to catch bugs like these.
Also, rename getters for resource containers to make clear that they are not
getters for resources.
Finally, document some weirdness and partially-completed migrations encountered
as part of investigating these issues, and add appropriate TODOs and
deprecation.
RELNOTES: None
PiperOrigin-RevId: 172929936
|
|
|
|
|
|
|
| |
resource library APK's.
RELNOTES: none
PiperOrigin-RevId: 170517806
|
|
|
|
|
|
| |
This is a trivial change with a large file footprint.
PiperOrigin-RevId: 169169864
|
|
|
|
|
|
| |
This involves rather tediously rolling up each artifact type in its own individual nested set.
PiperOrigin-RevId: 168729120
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
android_libraries can now be used in the resources attribute. However, if these
libraries contain non-resource information, it won't get picked up. To prevent
unexpected behavior, fail if such libraries are used as resources.
Adding a temporary boolean to AndroidResourcesProvider seems to be the most
straightforward way of doing this. The alternative, having the consuming target
check all relevant providers for non-resource information, would be much
messier.
RELNOTES: None
PiperOrigin-RevId: 165703578
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of having custom ArgvFragments for every combination of desired things, we make a combined "interpreter" of argvs. This saves memory and simplifies things as we do not have to allocate a strategy instance per call to args (instead pushing a single shared instance, followed by the args).
The generic interpreter does have a lot of branching compared to the bespoke implementations, but because the branch is always the same for long stretches the branch predictor should easily be able to handle it with minimal overhead (~1 cycle per branch IIRC).
This CL also elevates that we either want a NestedSet or an ImmutableCollection to the surface of the API, so consumers understand the cost when they call it with a non-immutable collection. Most of the changes in clients is due to this.
To cut down on CL churn, @Deprecated forwarding methods are added to CustomCommandLine. These will be removed in a separate CL using IDE inlining.
RELNOTES: None
PiperOrigin-RevId: 164725370
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The RuleContext object is not available when creating dynamic configuration
transitions. Removing it from ResourceFilter's state allows us to work with
ResourceFilter objects while creating those transitions. If we didn't do this,
we'd need to seperate the rest of ResourceFilter's state into a seperate class
so that we could work with it as part of doing dynamic configurations.
In the next reviews, I'll start actually creating dynamic configurations based
on ResourceFilter state.
Also, create a withAttrsFrom method that can be used in dynamic configuration
transitions, and generally migrate methods that work with attributes from
RuleContext to AttributeMap when practical.
To support these changes:
No longer keep the parsed lists of FolderConfiguration and Density objects as
fields of the ResourceFilter, instead, write functions that get them when
needed. We want to have access to a RuleContext when we initialize them to avoid
errors, and we don't have one in the withAttrsFrom method which will be called
as part of transitioning with dynamic configurations.
We no longer have those parsed lists to represent whether the object filters
during execution or analysis, so replace them with a seperate enum field for
filter behavior. Include a FILTER_IN_ANALYSIS_WITH_DYNAMIC_CONFIGURATION
option, even though it won't fully be used until the dynamic configuration
transition is taken advantage of in the next few reviews.
RELNOTES: none
PiperOrigin-RevId: 151715400
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rollback of commit df366408188f0451bae9b2ed079c795a4beb2e2b.
In addition to undoing the rollback of my previous change, fix the bugs it
introduced and add tests for those bugs.
Always ignore empty filters. Empty filters are always useless or
counterproductive. Before the original change, empty filters as a single item
within the list of filters (e.g., ["en", ""]) were ignored, but empty filters
as a portion of a string in the list (e.g., ["en,"]) were not. I can't imagine
any reason people would actually want the empty filter (if it were handled
correctly, it would effectively tell Bazel to just ignore every other filter
the user passed in).
Since it makes more sense with the new code, represent the stringified filters
as a list of strings, rather than a single string of comma-seperated values.
Manually trim whitespace from each token. Before the original change, the code
trimmed whitespace following commas (e.g., ["en, es"] -> ["en,es"]) but not
otherwise. If we're allowing whitespace in filter strings anyway, there doesn't
seem to be any reason to allow it in some places but not others.
--
PiperOrigin-RevId: 151128685
MOS_MIGRATED_REVID=151128685
|
|
|
|
|
|
| |
--
PiperOrigin-RevId: 151000602
MOS_MIGRATED_REVID=151000602
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In addition to filtering android_binary resources by
resource_configuration_filters, we also filter by densities. Doing this in
analysis rather than execution should also result in a speed-up as there's no
need to copy files unwanted for actions to use.
This behavior is controlled by the same object and flags that already
control resource configuration filtering, simplifying the code.
--
PiperOrigin-RevId: 150871620
MOS_MIGRATED_REVID=150871620
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this change, resource_configuration_filters were only used to filter
resources out of android_binary targets during resource processing. Instead, we
can filter these unwanted resources out during analysis. This means we won't
have to copy these resources for use in execution, and that execution itself
will have a smaller set of inputs. This should produce a speed-up in
android_binary targets with resource_configuration_filters.
Also add a flag that controls this behavior. Currently, the flag defaults to
not doing this prefiltering. We'll change that after further testing.
Also, do some related cleanup:
- Replace repeated used of the constant "resource_configuration_filters" with
references to the new class
- Pass around instances of the new class rather that List<String> objects meant
to represent ResourceConfigurationFilters
--
PiperOrigin-RevId: 148353501
MOS_MIGRATED_REVID=148353501
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This merges the AndroidResourceContainerBuilder (which it's not even clear is related to
the nested ResourceContainer!) into the newly generated ResourceContainer.Builder.
It also seemed ridiculous for ResourceContainer to get so large and still be subordinate
to AndroidResourcesProvider, especially when it's getting passed around in a lot of other
places (look how many imports needed fixing!). This CL makes it its own top level class.
This allows for easy modification of an existing instance: call toBuilder on it, set
the properties you want set, and then call build.
--
PiperOrigin-RevId: 143574468
MOS_MIGRATED_REVID=143574468
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All calls now go through RuleContext.attributes(), which
guarantees both native and aspect-supplied attributes are checked.
For aspect attributes, only type queries are supported (e.g. "does
this attribute exist?", "what is its type?"). Not value queries.
This is because the code this is cleaning up accesses aspect
attributes through a String->Attribute map, which doesn't include
values. If ever needed we could further extend with something
more robust.
--
MOS_MIGRATED_REVID=140771242
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=131832497
|
|
|
|
|
|
|
|
| |
Consists of adding @Immutable annotations, adding final modifiers, and changing
the types of fields to immutable types.
--
MOS_MIGRATED_REVID=120221067
|
|
|
|
|
|
|
| |
RELNOTES: Fix resource handling for exported android_library rules
--
MOS_MIGRATED_REVID=109532253
|
|
|
|
|
|
|
|
|
| |
neverlink attribute.
RELNOTES: Resources defined locally on an android_library rule will respect the neverlink attribute.
--
MOS_MIGRATED_REVID=108178381
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
deduplication of transitive and direct dependencies in the AndroidProcessingAction.
Change the resource dependency handling to separate between the transitive and direct resources from libraries.
This slightly increases the complexity of resource propagation. The initial algorithm was to simply merge all transitive ResourceContainers together with any new ResourceContainer and propagate them via the AndroidResourcesProvider. The new algorithm is encapsulated inside a new ResourceDependencies class which works as follows:
1. Collect resources from the deps into transitive and direct NestedSets
2. If a rule provides a ResourceContainer, merge the transitive and direct into a new transitive set
3. Export the provider
This results having a rule without resources "forward" the merged sets of transitive and direct resources to the next rule.
--
MOS_MIGRATED_REVID=105960655
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
Breaks many android targets in the depot.
*** Original change description ***
Trying again with checking for the presence of the "resources" attribute.
Change the resource dependency handling to separate between the transitive and direct resources from libraries.
This slightly increases the complexity of resource propagation. The initial algorithm was to simply merge all transitive ResourceContainers together with any new ResourceContainer and propagate them via the AndroidResourcesProvider. The new algorithm is encapsulated inside a new ResourceDependencies class which...
***
ROLLBACK_OF=105631635
--
MOS_MIGRATED_REVID=105752015
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change the resource dependency handling to separate between the transitive and direct resources from libraries.
This slightly increases the complexity of resource propagation. The initial algorithm was to simply merge all transitive ResourceContainers together with any new ResourceContainer and propagate them via the AndroidResourcesProvider. The new algorithm is encapsulated inside a new ResourceDependencies class which works as follows:
1. Collect resources from the deps into transitive and direct NestedSets
2. If a rule provides a ResourceContainer, merge the transitive and direct into a new transitive set
3. Export the provider
This results having a rule without resources "forward" the merged sets of transitive and direct resources to the next rule.
--
MOS_MIGRATED_REVID=105631635
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
Breaks [].
*** Original change description ***
Change the resource dependency handling to separate between the transitive and direct resources from libraries.
This slightly increases the complexity of resource propagation. The initial algorithm was to simply merge all transitive ResourceContainers together with any new ResourceContainer and propagate them via the AndroidResourcesProvider. The new algorithm is encapsulated inside a new ResourceDependencies class which works as follows:
1. Collect resources from the deps into transitive and...
***
--
MOS_MIGRATED_REVID=105598448
|
|
and direct resources from libraries.
This slightly increases the complexity of resource propagation. The initial algorithm was to simply merge all transitive ResourceContainers together with any new ResourceContainer and propagate them via the AndroidResourcesProvider. The new algorithm is encapsulated inside a new ResourceDependencies class which works as follows:
1. Collect resources from the deps into transitive and direct NestedSets
2. If a rule provides a ResourceContainer, merge the transitive and direct into a new transitive set
3. Export the provider
This results having a rule without resources "forward" the merged sets of transitive and direct resources to the next rule.
--
MOS_MIGRATED_REVID=105515074
|