1//
2// Copyright (C) 2016 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17// apksig library, for signing APKs and verifying signatures of APKs
18// ============================================================
19package {
20    default_applicable_licenses: ["tools_apksig_license"],
21}
22
23// Added automatically by a large-scale-change
24// http://go/android-license-faq
25license {
26    name: "tools_apksig_license",
27    visibility: [":__subpackages__"],
28    license_kinds: [
29        "SPDX-license-identifier-Apache-2.0",
30    ],
31    license_text: [
32        "LICENSE",
33    ],
34}
35
36java_library_host {
37    name: "apksig",
38    srcs: ["src/main/java/**/*.java"],
39    exclude_srcs: [
40        "src/main/java/com/android/apksig/kms/aws/**/*.java",
41        "src/main/java/com/android/apksig/kms/gcp/**/*.java",
42    ],
43    java_version: "1.8",
44    target: {
45        windows: {
46            enabled: true,
47        },
48    },
49}
50
51java_library_host {
52    name: "apksig-kms-provider-aws",
53    srcs: [
54        "src/main/java/com/android/apksig/kms/aws/**/*.java",
55    ],
56    libs: [
57        "apksig",
58        "awssdk-kms",
59        "awssdk-url-connection-client",
60    ],
61    services: ["src/providers/aws/*"],
62    java_version: "1.8",
63    target: {
64        windows: {
65            enabled: true,
66        },
67    },
68}
69
70java_library_host {
71    name: "apksig-kms-provider-gcp",
72    srcs: [
73        "src/main/java/com/android/apksig/kms/gcp/**/*.java",
74    ],
75    libs: [
76        "apksig",
77        "google-cloud-kms",
78    ],
79    services: ["src/providers/gcp/*"],
80    java_version: "1.8",
81    target: {
82        windows: {
83            enabled: true,
84        },
85    },
86}
87
88// apksigner command-line tool for signing APKs and verifying their signatures
89// ============================================================
90java_defaults {
91    name: "apksigner-defaults",
92    srcs: ["src/apksigner/java/**/*.java"],
93    java_resource_dirs: ["src/apksigner/java"],
94    manifest: "src/apksigner/apksigner.mf",
95    static_libs: ["conscrypt-unbundled"],
96    java_version: "1.8",
97    target: {
98        not_windows: {
99            jni_libs: ["libconscrypt_openjdk_jni"],
100        },
101    },
102}
103
104java_binary_host {
105    name: "apksigner",
106    defaults: ["apksigner-defaults"],
107    wrapper: "etc/apksigner",
108    static_libs: ["apksig"],
109    target: {
110        windows: {
111            enabled: true,
112            wrapper: "etc/apksigner.bat",
113        },
114    },
115}
116
117java_binary_host {
118    name: "apksigner-kms",
119    defaults: ["apksigner-defaults"],
120    wrapper: "etc/apksigner-kms",
121    static_libs: [
122        "apksig",
123        "apksig-kms-provider-aws",
124        "apksig-kms-provider-gcp",
125        "awssdk-kms",
126        "awssdk-url-connection-client",
127        "conscrypt-unbundled",
128        "google-api-java-client-assembly",
129        "google-auth-library-java-credentials",
130        "google-auth-library-java-oauth2_http",
131        "google-cloud-kms",
132        "grpc-java-api",
133        "grpc-java-auth",
134        "grpc-java-context",
135        "grpc-java-core",
136        "grpc-java-core-internal",
137        "grpc-java-core-util",
138        "grpc-java-netty-shaded",
139        "grpc-java-protobuf",
140        "grpc-java-protobuf-lite",
141        "grpc-java-stub",
142        "gson",
143        "guava",
144        "libprotobuf-java-util-full",
145        "opencensus-java-api",
146        "opencensus-java-contrib-grpc-metrics",
147        "opencensus-java-contrib-http-util",
148        "perfmark",
149        "slf4j-api",
150        "threetenbp",
151    ],
152    target: {
153        windows: {
154            enabled: true,
155            wrapper: "etc/apksigner-kms.bat",
156        },
157    },
158}
159
160java_test_host {
161    name: "apksig-test",
162    srcs: ["src/test/java/**/*.java"],
163    exclude_srcs: [
164        "src/test/java/com/android/apksig/kms/KeyWrapper.java",
165        "src/test/java/com/android/apksig/kms/aws/AwsTestData.java",
166        "src/test/java/com/android/apksig/kms/gcp/GcpTestData.java",
167    ],
168    java_resource_dirs: ["src/test/resources"],
169    static_libs: [
170        "apksig",
171        "awssdk-kms",
172        "awssdk-url-connection-client",
173        "bouncycastle-unbundled",
174        "conscrypt-unbundled",
175        "google-api-java-client-assembly",
176        "google-auth-library-java-credentials",
177        "google-auth-library-java-oauth2_http",
178        "junit",
179        "google-cloud-kms",
180        "libprotobuf-java-util-full",
181        "slf4j-api",
182    ],
183}
184