xref: /aosp_15_r20/external/lottie/Android.bp (revision bb5273fecd5c61b9ace70f9ff4fcd88f0e12e3f7)
1package {
2    default_applicable_licenses: ["external_lottie_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18// See: http://go/android-license-faq
19license {
20    name: "external_lottie_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-Apache-2.0",
24    ],
25    license_text: [
26        "LICENSE",
27    ],
28}
29
30license {
31    name: "external_lottie_code_of_conduct_license",
32    visibility: ["//visibility:private"],
33    license_kinds: [
34        "SPDX-license-identifier-CC-BY-SA",
35    ],
36    license_text: [
37        "LICENSE-CC-BY-SA",
38    ],
39}
40
41filegroup {
42    name: "lottie_code_of_conduct",
43    visibility: ["//visibility:private"],
44    srcs: [
45        "CODE_OF_CONDUCT.md",
46    ],
47    licenses: ["external_lottie_code_of_conduct_license"],
48}
49
50android_manifest_package_attribute = "\"com.airbnb.lottie\""
51
52genrule {
53    name: "AddPackageAttributeToAndroidManifest",
54    srcs: [
55        "lottie/src/main/AndroidManifest.xml"
56    ],
57    out: [
58        "lottie/src/main/AndroidManifestGen.xml",
59    ],
60    cmd: "sed -E 's/<manifest>/<manifest package="
61    + android_manifest_package_attribute
62    + ">/g' $(in) > $(out)",
63}
64
65android_library {
66    name: "lottie",
67    srcs: [
68        "lottie/src/main/**/*.java",
69    ],
70    apex_available: [
71        "//apex_available:platform",
72        "com.android.permission",
73    ],
74    resource_dirs: ["lottie/src/main/res/"],
75    static_libs: [
76        "androidx.appcompat_appcompat",
77        "okio-lib",
78    ],
79    manifest: ":AddPackageAttributeToAndroidManifest",
80    sdk_version: "31",
81    min_sdk_version: "21",
82    java_version: "1.8",
83    optimize: {
84        proguard_flags_files: ["proguard.flags"],
85    },
86    // https://github.com/airbnb/lottie-android/issues/2502
87    errorprone: {
88        enabled: false,
89    },
90}
91
92java_library {
93    name: "lottie_compose",
94    srcs: [
95        "lottie-compose/src/main/java/**/*.kt",
96    ],
97    static_libs: [
98        "lottie",
99        "androidx.compose.foundation_foundation",
100        "androidx.compose.runtime_runtime",
101        "androidx.compose.ui_ui",
102    ],
103    sdk_version: "current",
104    min_sdk_version: "21",
105    kotlincflags: [
106        "-Xjvm-default=all",
107        "-Xopt-in=kotlin.RequiresOptIn",
108    ],
109}
110