blob: dcf24558e6a7571b9c80795ed1553c82156a0c04 [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 \
51 aidl_language_l.l \
52 aidl_language_y.y \
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 Wileyb5e698c2015-10-17 09:32:22 -0700131 libbinder \
132 liblog \
133 libutils
Christopher Wileyd0724f62015-11-19 07:25:29 -0800134
135include $(CLEAR_VARS)
136LOCAL_MODULE := libaidl-integration-test
137LOCAL_MODULE_CLASS := SHARED_LIBRARIES
138LOCAL_CFLAGS := $(aidl_integration_test_cflags)
139LOCAL_SHARED_LIBRARIES := $(aidl_integration_test_shared_libs)
Casey Dahlin389781f2015-10-22 13:13:21 -0700140LOCAL_AIDL_INCLUDES := system/tools/aidl/tests/
Christopher Wileyd0724f62015-11-19 07:25:29 -0800141LOCAL_SRC_FILES := \
142 tests/android/aidl/tests/ITestService.aidl \
143 tests/android/aidl/tests/INamedCallback.aidl
144include $(BUILD_SHARED_LIBRARY)
145
146include $(CLEAR_VARS)
147LOCAL_MODULE := aidl_test_service
148LOCAL_CFLAGS := $(aidl_integration_test_cflags)
149LOCAL_SHARED_LIBRARIES := \
150 libaidl-integration-test \
151 $(aidl_integration_test_shared_libs)
152LOCAL_SRC_FILES := \
153 tests/aidl_test_service.cpp
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700154include $(BUILD_EXECUTABLE)
155
156include $(CLEAR_VARS)
Christopher Wiley33ad81e2015-10-21 14:41:11 -0700157LOCAL_MODULE := aidl_test_client
Christopher Wileyd0724f62015-11-19 07:25:29 -0800158LOCAL_CFLAGS := $(aidl_integration_test_cflags)
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700159LOCAL_SHARED_LIBRARIES := \
Christopher Wileyd0724f62015-11-19 07:25:29 -0800160 libaidl-integration-test \
161 $(aidl_integration_test_shared_libs)
162LOCAL_SRC_FILES := \
163 tests/aidl_test_client.cpp
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700164include $(BUILD_EXECUTABLE)
Christopher Wiley130e6862015-10-18 17:53:11 -0700165
Christopher Wiley2971cf32015-10-23 11:50:21 -0700166include $(CLEAR_VARS)
167LOCAL_MODULE := aidl_test_sentinel_searcher
168LOCAL_SRC_FILES := tests/aidl_test_sentinel_searcher.cpp
Christopher Wileyd0724f62015-11-19 07:25:29 -0800169LOCAL_CFLAGS := $(aidl_integration_test_cflags)
Christopher Wiley2971cf32015-10-23 11:50:21 -0700170include $(BUILD_EXECUTABLE)
171
Christopher Wiley130e6862015-10-18 17:53:11 -0700172
173# aidl on its own doesn't need the framework, but testing native/java
174# compatibility introduces java dependencies.
175ifndef BRILLO
176
177include $(CLEAR_VARS)
178LOCAL_PACKAGE_NAME := aidl_test_services
Christopher Wiley34bbc7b2015-11-09 09:24:36 -0800179# Turn off Java optimization tools to speed up our test iterations.
180LOCAL_JACK_ENABLED := disabled
181LOCAL_PROGUARD_ENABLED := disabled
Christopher Wiley130e6862015-10-18 17:53:11 -0700182LOCAL_DEX_PREOPT := false
183LOCAL_CERTIFICATE := platform
184LOCAL_MANIFEST_FILE := tests/java_app/AndroidManifest.xml
Christopher Wiley130e6862015-10-18 17:53:11 -0700185LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/tests/java_app/resources
186LOCAL_SRC_FILES := \
Christopher Wiley521bb612015-10-22 11:40:30 -0700187 tests/android/aidl/tests/ITestService.aidl \
Casey Dahlin389781f2015-10-22 13:13:21 -0700188 tests/android/aidl/tests/INamedCallback.aidl \
Christopher Wiley521bb612015-10-22 11:40:30 -0700189 tests/java_app/src/android/aidl/tests/TestServiceClient.java
Casey Dahlin389781f2015-10-22 13:13:21 -0700190LOCAL_AIDL_INCLUDES := system/tools/aidl/tests/
Christopher Wiley130e6862015-10-18 17:53:11 -0700191include $(BUILD_PACKAGE)
192
193endif # not defined BRILLO