• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2022 The Android Open Source Project
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
15load("//build/bazel/rules/apex:apex_info.bzl", "ApexInfo")
16
17InstallableInfo = provider(
18    "If a target provides InstallableInfo, it means it can be installed on a partition image.",
19    fields = {
20        "files": "A dictionary mapping from a path in the partition to the path to the file to install there.",
21    },
22)
23
24def _installable_aspect_impl(target, _ctx):
25    installed_files = {}
26    if ApexInfo in target:
27        apex = target[ApexInfo].signed_output
28        installed_files["/system/apex/" + apex.basename] = apex
29
30    if not installed_files:
31        return []
32
33    return [
34        InstallableInfo(
35            files = installed_files,
36        ),
37    ]
38
39# This aspect is intended to be applied on a apex.native_shared_libs attribute
40installable_aspect = aspect(
41    implementation = _installable_aspect_impl,
42    attrs = {},
43)
44