1# 2# 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) 18 19aidl_cflags := -Wall -Wextra -Werror 20aidl_static_libraries := libbase libcutils 21 22aidl_module_host_os := darwin linux windows 23ifdef BRILLO 24 aidl_module_host_os := darwin linux 25endif 26 27# Logic shared between aidl and its unittests 28include $(CLEAR_VARS) 29LOCAL_MODULE := libaidl-common 30LOCAL_MODULE_HOST_OS := $(aidl_module_host_os) 31 32LOCAL_C_INCLUDES := external/gtest/include 33LOCAL_CLANG_CFLAGS := $(aidl_cflags) 34# Tragically, the code is riddled with unused parameters. 35LOCAL_CLANG_CFLAGS += -Wno-unused-parameter 36# yacc dumps a lot of code *just in case*. 37LOCAL_CLANG_CFLAGS += -Wno-unused-function 38LOCAL_CLANG_CFLAGS += -Wno-unneeded-internal-declaration 39# yacc is a tool from a more civilized age. 40LOCAL_CLANG_CFLAGS += -Wno-deprecated-register 41# yacc also has a habit of using char* over const char*. 42LOCAL_CLANG_CFLAGS += -Wno-writable-strings 43LOCAL_STATIC_LIBRARIES := $(aidl_static_libraries) 44 45LOCAL_SRC_FILES := \ 46 aidl.cpp \ 47 aidl_language.cpp \ 48 aidl_language_l.ll \ 49 aidl_language_y.yy \ 50 ast_cpp.cpp \ 51 ast_java.cpp \ 52 code_writer.cpp \ 53 generate_cpp.cpp \ 54 generate_java.cpp \ 55 generate_java_binder.cpp \ 56 import_resolver.cpp \ 57 line_reader.cpp \ 58 io_delegate.cpp \ 59 options.cpp \ 60 type_cpp.cpp \ 61 type_java.cpp \ 62 type_namespace.cpp \ 63 64include $(BUILD_HOST_STATIC_LIBRARY) 65 66 67# aidl executable 68include $(CLEAR_VARS) 69LOCAL_MODULE := aidl 70 71LOCAL_MODULE_HOST_OS := $(aidl_module_host_os) 72LOCAL_CFLAGS := $(aidl_cflags) 73LOCAL_C_INCLUDES := external/gtest/include 74LOCAL_SRC_FILES := main_java.cpp 75LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries) 76include $(BUILD_HOST_EXECUTABLE) 77 78# aidl-cpp executable 79include $(CLEAR_VARS) 80LOCAL_MODULE := aidl-cpp 81 82LOCAL_MODULE_HOST_OS := $(aidl_module_host_os) 83LOCAL_CFLAGS := $(aidl_cflags) 84LOCAL_C_INCLUDES := external/gtest/include 85LOCAL_SRC_FILES := main_cpp.cpp 86LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries) 87include $(BUILD_HOST_EXECUTABLE) 88 89# Unit tests 90include $(CLEAR_VARS) 91LOCAL_MODULE := aidl_unittests 92LOCAL_MODULE_HOST_OS := darwin linux 93 94LOCAL_CFLAGS := $(aidl_cflags) -g -DUNIT_TEST 95# Tragically, the code is riddled with unused parameters. 96LOCAL_CLANG_CFLAGS := -Wno-unused-parameter 97LOCAL_SRC_FILES := \ 98 aidl_unittest.cpp \ 99 ast_cpp_unittest.cpp \ 100 ast_java_unittest.cpp \ 101 generate_cpp_unittest.cpp \ 102 io_delegate_unittest.cpp \ 103 options_unittest.cpp \ 104 tests/end_to_end_tests.cpp \ 105 tests/fake_io_delegate.cpp \ 106 tests/main.cpp \ 107 tests/test_data_example_interface.cpp \ 108 tests/test_data_ping_responder.cpp \ 109 tests/test_util.cpp \ 110 type_cpp_unittest.cpp \ 111 type_java_unittest.cpp \ 112 113LOCAL_STATIC_LIBRARIES := \ 114 libaidl-common \ 115 $(aidl_static_libraries) \ 116 libgmock_host \ 117 libgtest_host \ 118 119LOCAL_LDLIBS_linux := -lrt 120include $(BUILD_HOST_NATIVE_TEST) 121 122# 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 := \ 127 libbase \ 128 libbinder \ 129 liblog \ 130 libutils 131 132include $(CLEAR_VARS) 133LOCAL_MODULE := libaidl-integration-test 134LOCAL_MODULE_CLASS := SHARED_LIBRARIES 135LOCAL_CFLAGS := $(aidl_integration_test_cflags) 136LOCAL_SHARED_LIBRARIES := $(aidl_integration_test_shared_libs) 137LOCAL_AIDL_INCLUDES := \ 138 system/tools/aidl/tests/ \ 139 frameworks/native/aidl/binder 140LOCAL_SRC_FILES := \ 141 tests/android/aidl/tests/ITestService.aidl \ 142 tests/android/aidl/tests/INamedCallback.aidl \ 143 tests/simple_parcelable.cpp 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 154include $(BUILD_EXECUTABLE) 155 156include $(CLEAR_VARS) 157LOCAL_MODULE := aidl_test_client 158LOCAL_CFLAGS := $(aidl_integration_test_cflags) 159LOCAL_SHARED_LIBRARIES := \ 160 libaidl-integration-test \ 161 $(aidl_integration_test_shared_libs) 162LOCAL_SRC_FILES := \ 163 tests/aidl_test_client.cpp \ 164 tests/aidl_test_client_file_descriptors.cpp \ 165 tests/aidl_test_client_parcelables.cpp \ 166 tests/aidl_test_client_nullables.cpp \ 167 tests/aidl_test_client_primitives.cpp \ 168 tests/aidl_test_client_utf8_strings.cpp \ 169 tests/aidl_test_client_service_exceptions.cpp 170include $(BUILD_EXECUTABLE) 171 172include $(CLEAR_VARS) 173LOCAL_MODULE := aidl_test_sentinel_searcher 174LOCAL_SRC_FILES := tests/aidl_test_sentinel_searcher.cpp 175LOCAL_CFLAGS := $(aidl_integration_test_cflags) 176include $(BUILD_EXECUTABLE) 177 178 179# aidl on its own doesn't need the framework, but testing native/java 180# compatibility introduces java dependencies. 181ifndef BRILLO 182 183include $(CLEAR_VARS) 184LOCAL_PACKAGE_NAME := aidl_test_services 185# Turn off Java optimization tools to speed up our test iterations. 186LOCAL_PROGUARD_ENABLED := disabled 187LOCAL_DEX_PREOPT := false 188LOCAL_CERTIFICATE := platform 189LOCAL_MANIFEST_FILE := tests/java_app/AndroidManifest.xml 190LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/tests/java_app/resources 191LOCAL_SRC_FILES := \ 192 tests/android/aidl/tests/ITestService.aidl \ 193 tests/android/aidl/tests/INamedCallback.aidl \ 194 tests/java_app/src/android/aidl/tests/SimpleParcelable.java \ 195 tests/java_app/src/android/aidl/tests/TestServiceClient.java 196LOCAL_AIDL_INCLUDES := \ 197 system/tools/aidl/tests/ \ 198 frameworks/native/aidl/binder 199include $(BUILD_PACKAGE) 200 201endif # not defined BRILLO 202