aboutsummaryrefslogtreecommitdiff
path: root/rules/android_application/android_feature_module.bzl
blob: 840d96176b65c32addc09e6691d5e07326993d85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Copyright 2021 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""android_feature_module rule.

This file exists to inject the correct version of android_binary and android_library.
"""

load(
    ":android_feature_module_rule.bzl",
    _android_feature_module_macro = "android_feature_module_macro",
)
load(
    "@rules_android//rules:android_binary.bzl",
    _android_binary = "android_binary",
)
load(
    "@rules_android//rules/android_library:rule.bzl",
    _android_library_macro = "android_library_macro",
)

def android_feature_module(**attrs):
    """Macro to declare a Dynamic Feature Module.

    Generates the following:

    * strings.xml containing a unique split identifier (currently a hash of the fully qualified target label)
    * dummy AndroidManifest.xml for the split
    * `android_library` to create the split resources
    * `android_feature_module` rule to be consumed by `android_application`

    **Attributes**

    Name | Description
    --- | ---
    name | Required string, split name
    custom_package | Optional string, custom package for this split
    manifest | Required label, the AndroidManifest.xml to use for this module.
    library | Required label, the `android_library` contained in this split. Must only contain assets.
    title | Required string, the split title
    feature_flags | Optional dict, pass through feature_flags dict for native split binary.
    """
    _android_feature_module_macro(
        _android_binary = _android_binary,
        _android_library = _android_library_macro,
        **attrs
    )