blob: f2cfe45bbf3398dbced4d0a3db53c95fee54fcb1 [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
20
Joe Onorato54fba422010-06-10 18:34:55 -070021# This tool is prebuilt if we're doing an app-only build.
Ying Wangc7cf53e2014-03-07 15:55:14 -080022ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
Joe Onorato54fba422010-06-10 18:34:55 -070023
Christopher Wileyb8b59f62015-09-15 12:19:53 -070024aidl_static_libraries := libbase libcutils
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070025
Christopher Wiley3616d132015-09-01 11:07:48 -070026# Logic shared between aidl and its unittests
The Android Open Source Project46c012c2008-10-21 07:00:00 -070027include $(CLEAR_VARS)
Christopher Wiley3616d132015-09-01 11:07:48 -070028LOCAL_MODULE := libaidl-common
Dan Willemseneada0252015-09-04 14:21:26 -070029LOCAL_MODULE_HOST_OS := darwin linux windows
The Android Open Source Project46c012c2008-10-21 07:00:00 -070030
Christopher Wiley4427d862015-09-14 11:07:39 -070031LOCAL_C_INCLUDES := external/gtest/include
Christopher Wileyc5a9e282015-10-23 11:45:28 -070032LOCAL_CLANG_CFLAGS := $(aidl_cflags)
Christopher Wileye0146cf2015-08-24 15:06:58 -070033# Tragically, the code is riddled with unused parameters.
34LOCAL_CLANG_CFLAGS += -Wno-unused-parameter
35# yacc dumps a lot of code *just in case*.
36LOCAL_CLANG_CFLAGS += -Wno-unused-function
37LOCAL_CLANG_CFLAGS += -Wno-unneeded-internal-declaration
38# yacc is a tool from a more civilized age.
39LOCAL_CLANG_CFLAGS += -Wno-deprecated-register
40# yacc also has a habit of using char* over const char*.
41LOCAL_CLANG_CFLAGS += -Wno-writable-strings
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070042LOCAL_STATIC_LIBRARIES := $(aidl_static_libraries)
Christopher Wileye0146cf2015-08-24 15:06:58 -070043
The Android Open Source Project46c012c2008-10-21 07:00:00 -070044LOCAL_SRC_FILES := \
Christopher Wiley89e35862015-08-30 10:57:07 -070045 aidl.cpp \
46 aidl_language.cpp \
47 aidl_language_l.l \
48 aidl_language_y.y \
Christopher Wileyf600a552015-09-12 14:07:44 -070049 ast_cpp.cpp \
Christopher Wiley038485e2015-09-12 11:14:14 -070050 ast_java.cpp \
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070051 code_writer.cpp \
Christopher Wileyeb1acc12015-09-16 11:25:13 -070052 generate_cpp.cpp \
Christopher Wiley89e35862015-08-30 10:57:07 -070053 generate_java.cpp \
54 generate_java_binder.cpp \
Christopher Wiley72877ac2015-10-06 14:41:42 -070055 import_resolver.cpp \
Christopher Wileyef140932015-11-03 09:29:19 -080056 line_reader.cpp \
Christopher Wiley4a2884b2015-10-07 11:27:45 -070057 io_delegate.cpp \
Christopher Wiley89e35862015-08-30 10:57:07 -070058 options.cpp \
Christopher Wileya8a2dc02015-09-28 16:35:31 -070059 type_cpp.cpp \
Christopher Wiley775fa1f2015-09-22 15:00:12 -070060 type_java.cpp \
Christopher Wileyfb4b22d2015-09-25 15:16:13 -070061 type_namespace.cpp \
The Android Open Source Project46c012c2008-10-21 07:00:00 -070062
Christopher Wiley3616d132015-09-01 11:07:48 -070063include $(BUILD_HOST_STATIC_LIBRARY)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070064
Christopher Wiley3616d132015-09-01 11:07:48 -070065
66# aidl executable
67include $(CLEAR_VARS)
68LOCAL_MODULE := aidl
69
70LOCAL_MODULE_HOST_OS := darwin linux windows
Christopher Wileyc5a9e282015-10-23 11:45:28 -070071LOCAL_CFLAGS := $(aidl_cflags)
Christopher Wiley4427d862015-09-14 11:07:39 -070072LOCAL_C_INCLUDES := external/gtest/include
Christopher Wiley89eaab52015-09-15 14:46:46 -070073LOCAL_SRC_FILES := main_java.cpp
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070074LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070075include $(BUILD_HOST_EXECUTABLE)
76
Christopher Wileya590de82015-09-15 15:46:28 -070077# aidl-cpp executable
78include $(CLEAR_VARS)
79LOCAL_MODULE := aidl-cpp
80
81LOCAL_MODULE_HOST_OS := darwin linux windows
Christopher Wileyc5a9e282015-10-23 11:45:28 -070082LOCAL_CFLAGS := $(aidl_cflags)
Christopher Wileya590de82015-09-15 15:46:28 -070083LOCAL_C_INCLUDES := external/gtest/include
84LOCAL_SRC_FILES := main_cpp.cpp
85LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
86include $(BUILD_HOST_EXECUTABLE)
87
Casey Dahlind8cc5092015-08-28 15:46:48 -070088# Unit tests
89include $(CLEAR_VARS)
90LOCAL_MODULE := aidl_unittests
Christopher Wileyf047e022015-11-13 14:42:00 -080091LOCAL_MODULE_HOST_OS := darwin linux
Christopher Wiley3616d132015-09-01 11:07:48 -070092
Christopher Wileyc5a9e282015-10-23 11:45:28 -070093LOCAL_CFLAGS := $(aidl_cflags) -g -DUNIT_TEST
Christopher Wiley856a8692015-08-31 17:36:41 -070094# Tragically, the code is riddled with unused parameters.
95LOCAL_CLANG_CFLAGS := -Wno-unused-parameter
Christopher Wiley3616d132015-09-01 11:07:48 -070096LOCAL_SRC_FILES := \
Christopher Wiley90be4e32015-10-20 14:55:25 -070097 aidl_unittest.cpp \
Christopher Wileyf600a552015-09-12 14:07:44 -070098 ast_cpp_unittest.cpp \
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070099 ast_java_unittest.cpp \
Casey Dahlina834dd42015-09-23 11:52:15 -0700100 generate_cpp_unittest.cpp \
Christopher Wiley3616d132015-09-01 11:07:48 -0700101 options_unittest.cpp \
Christopher Wiley856a8692015-08-31 17:36:41 -0700102 tests/end_to_end_tests.cpp \
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700103 tests/fake_io_delegate.cpp \
Christopher Wileydb6c7112015-10-18 12:10:12 -0700104 tests/main.cpp \
Christopher Wileyaf2d5102015-10-18 11:36:23 -0700105 tests/test_data_example_interface.cpp \
106 tests/test_data_ping_responder.cpp \
Christopher Wileyea6e3822015-10-07 13:16:34 -0700107 tests/test_util.cpp \
Christopher Wileya8a2dc02015-09-28 16:35:31 -0700108 type_cpp_unittest.cpp \
Christopher Wiley4582ecb2015-09-25 13:27:45 -0700109 type_java_unittest.cpp \
Christopher Wiley856a8692015-08-31 17:36:41 -0700110
Christopher Wiley3616d132015-09-01 11:07:48 -0700111LOCAL_STATIC_LIBRARIES := \
112 libaidl-common \
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -0700113 $(aidl_static_libraries) \
Christopher Wiley3616d132015-09-01 11:07:48 -0700114 libgmock_host \
115 libgtest_host \
Christopher Wileyf321efd2015-09-01 12:39:25 -0700116
Christopher Wileyc545b7c2015-09-01 18:36:44 -0700117LOCAL_LDLIBS_linux := -lrt
Casey Dahlind8cc5092015-08-28 15:46:48 -0700118include $(BUILD_HOST_NATIVE_TEST)
119
Ying Wangc7cf53e2014-03-07 15:55:14 -0800120endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700121
Christopher Wileyd0724f62015-11-19 07:25:29 -0800122#
123# Everything below here is used for integration testing of generated AIDL code.
124#
125aidl_integration_test_cflags := $(aidl_cflags) -Wunused-parameter
126aidl_integration_test_shared_libs := \
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700127 libbinder \
128 liblog \
129 libutils
Christopher Wileyd0724f62015-11-19 07:25:29 -0800130
131include $(CLEAR_VARS)
132LOCAL_MODULE := libaidl-integration-test
133LOCAL_MODULE_CLASS := SHARED_LIBRARIES
134LOCAL_CFLAGS := $(aidl_integration_test_cflags)
135LOCAL_SHARED_LIBRARIES := $(aidl_integration_test_shared_libs)
Casey Dahlin389781f2015-10-22 13:13:21 -0700136LOCAL_AIDL_INCLUDES := system/tools/aidl/tests/
Christopher Wileyd0724f62015-11-19 07:25:29 -0800137LOCAL_SRC_FILES := \
138 tests/android/aidl/tests/ITestService.aidl \
139 tests/android/aidl/tests/INamedCallback.aidl
140include $(BUILD_SHARED_LIBRARY)
141
142include $(CLEAR_VARS)
143LOCAL_MODULE := aidl_test_service
144LOCAL_CFLAGS := $(aidl_integration_test_cflags)
145LOCAL_SHARED_LIBRARIES := \
146 libaidl-integration-test \
147 $(aidl_integration_test_shared_libs)
148LOCAL_SRC_FILES := \
149 tests/aidl_test_service.cpp
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700150include $(BUILD_EXECUTABLE)
151
152include $(CLEAR_VARS)
Christopher Wiley33ad81e2015-10-21 14:41:11 -0700153LOCAL_MODULE := aidl_test_client
Christopher Wileyd0724f62015-11-19 07:25:29 -0800154LOCAL_CFLAGS := $(aidl_integration_test_cflags)
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700155LOCAL_SHARED_LIBRARIES := \
Christopher Wileyd0724f62015-11-19 07:25:29 -0800156 libaidl-integration-test \
157 $(aidl_integration_test_shared_libs)
158LOCAL_SRC_FILES := \
159 tests/aidl_test_client.cpp
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700160include $(BUILD_EXECUTABLE)
Christopher Wiley130e6862015-10-18 17:53:11 -0700161
Christopher Wiley2971cf32015-10-23 11:50:21 -0700162include $(CLEAR_VARS)
163LOCAL_MODULE := aidl_test_sentinel_searcher
164LOCAL_SRC_FILES := tests/aidl_test_sentinel_searcher.cpp
Christopher Wileyd0724f62015-11-19 07:25:29 -0800165LOCAL_CFLAGS := $(aidl_integration_test_cflags)
Christopher Wiley2971cf32015-10-23 11:50:21 -0700166include $(BUILD_EXECUTABLE)
167
Christopher Wiley130e6862015-10-18 17:53:11 -0700168
169# aidl on its own doesn't need the framework, but testing native/java
170# compatibility introduces java dependencies.
171ifndef BRILLO
172
173include $(CLEAR_VARS)
174LOCAL_PACKAGE_NAME := aidl_test_services
Christopher Wiley34bbc7b2015-11-09 09:24:36 -0800175# Turn off Java optimization tools to speed up our test iterations.
176LOCAL_JACK_ENABLED := disabled
177LOCAL_PROGUARD_ENABLED := disabled
Christopher Wiley130e6862015-10-18 17:53:11 -0700178LOCAL_DEX_PREOPT := false
179LOCAL_CERTIFICATE := platform
180LOCAL_MANIFEST_FILE := tests/java_app/AndroidManifest.xml
Christopher Wiley130e6862015-10-18 17:53:11 -0700181LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/tests/java_app/resources
182LOCAL_SRC_FILES := \
Christopher Wiley521bb612015-10-22 11:40:30 -0700183 tests/android/aidl/tests/ITestService.aidl \
Casey Dahlin389781f2015-10-22 13:13:21 -0700184 tests/android/aidl/tests/INamedCallback.aidl \
Christopher Wiley521bb612015-10-22 11:40:30 -0700185 tests/java_app/src/android/aidl/tests/TestServiceClient.java
Casey Dahlin389781f2015-10-22 13:13:21 -0700186LOCAL_AIDL_INCLUDES := system/tools/aidl/tests/
Christopher Wiley130e6862015-10-18 17:53:11 -0700187include $(BUILD_PACKAGE)
188
189endif # not defined BRILLO