blob: ac1eb04d1d1813ad8eae3e0693d9766b467cf986 [file] [log] [blame]
The Android Open Source Project46c012c2008-10-21 07:00:00 -07001#
Christopher Wiley130e6862015-10-18 17:53:11 -07002# Copyright (C) 2015 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
17LOCAL_PATH := $(call my-dir)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070018
Christopher Wileyc5a9e282015-10-23 11:45:28 -070019aidl_cflags := -Wall -Wextra -Werror
Christopher Wileye392ed72015-11-20 14:32:44 -080020aidl_static_libraries := libbase libcutils
21
22aidl_module_host_os := darwin linux windows
23ifdef BRILLO
24 aidl_module_host_os := darwin linux
25endif
Christopher Wileyc5a9e282015-10-23 11:45:28 -070026
Joe Onorato54fba422010-06-10 18:34:55 -070027# This tool is prebuilt if we're doing an app-only build.
Ying Wangc7cf53e2014-03-07 15:55:14 -080028ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
Joe Onorato54fba422010-06-10 18:34:55 -070029
Christopher Wiley3616d132015-09-01 11:07:48 -070030# Logic shared between aidl and its unittests
The Android Open Source Project46c012c2008-10-21 07:00:00 -070031include $(CLEAR_VARS)
Christopher Wiley3616d132015-09-01 11:07:48 -070032LOCAL_MODULE := libaidl-common
Christopher Wileye392ed72015-11-20 14:32:44 -080033LOCAL_MODULE_HOST_OS := $(aidl_module_host_os)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070034
Christopher Wiley4427d862015-09-14 11:07:39 -070035LOCAL_C_INCLUDES := external/gtest/include
Christopher Wileyc5a9e282015-10-23 11:45:28 -070036LOCAL_CLANG_CFLAGS := $(aidl_cflags)
Christopher Wileye0146cf2015-08-24 15:06:58 -070037# Tragically, the code is riddled with unused parameters.
38LOCAL_CLANG_CFLAGS += -Wno-unused-parameter
39# yacc dumps a lot of code *just in case*.
40LOCAL_CLANG_CFLAGS += -Wno-unused-function
41LOCAL_CLANG_CFLAGS += -Wno-unneeded-internal-declaration
42# yacc is a tool from a more civilized age.
43LOCAL_CLANG_CFLAGS += -Wno-deprecated-register
44# yacc also has a habit of using char* over const char*.
45LOCAL_CLANG_CFLAGS += -Wno-writable-strings
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070046LOCAL_STATIC_LIBRARIES := $(aidl_static_libraries)
Christopher Wileye0146cf2015-08-24 15:06:58 -070047
The Android Open Source Project46c012c2008-10-21 07:00:00 -070048LOCAL_SRC_FILES := \
Christopher Wiley89e35862015-08-30 10:57:07 -070049 aidl.cpp \
50 aidl_language.cpp \
Ying Wang3000e752016-01-11 18:05:59 -080051 aidl_language_l.ll \
52 aidl_language_y.yy \
Christopher Wileyf600a552015-09-12 14:07:44 -070053 ast_cpp.cpp \
Christopher Wiley038485e2015-09-12 11:14:14 -070054 ast_java.cpp \
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070055 code_writer.cpp \
Christopher Wileyeb1acc12015-09-16 11:25:13 -070056 generate_cpp.cpp \
Christopher Wiley89e35862015-08-30 10:57:07 -070057 generate_java.cpp \
58 generate_java_binder.cpp \
Christopher Wiley72877ac2015-10-06 14:41:42 -070059 import_resolver.cpp \
Christopher Wileyef140932015-11-03 09:29:19 -080060 line_reader.cpp \
Christopher Wiley4a2884b2015-10-07 11:27:45 -070061 io_delegate.cpp \
Christopher Wiley89e35862015-08-30 10:57:07 -070062 options.cpp \
Christopher Wileya8a2dc02015-09-28 16:35:31 -070063 type_cpp.cpp \
Christopher Wiley775fa1f2015-09-22 15:00:12 -070064 type_java.cpp \
Christopher Wileyfb4b22d2015-09-25 15:16:13 -070065 type_namespace.cpp \
The Android Open Source Project46c012c2008-10-21 07:00:00 -070066
Christopher Wiley3616d132015-09-01 11:07:48 -070067include $(BUILD_HOST_STATIC_LIBRARY)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070068
Christopher Wiley3616d132015-09-01 11:07:48 -070069
70# aidl executable
71include $(CLEAR_VARS)
72LOCAL_MODULE := aidl
73
Christopher Wileye392ed72015-11-20 14:32:44 -080074LOCAL_MODULE_HOST_OS := $(aidl_module_host_os)
Christopher Wileyc5a9e282015-10-23 11:45:28 -070075LOCAL_CFLAGS := $(aidl_cflags)
Christopher Wiley4427d862015-09-14 11:07:39 -070076LOCAL_C_INCLUDES := external/gtest/include
Christopher Wiley89eaab52015-09-15 14:46:46 -070077LOCAL_SRC_FILES := main_java.cpp
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070078LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070079include $(BUILD_HOST_EXECUTABLE)
80
Christopher Wileya590de82015-09-15 15:46:28 -070081# aidl-cpp executable
82include $(CLEAR_VARS)
83LOCAL_MODULE := aidl-cpp
84
Christopher Wileye392ed72015-11-20 14:32:44 -080085LOCAL_MODULE_HOST_OS := $(aidl_module_host_os)
Christopher Wileyc5a9e282015-10-23 11:45:28 -070086LOCAL_CFLAGS := $(aidl_cflags)
Christopher Wileya590de82015-09-15 15:46:28 -070087LOCAL_C_INCLUDES := external/gtest/include
88LOCAL_SRC_FILES := main_cpp.cpp
89LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
90include $(BUILD_HOST_EXECUTABLE)
91
Casey Dahlind8cc5092015-08-28 15:46:48 -070092# Unit tests
93include $(CLEAR_VARS)
94LOCAL_MODULE := aidl_unittests
Christopher Wileyf047e022015-11-13 14:42:00 -080095LOCAL_MODULE_HOST_OS := darwin linux
Christopher Wiley3616d132015-09-01 11:07:48 -070096
Christopher Wileyc5a9e282015-10-23 11:45:28 -070097LOCAL_CFLAGS := $(aidl_cflags) -g -DUNIT_TEST
Christopher Wiley856a8692015-08-31 17:36:41 -070098# Tragically, the code is riddled with unused parameters.
99LOCAL_CLANG_CFLAGS := -Wno-unused-parameter
Christopher Wiley3616d132015-09-01 11:07:48 -0700100LOCAL_SRC_FILES := \
Christopher Wiley90be4e32015-10-20 14:55:25 -0700101 aidl_unittest.cpp \
Christopher Wileyf600a552015-09-12 14:07:44 -0700102 ast_cpp_unittest.cpp \
Christopher Wileyfdeb0f42015-09-11 15:38:22 -0700103 ast_java_unittest.cpp \
Casey Dahlina834dd42015-09-23 11:52:15 -0700104 generate_cpp_unittest.cpp \
Christopher Wiley3616d132015-09-01 11:07:48 -0700105 options_unittest.cpp \
Christopher Wiley856a8692015-08-31 17:36:41 -0700106 tests/end_to_end_tests.cpp \
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700107 tests/fake_io_delegate.cpp \
Christopher Wileydb6c7112015-10-18 12:10:12 -0700108 tests/main.cpp \
Christopher Wileyaf2d5102015-10-18 11:36:23 -0700109 tests/test_data_example_interface.cpp \
110 tests/test_data_ping_responder.cpp \
Christopher Wileyea6e3822015-10-07 13:16:34 -0700111 tests/test_util.cpp \
Christopher Wileya8a2dc02015-09-28 16:35:31 -0700112 type_cpp_unittest.cpp \
Christopher Wiley4582ecb2015-09-25 13:27:45 -0700113 type_java_unittest.cpp \
Christopher Wiley856a8692015-08-31 17:36:41 -0700114
Christopher Wiley3616d132015-09-01 11:07:48 -0700115LOCAL_STATIC_LIBRARIES := \
116 libaidl-common \
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -0700117 $(aidl_static_libraries) \
Christopher Wiley3616d132015-09-01 11:07:48 -0700118 libgmock_host \
119 libgtest_host \
Christopher Wileyf321efd2015-09-01 12:39:25 -0700120
Christopher Wileyc545b7c2015-09-01 18:36:44 -0700121LOCAL_LDLIBS_linux := -lrt
Casey Dahlind8cc5092015-08-28 15:46:48 -0700122include $(BUILD_HOST_NATIVE_TEST)
123
Ying Wangc7cf53e2014-03-07 15:55:14 -0800124endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700125
Christopher Wileyd0724f62015-11-19 07:25:29 -0800126#
127# Everything below here is used for integration testing of generated AIDL code.
128#
129aidl_integration_test_cflags := $(aidl_cflags) -Wunused-parameter
130aidl_integration_test_shared_libs := \
Christopher Wileyc7958332016-02-01 09:56:03 -0800131 libbase \
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700132 libbinder \
133 liblog \
134 libutils
Christopher Wileyd0724f62015-11-19 07:25:29 -0800135
136include $(CLEAR_VARS)
137LOCAL_MODULE := libaidl-integration-test
138LOCAL_MODULE_CLASS := SHARED_LIBRARIES
139LOCAL_CFLAGS := $(aidl_integration_test_cflags)
Christopher Wileyc7958332016-02-01 09:56:03 -0800140LOCAL_SHARED_LIBRARIES := $(aidl_integration_test_shared_libs)
Samuel Tan88c32002015-12-03 16:30:43 -0800141LOCAL_AIDL_INCLUDES := \
142 system/tools/aidl/tests/ \
Samuel Tan13ace342016-01-12 16:18:22 -0800143 frameworks/native/aidl/binder
Christopher Wileyd0724f62015-11-19 07:25:29 -0800144LOCAL_SRC_FILES := \
145 tests/android/aidl/tests/ITestService.aidl \
Christopher Wiley996775a2015-11-19 07:03:45 -0800146 tests/android/aidl/tests/INamedCallback.aidl \
147 tests/simple_parcelable.cpp
Christopher Wileyd0724f62015-11-19 07:25:29 -0800148include $(BUILD_SHARED_LIBRARY)
149
150include $(CLEAR_VARS)
151LOCAL_MODULE := aidl_test_service
152LOCAL_CFLAGS := $(aidl_integration_test_cflags)
153LOCAL_SHARED_LIBRARIES := \
154 libaidl-integration-test \
155 $(aidl_integration_test_shared_libs)
156LOCAL_SRC_FILES := \
157 tests/aidl_test_service.cpp
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700158include $(BUILD_EXECUTABLE)
159
160include $(CLEAR_VARS)
Christopher Wiley33ad81e2015-10-21 14:41:11 -0700161LOCAL_MODULE := aidl_test_client
Christopher Wileyd0724f62015-11-19 07:25:29 -0800162LOCAL_CFLAGS := $(aidl_integration_test_cflags)
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700163LOCAL_SHARED_LIBRARIES := \
Christopher Wileyd0724f62015-11-19 07:25:29 -0800164 libaidl-integration-test \
165 $(aidl_integration_test_shared_libs)
166LOCAL_SRC_FILES := \
Samuel Tan546d27d2015-12-03 15:06:01 -0800167 tests/aidl_test_client.cpp \
Christopher Wiley7621d4d2015-11-28 16:58:06 -0800168 tests/aidl_test_client_file_descriptors.cpp \
Samuel Tan546d27d2015-12-03 15:06:01 -0800169 tests/aidl_test_client_parcelables.cpp \
Casey Dahlin57dbe242015-12-04 11:44:02 -0800170 tests/aidl_test_client_nullables.cpp \
Christopher Wiley7621d4d2015-11-28 16:58:06 -0800171 tests/aidl_test_client_primitives.cpp \
Christopher Wileydca2ecf2016-01-29 10:55:43 -0800172 tests/aidl_test_client_utf8_strings.cpp \
Christopher Wiley7621d4d2015-11-28 16:58:06 -0800173 tests/aidl_test_client_service_exceptions.cpp
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700174include $(BUILD_EXECUTABLE)
Christopher Wiley130e6862015-10-18 17:53:11 -0700175
Christopher Wiley2971cf32015-10-23 11:50:21 -0700176include $(CLEAR_VARS)
177LOCAL_MODULE := aidl_test_sentinel_searcher
178LOCAL_SRC_FILES := tests/aidl_test_sentinel_searcher.cpp
Christopher Wileyd0724f62015-11-19 07:25:29 -0800179LOCAL_CFLAGS := $(aidl_integration_test_cflags)
Christopher Wiley2971cf32015-10-23 11:50:21 -0700180include $(BUILD_EXECUTABLE)
181
Christopher Wiley130e6862015-10-18 17:53:11 -0700182
183# aidl on its own doesn't need the framework, but testing native/java
184# compatibility introduces java dependencies.
185ifndef BRILLO
186
187include $(CLEAR_VARS)
188LOCAL_PACKAGE_NAME := aidl_test_services
Christopher Wiley34bbc7b2015-11-09 09:24:36 -0800189# Turn off Java optimization tools to speed up our test iterations.
Christopher Wiley34bbc7b2015-11-09 09:24:36 -0800190LOCAL_PROGUARD_ENABLED := disabled
Christopher Wiley130e6862015-10-18 17:53:11 -0700191LOCAL_DEX_PREOPT := false
192LOCAL_CERTIFICATE := platform
193LOCAL_MANIFEST_FILE := tests/java_app/AndroidManifest.xml
Christopher Wiley130e6862015-10-18 17:53:11 -0700194LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/tests/java_app/resources
195LOCAL_SRC_FILES := \
Christopher Wiley521bb612015-10-22 11:40:30 -0700196 tests/android/aidl/tests/ITestService.aidl \
Casey Dahlin389781f2015-10-22 13:13:21 -0700197 tests/android/aidl/tests/INamedCallback.aidl \
Christopher Wiley996775a2015-11-19 07:03:45 -0800198 tests/java_app/src/android/aidl/tests/SimpleParcelable.java \
Christopher Wiley521bb612015-10-22 11:40:30 -0700199 tests/java_app/src/android/aidl/tests/TestServiceClient.java
Samuel Tan13ace342016-01-12 16:18:22 -0800200LOCAL_AIDL_INCLUDES := \
201 system/tools/aidl/tests/ \
202 frameworks/native/aidl/binder
Christopher Wiley130e6862015-10-18 17:53:11 -0700203include $(BUILD_PACKAGE)
204
205endif # not defined BRILLO