| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
| |
aapt2 always gets the complete, unfiltered resources, and then filters them in
execution. Save time by not uselessly filtering in analysis.
RELNOTES: none
PiperOrigin-RevId: 178397137
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 178369060
|
|
|
|
|
|
|
|
| |
This will instruct AAPT2 to produce conditional keep rules to allow for more aggressive code and resource shrinking.
RELNOTES[NEW]: Add --experimental_android_resource_cycle_shrinking option to allow for more aggressive code and resource shrinking.
PiperOrigin-RevId: 176530749
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 175866310
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
LocalResourceContainer.Builder is referenced a bunch of times, but most of
those calls are identical. Replace them with a couple of factory methods. This
lets us make the builder private.
Additionally, LocalResourceContainer called attributeError() on the 'resources'
attribute, even though 'resource_files' is now used most of the time instead.
Now, the error is always given for the correct attribute.
RELNOTES: none
PiperOrigin-RevId: 174038035
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 173128623
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
builder code.
RELNOTES: None
PiperOrigin-RevId: 172109520
|
|
|
|
| |
PiperOrigin-RevId: 171684595
|
|
|
|
|
|
| |
Progress on #2475.
PiperOrigin-RevId: 170473111
|
|
|
|
|
|
| |
This is a trivial change with a large file footprint.
PiperOrigin-RevId: 169169864
|
|
|
|
|
|
| |
This is necessary for the upcoming Skylark implementation of param files.
PiperOrigin-RevId: 168744486
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 168444499
|
|
|
|
|
|
|
|
|
| |
To do this, add a new tool that is used instead of zipper to get the resources out of the AAR. This tool creates res/values/empty.xml if there are no resources in the AAR.
Also, some general cleaning of the code.
RELNOTES: None
PiperOrigin-RevId: 166768607
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change forces use of CustomCommandLine.Builder, which has a richer interface for constructing memory-efficient command lines. It will also permit surveying the code base for inefficient patterns using an IDE.
This change was done by hand and split using Rosie to assist with rollbacks in case of bugs. Reviewers, please pay particular attention to:
* Each all to addInputArgument/addOutputArgument should come with a corresponding matching pair to SpawnAction.Builder#addInput and CustomCommandLine.Builder#addExecPath (eg.).
* The commandLine must be set on the SpawnAction using SpawnAction.Builder#setCommandLine.
Note that most calls to addPrefixed("arg=", val) should be more idiomatically expressed as add("arg", val), but this involves changing tests and making sure that the command line tools can accept the format.
PiperOrigin-RevId: 166106104
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows us to perform a more gradual migration away from the
android_resources rule. Specifically, rather than move all android_resources
targets and simultaneously move all resources attributes, we can now first
transform all android_resources rules into android_library rules, and then
afterwards migrate dependencies on those rules from resources into deps. This
allows a two-part migration.
The resources attribute, once allowed to take android_library targets, should
continue to work exactly as before.
There is one change in behavior - for this to work, android_library targets now
need to build an output APK during resource processing. This APK will be
removed once the resources attribute is removed.
Once the migration is complete, the resources attribute will be removed
completely.
RELNOTES: none
PiperOrigin-RevId: 165313447
|
|
|
|
|
|
|
|
|
|
| |
Consumers using spawn action builder now have access to handy overloads that behind the scene do a lazy String.format. In 95% of cases progress messages are expressible as 0, 1, or 2 argument String.formats.
This saves memory because the format string is constant and shared between all actions, and the captured subjects are usually live on the heap anyway (eg. labels).
Skylark still computes its progress messages eagerly. If we want similar savings there I'd have to follow up with a Skylark proposal.
PiperOrigin-RevId: 164068816
|
|
|
|
|
|
|
| |
Also, a few small cleanups of some duplicate test methods.
RELNOTES: None
PiperOrigin-RevId: 163066349
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 162613289
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Dynamically Configured Resource Filtering change 2/6
We need to filter LocalResourceContainer for dynamically configured resource
filtering - it is an input to resource parsing for android_library targets.
Filter it appropriately.
Once it's being filtered, use it to build a filtered ResourceContainer, rather
than building an unfiltered ResourceContainer and then filtering it. This means
filtering gets done sooner, saving a bit of time and work, and isn't done
twice, which would just be bad.
To do this, we pass an unbuilt ResourceContainer.Builder into createApk, rather than a fully built one. Move the setAssetsAndResourcesFrom and setManifest calls to that builder, called every time, into createApk so that we only call them once.
Also, initialize the ResourceFilter object when it's needed, rather than pass
it down from the binary or library. This makes the code a bit cleaner, plus
means library targets will pick up the dynamically configured information once
that exists.
RELNOTES: none
PiperOrigin-RevId: 162007885
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 161831232
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 160684786
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Dynamically Configured Resource Filtering change 1/6
To enable dynamically configured resource filtering, we'll need to be able to
pass filtered resources into resource processing code used by android_library
targets. The resource parsing action, used only in android_library targets,
takes the LocalResourceContainer as an input, unlike android_binary processing
code which never used it directly.
Abstract the code for actually building the collection of resource roots out of the withResources method, and create an additional method for calling it from resource filtering.
Also, split some common test code out of ResourceFilterTestBase to make a ResourceTestBase class for testing changes to this (and eventually, other) resource-oriented classes, and create LocalResourceContainerTest for this class in particular.
RELNOTES: none
PiperOrigin-RevId: 160640192
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 160445869
|
|
|
|
|
|
|
|
| |
* Split the aar, library and binary packWith calls.
* Remove unused argument from the new binary and library packWith calls.
RELNOTES: None
PiperOrigin-RevId: 160414867
|
|
|
|
|
|
|
| |
the default has been switched to "android".
RELNOTES: The 'legacy' Android manifest merger is deprecated. Please upgrade to the 'android' manifest merger, which is the same merger used by Gradle. https://developer.android.com/studio/build/manifest-merge.html
PiperOrigin-RevId: 156765307
|
|
|
|
|
|
|
| |
separate method. This is so that android_local_test won't need access to the AndroidConfiguration fragment.
RELNOTES: None
PiperOrigin-RevId: 156740056
|
|
|
|
|
|
|
|
|
|
|
|
| |
'create' method.
This paves the way for changing PathFragment to e.g. an abstract class with multiple subclasses. This way we can split out the windows-specific stuff into one of these concrete classes, making the code more readable and also saving memory (since the shallow heap size of the NonWindowsPathFragment subclass will hopefully be smaller than that of the current PathFragment).
This also lets us pursue gc churn optimizations. We can now do interning in PathFragment#create and can also get rid of unnecessary intermediate PathFragment allocations.
RELNOTES: None
PiperOrigin-RevId: 152145768
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
Breaks tests that expected previous id generation order.
RELNOTES: None.
PiperOrigin-RevId: 151638886
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
Rolling forward with the correct changes to the AndroidResourceMergingAction. Tested manually.
*** Original change description ***
Automated [] rollback of commit a58f245a4b40c0ef961b1f30d96b16a9349711c3.
*** Reason for rollback ***
broke over 100k targets, in the depot, see []
*** Original change description ***
Move library R generation to a separate action, ensuring the merging happens
off the java critical path.
--
PiperOrigin-RevId: 151087737
MOS_MIGRATED_REVID=151087737
|
|
|
|
|
|
| |
--
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
|
|
|
|
|
|
|
|
| |
android_binary rules whose .apk artifacts get piped through appt to support split apks
--
PiperOrigin-RevId: 150701976
MOS_MIGRATED_REVID=150701976
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
broke over 100k targets, in the depot, see []
*** Original change description ***
Move library R generation to a separate action, ensuring the merging happens
off the java critical path.
--
PiperOrigin-RevId: 150602545
MOS_MIGRATED_REVID=150602545
|
|
|
|
|
|
|
|
| |
off the java critical path.
--
PiperOrigin-RevId: 150460041
MOS_MIGRATED_REVID=150460041
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--experimental_use_parallel_android_resource_processing.
Without that flag, data binding already works via hooks in ApplicationManifest and
AndroidResourceProcessingAction.
The flag replaces AndroidResourceProcessingAction with three smaller processors:
AndroidResourceParsingAction, AndroidResourceMergingAction, and
AndroidResourceValidatorAction. So this change hooks the same logic into
AndroidResourceMergingAction (at the equivalent place where data binding
applies in the other pipeline).
We could alternatively hook this into AndroidResourceValidatorAction (i.e. anywhere
after resource merging completes and before aapt starts). But doing that would block
Java compilation on aapt finishing, which the whole point of the flag is to unblock.
--
PiperOrigin-RevId: 147770236
MOS_MIGRATED_REVID=147770236
|
|
|
|
|
|
|
|
| |
finding actions based on intermediate artifacts.
--
PiperOrigin-RevId: 145303065
MOS_MIGRATED_REVID=145303065
|
|
|
|
|
|
| |
--
PiperOrigin-RevId: 144741831
MOS_MIGRATED_REVID=144741831
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
--experimental_transparent_compression flag
Also add test to ensure lazy strings aren't forced.
--
PiperOrigin-RevId: 142496520
MOS_MIGRATED_REVID=142496520
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
is not yet exposed at the user level.
(https://developer.android.com/topic/libraries/data-binding/index.html).
See comments in DataBinding.java for the high-level overview of
how this works.
This does not yet work with
--experimental_use_parallel_android_resource_processing.
Exposing this at the user level additionally requires:
1) making the data binding support libraries available at an
expected place in the depot
2) Opting in android_binary / android_library rules through a new
"enable_data_binding" attribute.
--
MOS_MIGRATED_REVID=139797558
|
|
|
|
|
|
|
|
|
| |
This was an oversight on my part in the original implementation. As one
example, the Firebase AAR libraries contain AndroidManifest.xml's
with ${applicationId} and Google Play Services contain <meta-data> tags.
--
MOS_MIGRATED_REVID=138198047
|
|
|
|
|
|
|
| |
RELNOTES: When using android_binary.manifest_merger="android" the merger produces a summary log next to the merged manifest artifact.
--
MOS_MIGRATED_REVID=134082985
|
|
|
|
|
|
|
|
|
| |
rules.
The AndroidResourcesProcessorBuilder, AndroidResourceValidatorActionBuilder and AndroidResourceMergingActionBuilder that use the java package specified by the AndroidResourceProvider check if it is not null or empty before using it and default to using the package from the manifest. This CL just allows us to pass null java package from AndroidSdkProvider and does so with aar_import.
--
MOS_MIGRATED_REVID=133883286
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently only uses AndroidManifest.xml, classes.jar and res/ from AARs. This is sufficient for many of the AARs of Google Play Services and Android Support Repository.
The next step will be for AndroidSdkRepositoryRule to scan the SDK and generate aar_import rules for the AARs within.
The rule is not yet documented because it is not intended for end users to use it yet. We should probably support more of the features of AARs before that time. See http://tools.android.com/tech-docs/new-build-system/aar-format for all of the files that can be included in AARs.
Also note that R.txt from the AAR is intentionally ignored and regenerated based on the contents of res/. This is more correct, because the R.txt inside of an AAR can contain ids for dependencies of the AAR that are not included in res/.
See https://github.com/bazelbuild/bazel/issues/564 for discussion of supporting AARs and https://github.com/bazelbuild/bazel/issues/1745 for motivation to get it done soon.
--
MOS_MIGRATED_REVID=133127933
|