• Peter Wen's avatar
    Android: Improve type filtering, add __assetres · c8827ca3
    Peter Wen authored
    Add _java_resource_types, _java_library_types, and _java_leaf_types.
    These types, together with "group", define all existing invoker.type
    values for all java targets. Since leaf types like android_apk are not
    used as dependencies for other java targets, all java targets in deps
    trees can be defined as either resources, libraries, or groups.
    
    Naming conventions have also been improved. Now java targets must match
    _java_resource_patterns if the target is a resource target. Otherwise,
    it must match _java_library_patterns if the target is a library target.
    Group targets can match either of those, but should prefer matching
    _java_library_patterns since they are treated as library targets in the
    java_group template.
    
    Thus, target filtering is now simplified. To filter for resource targets
    , simply use _java_resource_patterns. To filter for library targets, use
    _java_library_patterns and ignore the ones that also match
    _java_resource_patterns. To filter for any java target, use
    _java_target_patterns, which is a simple concatenation of the other two
    lists of patterns.
    
    The assert in write_build_config has been updated to enforce naming
    schemes accordingly. This enables assumptions about library and resource
    targets such as __header, __impl, and the newly added __assetres, which
    is defined on library targets to be its transitive list of all resource
    target deps.
    
    Now compile_resources targets can filter their deps so that they only
    depend on transitive resource deps. This allows compile_resources to
    not depend on java library targets, and unblocks header generation for
    apk targets. Previously an apk's __header target would depend on
    compile_resources to finish, while the compile_resources target would
    depend on the rest of the java library dependencies (not headers),
    completely removing any benefit of header compilation for apk targets.
    
    Bug: 1090812
    Change-Id: Ic3c254db9f4d1af2182059119718f15b40957ce9
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220585
    Commit-Queue: Peter Wen <wnwen@chromium.org>
    Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
    Auto-Submit: Peter Wen <wnwen@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#775081}
    c8827ca3
internal_rules.gni 150 KB