1// Copyright (C) 2018 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
15package {
16    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "system_tools_aidl_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["system_tools_aidl_license"],
22}
23
24bootstrap_go_package {
25    name: "aidl-soong-rules",
26    pkgPath: "android/soong/aidl",
27    deps: [
28        "blueprint",
29        "soong",
30        "soong-apex",
31        "soong-android",
32        "soong-cc",
33        "soong-genrule",
34        "soong-phony",
35        "soong-java",
36        "soong-rust",
37    ],
38    srcs: [
39        "aidl_interface.go",
40        "properties.go",
41        "aidl_api.go",
42        "aidl_gen_rule.go",
43        "aidl_interface_backends.go",
44        "aidl_interface_metadata_singleton.go",
45        "aidl_mapping.go",
46        "aidl_rust_source_provider.go",
47        "aidl_utils.go",
48    ],
49    testSrcs: [
50        "aidl_test.go",
51    ],
52    pluginFor: ["soong_build"],
53}
54
55aidl_interfaces_metadata {
56    name: "aidl_metadata_json",
57    visibility: ["//system/tools/aidl:__subpackages__"],
58}
59
60// These configurations are inherited by all aidl-gen modules
61// TODO(b/146436251): default isn't applied because the module is created
62// in PreArchMutators, when import behavior becomes explicit, the logic can
63// be moved back to LoadHook, and then default can be applied as well.
64cc_defaults {
65    name: "aidl-cpp-module-defaults",
66    // TODO(b/31559095): remove when host bionic is available
67    defaults: ["libbinder_ndk_host_user"],
68}
69
70java_defaults {
71    name: "aidl-java-module-defaults",
72}
73
74rust_defaults {
75    name: "aidl-rust-module-defaults",
76}
77
78// Tests
79
80filegroup {
81    name: "aidl-test-filegroup",
82    srcs: [
83        "tests_1/some_package/IFoo.aidl",
84        "tests_1/some_package/Thing.aidl",
85        "tests_1/some_package/sub_package/*.aidl",
86    ],
87}
88
89aidl_interface {
90    name: "test-piece-1",
91    local_include_dir: "tests_1",
92    vendor_available: true,
93    double_loadable: true,
94    host_supported: true,
95    flags: ["-Werror"],
96    srcs: [
97        "tests_1/some_package/IFoo.aidl",
98        "tests_1/some_package/Thing.aidl",
99        "tests_1/some_package/sub_package/*.aidl", // testing glob w/o filegroup
100    ],
101    versions: [
102        "1",
103        "2",
104        "3",
105        "4",
106    ],
107}
108
109aidl_interface {
110    name: "test-piece-2",
111    local_include_dir: "tests_1",
112    flags: ["-Werror"],
113    srcs: [
114        "tests_1/INoPackage.aidl",
115        "tests_1/some_package/IBar.aidl",
116    ],
117    imports: [
118        "test-piece-1",
119    ],
120    backend: {
121        java: {
122            platform_apis: true,
123        },
124    },
125    gen_trace: true,
126    versions: ["1"],
127}
128
129aidl_interface {
130    name: "test-piece-3",
131    local_include_dir: "tests_1",
132    flags: ["-Werror"],
133    srcs: [
134        "tests_1/other_package/IBaz.aidl",
135    ],
136    imports: [
137        "test-piece-2",
138    ],
139    backend: {
140        java: {
141            platform_apis: true,
142        },
143    },
144    gen_trace: true,
145    versions: ["1"],
146}
147
148aidl_interface {
149    name: "test-piece-4",
150    local_include_dir: "tests_2",
151    flags: ["-Werror"],
152    srcs: [
153        "tests_2/another_package/IFaz.aidl",
154    ],
155    imports: [
156        "test-piece-1",
157    ],
158    backend: {
159        java: {
160            platform_apis: true,
161        },
162    },
163    gen_trace: true,
164    versions: ["1"],
165    dumpapi: {
166        no_license: true,
167    },
168}
169
170aidl_interface {
171    name: "test-root-package",
172    flags: ["-Werror"],
173    srcs: [
174        "test_package/IBaz.aidl",
175    ],
176    imports: [
177        "test-piece-2",
178    ],
179    backend: {
180        java: {
181            platform_apis: true,
182        },
183    },
184    gen_trace: true,
185    versions: [
186        "1",
187        "2",
188        "3",
189    ],
190}
191
192aidl_interface {
193    name: "test-piece-5",
194    unstable: true,
195    local_include_dir: "tests_3",
196    flags: ["-Werror"],
197    srcs: [
198        "tests_3/EmptyParcelable.aidl",
199        "tests_3/IEmptyInterface.aidl",
200    ],
201}
202
203// These test that a parcel imported from A->B->C will have the required dependencies to link in
204// all backends (C++ backends need to link direclty against the constructor of the parcelable
205// in order to work)
206aidl_interface {
207    name: "tests_transitive_parcel.a",
208    flags: ["-Werror"],
209    srcs: ["tests_transitive_parcel/a/*.aidl"],
210    imports: [
211        "tests_transitive_parcel.b",
212        "tests_transitive_parcel.c",
213    ],
214    unstable: true,
215    backend: {
216        rust: {
217            enabled: true,
218        },
219    },
220}
221
222aidl_interface {
223    name: "tests_transitive_parcel.b",
224    flags: ["-Werror"],
225    srcs: ["tests_transitive_parcel/b/*.aidl"],
226    imports: ["tests_transitive_parcel.c"],
227    unstable: true,
228    backend: {
229        rust: {
230            enabled: true,
231        },
232    },
233}
234
235aidl_interface {
236    name: "tests_transitive_parcel.c",
237    flags: ["-Werror"],
238    srcs: ["tests_transitive_parcel/c/*.aidl"],
239    unstable: true,
240    backend: {
241        rust: {
242            enabled: true,
243        },
244    },
245}
246