Home | History | Annotate | Download | only in aidl
      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 
     17 LOCAL_PATH := $(call my-dir)
     18 
     19 aidl_cflags := -Wall -Wextra -Werror
     20 aidl_static_libraries := libbase libcutils
     21 
     22 aidl_module_host_os := darwin linux windows
     23 ifdef BRILLO
     24   aidl_module_host_os := darwin linux
     25 endif
     26 
     27 # Logic shared between aidl and its unittests
     28 include $(CLEAR_VARS)
     29 LOCAL_MODULE := libaidl-common
     30 LOCAL_MODULE_HOST_OS := $(aidl_module_host_os)
     31 
     32 LOCAL_C_INCLUDES := external/gtest/include
     33 LOCAL_CLANG_CFLAGS := $(aidl_cflags)
     34 # Tragically, the code is riddled with unused parameters.
     35 LOCAL_CLANG_CFLAGS += -Wno-unused-parameter
     36 # yacc dumps a lot of code *just in case*.
     37 LOCAL_CLANG_CFLAGS += -Wno-unused-function
     38 LOCAL_CLANG_CFLAGS += -Wno-unneeded-internal-declaration
     39 # yacc is a tool from a more civilized age.
     40 LOCAL_CLANG_CFLAGS += -Wno-deprecated-register
     41 # yacc also has a habit of using char* over const char*.
     42 LOCAL_CLANG_CFLAGS += -Wno-writable-strings
     43 LOCAL_STATIC_LIBRARIES := $(aidl_static_libraries)
     44 
     45 LOCAL_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 
     64 include $(BUILD_HOST_STATIC_LIBRARY)
     65 
     66 
     67 # aidl executable
     68 include $(CLEAR_VARS)
     69 LOCAL_MODULE := aidl
     70 
     71 LOCAL_MODULE_HOST_OS := $(aidl_module_host_os)
     72 LOCAL_CFLAGS := $(aidl_cflags)
     73 LOCAL_C_INCLUDES := external/gtest/include
     74 LOCAL_SRC_FILES := main_java.cpp
     75 LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
     76 include $(BUILD_HOST_EXECUTABLE)
     77 
     78 # aidl-cpp executable
     79 include $(CLEAR_VARS)
     80 LOCAL_MODULE := aidl-cpp
     81 
     82 LOCAL_MODULE_HOST_OS := $(aidl_module_host_os)
     83 LOCAL_CFLAGS := $(aidl_cflags)
     84 LOCAL_C_INCLUDES := external/gtest/include
     85 LOCAL_SRC_FILES := main_cpp.cpp
     86 LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
     87 include $(BUILD_HOST_EXECUTABLE)
     88 
     89 # Unit tests
     90 include $(CLEAR_VARS)
     91 LOCAL_MODULE := aidl_unittests
     92 LOCAL_MODULE_HOST_OS := darwin linux
     93 
     94 LOCAL_CFLAGS := $(aidl_cflags) -g -DUNIT_TEST
     95 # Tragically, the code is riddled with unused parameters.
     96 LOCAL_CLANG_CFLAGS := -Wno-unused-parameter
     97 LOCAL_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 
    113 LOCAL_STATIC_LIBRARIES := \
    114     libaidl-common \
    115     $(aidl_static_libraries) \
    116     libgmock_host \
    117     libgtest_host \
    118 
    119 LOCAL_LDLIBS_linux := -lrt
    120 include $(BUILD_HOST_NATIVE_TEST)
    121 
    122 #
    123 # Everything below here is used for integration testing of generated AIDL code.
    124 #
    125 aidl_integration_test_cflags := $(aidl_cflags) -Wunused-parameter
    126 aidl_integration_test_shared_libs := \
    127     libbase \
    128     libbinder \
    129     liblog \
    130     libutils
    131 
    132 include $(CLEAR_VARS)
    133 LOCAL_MODULE := libaidl-integration-test
    134 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
    135 LOCAL_CFLAGS := $(aidl_integration_test_cflags)
    136 LOCAL_SHARED_LIBRARIES := $(aidl_integration_test_shared_libs)
    137 LOCAL_AIDL_INCLUDES := \
    138     system/tools/aidl/tests/ \
    139     frameworks/native/aidl/binder
    140 LOCAL_SRC_FILES := \
    141     tests/android/aidl/tests/ITestService.aidl \
    142     tests/android/aidl/tests/INamedCallback.aidl \
    143     tests/simple_parcelable.cpp
    144 include $(BUILD_SHARED_LIBRARY)
    145 
    146 include $(CLEAR_VARS)
    147 LOCAL_MODULE := aidl_test_service
    148 LOCAL_CFLAGS := $(aidl_integration_test_cflags)
    149 LOCAL_SHARED_LIBRARIES := \
    150     libaidl-integration-test \
    151     $(aidl_integration_test_shared_libs)
    152 LOCAL_SRC_FILES := \
    153     tests/aidl_test_service.cpp
    154 include $(BUILD_EXECUTABLE)
    155 
    156 include $(CLEAR_VARS)
    157 LOCAL_MODULE := aidl_test_client
    158 LOCAL_CFLAGS := $(aidl_integration_test_cflags)
    159 LOCAL_SHARED_LIBRARIES := \
    160     libaidl-integration-test \
    161     $(aidl_integration_test_shared_libs)
    162 LOCAL_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
    170 include $(BUILD_EXECUTABLE)
    171 
    172 include $(CLEAR_VARS)
    173 LOCAL_MODULE := aidl_test_sentinel_searcher
    174 LOCAL_SRC_FILES := tests/aidl_test_sentinel_searcher.cpp
    175 LOCAL_CFLAGS := $(aidl_integration_test_cflags)
    176 include $(BUILD_EXECUTABLE)
    177 
    178 
    179 # aidl on its own doesn't need the framework, but testing native/java
    180 # compatibility introduces java dependencies.
    181 ifndef BRILLO
    182 
    183 include $(CLEAR_VARS)
    184 LOCAL_PACKAGE_NAME := aidl_test_services
    185 # Turn off Java optimization tools to speed up our test iterations.
    186 LOCAL_PROGUARD_ENABLED := disabled
    187 LOCAL_DEX_PREOPT := false
    188 LOCAL_CERTIFICATE := platform
    189 LOCAL_MANIFEST_FILE := tests/java_app/AndroidManifest.xml
    190 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/tests/java_app/resources
    191 LOCAL_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
    196 LOCAL_AIDL_INCLUDES := \
    197     system/tools/aidl/tests/ \
    198     frameworks/native/aidl/binder
    199 include $(BUILD_PACKAGE)
    200 
    201 endif  # not defined BRILLO
    202