1//
2// Copyright (C) 2017 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
17cc_defaults {
18    name: "libnativebridge-dummy-defaults",
19    defaults: [
20        "art_defaults",
21        "art_test_defaults",
22    ],
23    // TODO(mast): Split up art_gtest_defaults so that it can be used for the
24    // following without pulling in lots of libs.
25    target: {
26        linux: {
27            cflags: [
28                // gtest issue
29                "-Wno-used-but-marked-unused",
30                "-Wno-deprecated",
31                "-Wno-missing-noreturn",
32            ],
33        },
34    },
35    header_libs: ["libnativebridge-headers"],
36    cppflags: ["-fvisibility=protected"],
37}
38
39cc_library_shared {
40    name: "libnativebridge-dummy",
41    srcs: ["DummyNativeBridge.cpp"],
42    defaults: ["libnativebridge-dummy-defaults"],
43}
44
45cc_library_shared {
46    name: "libnativebridge2-dummy",
47    srcs: ["DummyNativeBridge2.cpp"],
48    defaults: ["libnativebridge-dummy-defaults"],
49}
50
51cc_library_shared {
52    name: "libnativebridge3-dummy",
53    srcs: ["DummyNativeBridge3.cpp"],
54    defaults: ["libnativebridge-dummy-defaults"],
55}
56
57cc_library_shared {
58    name: "libnativebridge6-dummy",
59    srcs: ["DummyNativeBridge6.cpp"],
60    defaults: ["libnativebridge-dummy-defaults"],
61    shared_libs: [
62        "libnativebridge6prezygotefork",
63    ],
64}
65
66// A helper library to produce dummy side effect of PreZygoteForkNativeBridge.
67cc_library_shared {
68    name: "libnativebridge6prezygotefork",
69    srcs: ["NativeBridge6PreZygoteFork_lib.cpp"],
70    defaults: ["libnativebridge-dummy-defaults"],
71}
72
73// Build the unit tests.
74cc_defaults {
75    name: "libnativebridge-tests-defaults",
76    defaults: [
77        "art_defaults",
78        "art_test_defaults",
79    ],
80    test_per_src: true,
81    // TODO(mast): Split up art_gtest_defaults so that it can be used for the
82    // following without pulling in lots of libs.
83    target: {
84        linux: {
85            cflags: [
86                // gtest issue
87                "-Wno-used-but-marked-unused",
88                "-Wno-deprecated",
89                "-Wno-missing-noreturn",
90            ],
91        },
92    },
93
94    srcs: [
95        "CodeCacheCreate_test.cpp",
96        "CodeCacheExists_test.cpp",
97        "CodeCacheStatFail_test.cpp",
98        "CompleteFlow_test.cpp",
99        "InvalidCharsNativeBridge_test.cpp",
100        "NativeBridge2Signal_test.cpp",
101        "NativeBridgeVersion_test.cpp",
102        "NeedsNativeBridge_test.cpp",
103        "PreInitializeNativeBridge_test.cpp",
104        "PreInitializeNativeBridgeFail1_test.cpp",
105        "PreInitializeNativeBridgeFail2_test.cpp",
106        "ReSetupNativeBridge_test.cpp",
107        "UnavailableNativeBridge_test.cpp",
108        "ValidNameNativeBridge_test.cpp",
109        "NativeBridge3UnloadLibrary_test.cpp",
110        "NativeBridge3GetError_test.cpp",
111        "NativeBridge3IsPathSupported_test.cpp",
112        "NativeBridge3InitAnonymousNamespace_test.cpp",
113        "NativeBridge3CreateNamespace_test.cpp",
114        "NativeBridge3LoadLibraryExt_test.cpp",
115        "NativeBridge6PreZygoteFork_test.cpp",
116    ],
117
118    shared_libs: [
119        "liblog",
120        "libnativebridge-dummy",
121        "libnativebridge6prezygotefork",
122    ],
123    header_libs: ["libbase_headers"],
124}
125
126cc_test {
127    name: "libnativebridge-tests",
128    defaults: ["libnativebridge-tests-defaults"],
129    shared_libs: ["libnativebridge"],
130}
131
132cc_test {
133    name: "libnativebridge-lazy-tests",
134    defaults: ["libnativebridge-tests-defaults"],
135    host_supported: false,
136    shared_libs: ["libnativebridge_lazy"],
137}
138
139// Build the test for the C API.
140cc_test {
141    name: "libnativebridge-api-tests",
142    defaults: [
143        "art_defaults",
144        "art_test_defaults",
145    ],
146    test_per_src: true,
147    // TODO(mast): Split up art_gtest_defaults so that it can be used for the
148    // following without pulling in lots of libs.
149    target: {
150        linux: {
151            cflags: [
152                // gtest issue
153                "-Wno-used-but-marked-unused",
154                "-Wno-deprecated",
155                "-Wno-missing-noreturn",
156            ],
157        },
158    },
159    srcs: [
160        "NativeBridgeApi.c",
161    ],
162    header_libs: ["libnativebridge-headers"],
163}
164