blob: 07ba4142114ebf5f93027bee78fe845c71e7f7a7 [file] [log] [blame]
Colin Cross4c609952017-10-18 13:00:01 -07001// Copyright (C) 2011 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
15java_library_static {
16 name: "dexmaker",
17
18 // Include all the java files.
19 srcs: ["dexmaker/src/main/java/**/*.java"],
20
21 static_libs: [
22 "dexmaker-dx-target",
Colin Cross4c609952017-10-18 13:00:01 -070023 ],
24
Neil Fullerbc1141d2018-10-09 17:29:21 +010025 sdk_version: "core_current",
Colin Cross4c609952017-10-18 13:00:01 -070026}
27
28// Build Dexmaker's MockMaker, a plugin to Mockito
29java_library_static {
30 name: "dexmaker-mockmaker",
Neil Fullerbc1141d2018-10-09 17:29:21 +010031 sdk_version: "core_current",
Colin Cross4c609952017-10-18 13:00:01 -070032 srcs: ["dexmaker-mockito/src/main/java/**/*.java"],
33 java_resource_dirs: ["dexmaker-mockito/src/main/resources"],
34 libs: [
35 "dexmaker",
36 "mockito-api",
37 ],
38}
39
Philip P. Moltmann43b4c622017-11-20 09:38:54 -080040// Build dispatcher for Dexmaker's inline MockMaker
41java_library_static {
42 name: "dexmaker-inline-mockmaker-dispatcher",
Philip P. Moltmannd4a20562018-03-13 13:11:07 -070043 sdk_version: "current",
Philip P. Moltmann43b4c622017-11-20 09:38:54 -080044 srcs: ["dexmaker-mockito-inline-dispatcher/src/main/java/**/*.java"],
45}
46
Andreas Gampea884f902018-01-18 21:29:41 -080047// Defaults for agent code.
48cc_defaults {
49 name: "dexmaker_agent_defaults",
50
51 // Compile with the NDK, so that the agent can be used in apps.
52 sdk_version: "current",
53 stl: "libc++_static",
Philip P. Moltmann43b4c622017-11-20 09:38:54 -080054
55 host_supported: false,
56 device_supported: true,
57
58 rtti: true,
59
60 cflags: [
61 "-std=c++11",
62 "-Wall",
63 "-Werror",
64 "-Wno-unused-parameter",
65 "-Wno-shift-count-overflow",
66 "-Wno-error=non-virtual-dtor",
67 "-Wno-sign-compare",
68 "-Wno-switch",
69 "-Wno-missing-braces",
70 ],
71
72 static_libs: [
Andreas Gampea884f902018-01-18 21:29:41 -080073 "slicer_ndk",
Philip P. Moltmann43b4c622017-11-20 09:38:54 -080074 ],
75
76 shared_libs: [
77 "libz",
78 ],
79
Andreas Gampea884f902018-01-18 21:29:41 -080080 include_dirs: [
81 "art/openjdkjvmti/include",
Philip P. Moltmann43b4c622017-11-20 09:38:54 -080082 ],
83}
84
Andreas Gampea884f902018-01-18 21:29:41 -080085// Build agent for Dexmaker's inline MockMaker
86cc_library_shared {
87 name: "libdexmakerjvmtiagent",
88 defaults: [
89 "dexmaker_agent_defaults",
90 ],
91 srcs: ["dexmaker-mockito-inline/src/main/jni/**/*.cc"],
92}
93
Philip P. Moltmann70402ca2018-08-28 16:57:52 +000094// Build agent for Dexmaker's extended MockMaker
95cc_library_shared {
96 name: "libstaticjvmtiagent",
97 defaults: [
98 "dexmaker_agent_defaults",
99 ],
100 srcs: ["dexmaker-mockito-inline-extended/src/main/jni/**/*.cc"],
101}
102
Philip P. Moltmann43b4c622017-11-20 09:38:54 -0800103// Build agent for Dexmaker's inline tests
104cc_library_shared {
105 name: "libmultiplejvmtiagentsinterferenceagent",
Andreas Gampea884f902018-01-18 21:29:41 -0800106 defaults: [
107 "dexmaker_agent_defaults",
108 ],
Philip P. Moltmann43b4c622017-11-20 09:38:54 -0800109 srcs: ["dexmaker-mockito-inline-tests/src/main/jni/**/*.cc"],
Philip P. Moltmann43b4c622017-11-20 09:38:54 -0800110}
111
112// Build Dexmaker's inline MockMaker, a plugin to Mockito
113java_library_static {
114 name: "dexmaker-inline-mockmaker",
Philip P. Moltmannd4a20562018-03-13 13:11:07 -0700115 sdk_version: "current",
Philip P. Moltmann43b4c622017-11-20 09:38:54 -0800116 srcs: ["dexmaker-mockito-inline/src/main/java/**/*.java"],
117 java_resource_dirs: ["dexmaker-mockito-inline/src/main/resources"],
118 libs: [
119 "dexmaker",
120 "mockito-api",
121 ],
122 required: ["libdexmakerjvmtiagent"],
Philip P. Moltmann70402ca2018-08-28 16:57:52 +0000123}
Philip P. Moltmannd4a20562018-03-13 13:11:07 -0700124
Philip P. Moltmann70402ca2018-08-28 16:57:52 +0000125// Build Dexmaker's extended MockMaker, a plugin to Mockito
126java_library_static {
127 name: "dexmaker-extended-mockmaker",
128 sdk_version: "current",
129 srcs: ["dexmaker-mockito-inline-extended/src/main/java/**/*.java"],
130
131 java_resource_dirs: ["dexmaker-mockito-inline/src/main/resources"],
132
133 libs: [
134 "dexmaker",
135 "mockito-api",
136 "dexmaker-inline-mockmaker",
137 ],
138 required: [
139 "libdexmakerjvmtiagent",
140 "libstaticjvmtiagent"
141 ],
142}
143
144// Provides mockito functionality for on-device tests. Does not allow stubbing of final or static
145// methods.
146java_library_static {
147 name: "mockito-target",
148 no_framework_libs: true,
149 static_libs: [
150 "mockito-target-minus-junit4",
151 "junit",
152 ],
Neil Fullerbc1141d2018-10-09 17:29:21 +0100153 sdk_version: "core_current",
Philip P. Moltmann70402ca2018-08-28 16:57:52 +0000154}
155
156// Same as mockito-target but does not bundle junit
157java_library_static {
158 name: "mockito-target-minus-junit4",
159 no_framework_libs: true,
160 static_libs: [
161 "mockito",
162 "dexmaker",
163 "dexmaker-mockmaker",
164 "objenesis",
165 ],
166 libs: ["junit"],
Neil Fullerbc1141d2018-10-09 17:29:21 +0100167 sdk_version: "core_current",
Philip P. Moltmann70402ca2018-08-28 16:57:52 +0000168
169 java_version: "1.7",
170}
171
172// Provides mockito functionality for on-device tests. Allows stubbing of final methods. Does not
173// allow stubbing of static methods.
174// Project depending on this also need to depend on the static JNI library libdexmakerjvmtiagent
175java_library_static {
176 name: "mockito-target-inline",
177 no_framework_libs: true,
178 static_libs: [
179 "mockito-target-inline-minus-junit4",
180 "junit",
181 ],
182 sdk_version: "current",
183}
184
185// Same as mockito-target-inline but does not bundle junit
186java_library_static {
187 name: "mockito-target-inline-minus-junit4",
188 no_framework_libs: true,
189 static_libs: [
190 "mockito",
191 "dexmaker",
192 "dexmaker-inline-mockmaker",
193 "objenesis",
194 ],
195 libs: ["junit"],
196 sdk_version: "current",
197
198 java_version: "1.7",
199}
200
201// Provides mockito functionality for on-device tests. Allows stubbing of final and static methods.
202// Stubbing static methods is not an official mockito API.
203// Project depending on this also need to depend on the static JNI libraries libstaticjvmtiagent and
204// libdexmakerjvmtiagent
205java_library_static {
206 name: "mockito-target-extended",
207 no_framework_libs: true,
208 static_libs: [
209 "mockito-target-extended-minus-junit4",
210 "junit",
211 ],
212 sdk_version: "current",
213}
214
215// Same as mockito-target-extended but does not bundle junit
216java_library_static {
217 name: "mockito-target-extended-minus-junit4",
218 no_framework_libs: true,
219 static_libs: [
220 "mockito",
221 "dexmaker",
222 "dexmaker-inline-mockmaker",
223 "dexmaker-extended-mockmaker",
224 "objenesis",
225 ],
226 libs: ["junit"],
227 sdk_version: "current",
228
229 java_version: "1.7",
Philip P. Moltmann43b4c622017-11-20 09:38:54 -0800230}
231
Colin Cross4c609952017-10-18 13:00:01 -0700232java_import {
233 name: "dexmaker-dx-target",
Philip P. Moltmannaa1c0e92018-12-05 08:46:19 -0800234 jars: ["lib/dalvik-dx-9.0.0_r3.jar"],
Colin Cross4c609952017-10-18 13:00:01 -0700235}
Philip P. Moltmann70402ca2018-08-28 16:57:52 +0000236
237// dexmaker tests
238java_library_static {
239 name: "dexmaker-tests-lib",
240 sdk_version: "current",
241 srcs: ["dexmaker-tests/src/androidTest/java/**/*.java"],
242
243 libs: [
Brett Chabot8d384cf2019-02-06 21:09:21 -0800244 "androidx.test.rules",
Philip P. Moltmann70402ca2018-08-28 16:57:52 +0000245 "dexmaker",
246 "junit",
247 ],
248}
249
250// dexmaker-mockito tests
251java_library_static {
252 name: "dexmaker-mockmaker-tests",
253 sdk_version: "current",
254 srcs: ["dexmaker-mockito-tests/src/main/java/**/*.java"],
255
256 libs: [
Brett Chabot8d384cf2019-02-06 21:09:21 -0800257 "androidx.test.rules",
Philip P. Moltmann70402ca2018-08-28 16:57:52 +0000258 "dexmaker",
259 "mockito",
260 "junit",
261 "dexmaker-mockmaker",
262 ],
263}
264
265// dexmaker-mockito-inline tests
266java_library_static {
267 name: "dexmaker-inline-mockmaker-tests",
268 sdk_version: "current",
269 srcs: ["dexmaker-mockito-inline-tests/src/main/java/**/*.java"],
270
271 libs: [
Brett Chabot8d384cf2019-02-06 21:09:21 -0800272 "androidx.test.rules",
Philip P. Moltmann70402ca2018-08-28 16:57:52 +0000273 "dexmaker",
274 "android-support-v4",
275 "mockito",
276 "junit",
277 "dexmaker-inline-mockmaker",
278 ],
279}
280
281// dexmaker-mockito-extended tests
282java_library_static {
283 name: "dexmaker-extended-mockmaker-tests",
284 sdk_version: "current",
285 srcs: ["dexmaker-mockito-inline-extended-tests/src/main/java/**/*.java"],
286
287 libs: [
Brett Chabot8d384cf2019-02-06 21:09:21 -0800288 "androidx.test.rules",
Philip P. Moltmann70402ca2018-08-28 16:57:52 +0000289 "dexmaker",
290 "android-support-v4",
291 "mockito",
292 "junit",
293 "dexmaker-extended-mockmaker",
294 ],
295}
Sasha Smundakc71c1f32019-01-29 12:54:20 -0800296
297/*
298 * To run the tests:
299 * atest DexmakerTests
300 */
301
302android_test {
303 name: "DexmakerTests",
304 sdk_version: "current",
305 static_libs: [
306 "dexmaker-tests-lib",
307 "dexmaker",
Brett Chabot8d384cf2019-02-06 21:09:21 -0800308 "androidx.test.rules",
Sasha Smundakc71c1f32019-01-29 12:54:20 -0800309 "junit",
310 ],
311}