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 cc_defaults {
     18     name: "aidl_defaults",
     19     cflags: [
     20         "-Wall",
     21         "-Werror",
     22         "-Wextra",
     23     ],
     24     whole_static_libs: ["libgtest_prod"],
     25     static_libs: [
     26         "libbase",
     27         "libcutils",
     28     ],
     29     target: {
     30         windows: {
     31             enabled: true,
     32         },
     33     },
     34 }
     35 
     36 // Logic shared between aidl and its unittests
     37 cc_library_host_static {
     38     name: "libaidl-common",
     39     defaults: ["aidl_defaults"],
     40 
     41     clang_cflags: [
     42         // Tragically, the code is riddled with unused parameters.
     43         "-Wno-unused-parameter",
     44 
     45         // yacc dumps a lot of code *just in case*.
     46         "-Wno-unused-function",
     47         "-Wno-unneeded-internal-declaration",
     48 
     49         // yacc is a tool from a more civilized age.
     50         "-Wno-deprecated-register",
     51 
     52         // yacc also has a habit of using char* over const char*.
     53         "-Wno-writable-strings",
     54     ],
     55 
     56     srcs: [
     57         "aidl.cpp",
     58         "aidl_language.cpp",
     59         "aidl_language_l.ll",
     60         "aidl_language_y.yy",
     61         "ast_cpp.cpp",
     62         "ast_java.cpp",
     63         "code_writer.cpp",
     64         "generate_cpp.cpp",
     65         "generate_java.cpp",
     66         "generate_java_binder.cpp",
     67         "import_resolver.cpp",
     68         "line_reader.cpp",
     69         "io_delegate.cpp",
     70         "options.cpp",
     71         "type_cpp.cpp",
     72         "type_java.cpp",
     73         "type_namespace.cpp",
     74     ],
     75 }
     76 
     77 // aidl executable
     78 cc_binary_host {
     79     name: "aidl",
     80     defaults: ["aidl_defaults"],
     81     srcs: ["main_java.cpp"],
     82     static_libs: [
     83         "libaidl-common",
     84         "libbase",
     85     ],
     86 }
     87 
     88 // aidl-cpp executable
     89 cc_binary_host {
     90     name: "aidl-cpp",
     91     defaults: ["aidl_defaults"],
     92     srcs: ["main_cpp.cpp"],
     93     static_libs: [
     94         "libaidl-common",
     95         "libbase",
     96     ],
     97 }
     98 
     99 // Unit tests
    100 cc_test_host {
    101     name: "aidl_unittests",
    102 
    103     cflags: [
    104         "-Wall",
    105         "-Wextra",
    106         "-Werror",
    107         "-g",
    108         "-DUNIT_TEST",
    109     ],
    110     // Tragically, the code is riddled with unused parameters.
    111     clang_cflags: ["-Wno-unused-parameter"],
    112     srcs: [
    113         "aidl_unittest.cpp",
    114         "ast_cpp_unittest.cpp",
    115         "ast_java_unittest.cpp",
    116         "generate_cpp_unittest.cpp",
    117         "io_delegate_unittest.cpp",
    118         "options_unittest.cpp",
    119         "tests/end_to_end_tests.cpp",
    120         "tests/fake_io_delegate.cpp",
    121         "tests/main.cpp",
    122         "tests/test_data_example_interface.cpp",
    123         "tests/test_data_ping_responder.cpp",
    124         "tests/test_data_string_constants.cpp",
    125         "tests/test_util.cpp",
    126         "type_cpp_unittest.cpp",
    127         "type_java_unittest.cpp",
    128     ],
    129 
    130     static_libs: [
    131         "libaidl-common",
    132         "libbase",
    133         "libcutils",
    134         "libgmock_host",
    135     ],
    136 }
    137 
    138 //
    139 // Everything below here is used for integration testing of generated AIDL code.
    140 //
    141 cc_binary {
    142     name: "aidl_test_sentinel_searcher",
    143     srcs: ["tests/aidl_test_sentinel_searcher.cpp"],
    144     cflags: [
    145         "-Wall",
    146         "-Wextra",
    147         "-Werror",
    148         "-Wunused-parameter",
    149     ],
    150 }
    151 
    152 cc_defaults {
    153     name: "aidl_test_defaults",
    154     cflags: [
    155         "-Wall",
    156         "-Wextra",
    157         "-Werror",
    158         "-Wunused-parameter",
    159     ],
    160     shared_libs: [
    161         "libbase",
    162         "libbinder",
    163         "liblog",
    164         "libutils",
    165     ],
    166 }
    167 
    168 cc_library_shared {
    169     name: "libaidl-integration-test",
    170     defaults: ["aidl_test_defaults"],
    171     aidl: {
    172         export_aidl_headers: true,
    173         local_include_dirs: ["tests"],
    174         include_dirs: ["frameworks/native/aidl/binder"],
    175     },
    176     srcs: [
    177         "tests/android/aidl/tests/ITestService.aidl",
    178         "tests/android/aidl/tests/INamedCallback.aidl",
    179         "tests/simple_parcelable.cpp",
    180     ],
    181 }
    182 
    183 cc_binary {
    184     name: "aidl_test_service",
    185     defaults: ["aidl_test_defaults"],
    186     shared_libs: ["libaidl-integration-test"],
    187     srcs: ["tests/aidl_test_service.cpp"],
    188 }
    189 
    190 cc_binary {
    191     name: "aidl_test_client",
    192     defaults: ["aidl_test_defaults"],
    193     shared_libs: ["libaidl-integration-test"],
    194     srcs: [
    195         "tests/aidl_test_client.cpp",
    196         "tests/aidl_test_client_file_descriptors.cpp",
    197         "tests/aidl_test_client_parcelables.cpp",
    198         "tests/aidl_test_client_nullables.cpp",
    199         "tests/aidl_test_client_primitives.cpp",
    200         "tests/aidl_test_client_utf8_strings.cpp",
    201         "tests/aidl_test_client_service_exceptions.cpp",
    202     ],
    203 }
    204