1# Copyright 2021 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"""android_feature_module rule. 16 17This file exists to inject the correct version of android_binary and android_library. 18""" 19 20load( 21 ":android_feature_module_rule.bzl", 22 _android_feature_module_macro = "android_feature_module_macro", 23) 24load( 25 "//rules:android_binary.bzl", 26 _android_binary = "android_binary", 27) 28load( 29 "//rules/android_library:rule.bzl", 30 _android_library_macro = "android_library_macro", 31) 32 33def android_feature_module(**attrs): 34 """Macro to declare a Dynamic Feature Module. 35 36 Generates the following: 37 38 * strings.xml containing a unique split identifier (currently a hash of the fully qualified target label) 39 * dummy AndroidManifest.xml for the split 40 * `android_library` to create the split resources 41 * `android_feature_module` rule to be consumed by `android_application` 42 43 **Attributes** 44 45 Name | Description 46 --- | --- 47 name | Required string, split name 48 custom_package | Optional string, custom package for this split 49 manifest | Required label, the AndroidManifest.xml to use for this module. 50 library | Required label, the `android_library` contained in this split. Must only contain assets. 51 title | Required string, the split title 52 feature_flags | Optional dict, pass through feature_flags dict for native split binary. 53 """ 54 _android_feature_module_macro( 55 _android_binary = _android_binary, 56 _android_library = _android_library_macro, 57 **attrs 58 ) 59