aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-10-04 20:04:36 -0700
committerDan Willemsen <dwillemsen@google.com>2016-11-03 14:24:22 -0700
commit8fd503f6d741344935cc3a5d70e0fa885cc353a6 (patch)
tree3069a89880d994e160068ef6b393b45f4e466626
parentd17c58babbf02253e7ed866325ea60352d637879 (diff)
downloadaidl-8fd503f6d741344935cc3a5d70e0fa885cc353a6.tar.gz
Convert to Android.bp
See build/soong/README.md for more information about Soong. The rest of the native code will be converted when Soong supports *.aidl file builds (which requires aidl-cpp to be built with Soong first). Test: mmma -j system/tools/aidl Test: out/host/linux-x86/nativetest{,64}/aidl_unittests/aidl_unittests Change-Id: I55e096c6b8e67bd83f0148b817f64d2ec9e052da
-rw-r--r--Android.bp156
-rw-r--r--Android.mk107
2 files changed, 156 insertions, 107 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 00000000..fcb2851e
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,156 @@
+//
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_defaults {
+ name: "aidl_defaults",
+ clang_cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+ whole_static_libs: ["libgtest_prod"],
+ static_libs: [
+ "libbase",
+ "libcutils",
+ ],
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+}
+
+// Logic shared between aidl and its unittests
+cc_library_host_static {
+ name: "libaidl-common",
+ defaults: ["aidl_defaults"],
+
+ clang_cflags: [
+ // Tragically, the code is riddled with unused parameters.
+ "-Wno-unused-parameter",
+
+ // yacc dumps a lot of code *just in case*.
+ "-Wno-unused-function",
+ "-Wno-unneeded-internal-declaration",
+
+ // yacc is a tool from a more civilized age.
+ "-Wno-deprecated-register",
+
+ // yacc also has a habit of using char* over const char*.
+ "-Wno-writable-strings",
+ ],
+
+ srcs: [
+ "aidl.cpp",
+ "aidl_language.cpp",
+ "aidl_language_l.ll",
+ "aidl_language_y.yy",
+ "ast_cpp.cpp",
+ "ast_java.cpp",
+ "code_writer.cpp",
+ "generate_cpp.cpp",
+ "generate_java.cpp",
+ "generate_java_binder.cpp",
+ "import_resolver.cpp",
+ "line_reader.cpp",
+ "io_delegate.cpp",
+ "options.cpp",
+ "type_cpp.cpp",
+ "type_java.cpp",
+ "type_namespace.cpp",
+ ],
+}
+
+// aidl executable
+cc_binary_host {
+ name: "aidl",
+ defaults: ["aidl_defaults"],
+ srcs: ["main_java.cpp"],
+ static_libs: [
+ "libaidl-common",
+ "libbase",
+ ],
+}
+
+// aidl-cpp executable
+cc_binary_host {
+ name: "aidl-cpp",
+ defaults: ["aidl_defaults"],
+ srcs: ["main_cpp.cpp"],
+ static_libs: [
+ "libaidl-common",
+ "libbase",
+ ],
+}
+
+// Unit tests
+cc_test_host {
+ name: "aidl_unittests",
+
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-g",
+ "-DUNIT_TEST",
+ ],
+ // Tragically, the code is riddled with unused parameters.
+ clang_cflags: ["-Wno-unused-parameter"],
+ srcs: [
+ "aidl_unittest.cpp",
+ "ast_cpp_unittest.cpp",
+ "ast_java_unittest.cpp",
+ "generate_cpp_unittest.cpp",
+ "io_delegate_unittest.cpp",
+ "options_unittest.cpp",
+ "tests/end_to_end_tests.cpp",
+ "tests/fake_io_delegate.cpp",
+ "tests/main.cpp",
+ "tests/test_data_example_interface.cpp",
+ "tests/test_data_ping_responder.cpp",
+ "tests/test_data_string_constants.cpp",
+ "tests/test_util.cpp",
+ "type_cpp_unittest.cpp",
+ "type_java_unittest.cpp",
+ ],
+
+ static_libs: [
+ "libaidl-common",
+ "libbase",
+ "libcutils",
+ "libgmock_host",
+ ],
+
+ target: {
+ linux: {
+ host_ldlibs: ["-lrt"],
+ },
+ },
+}
+
+//
+// Everything below here is used for integration testing of generated AIDL code.
+//
+cc_binary {
+ name: "aidl_test_sentinel_searcher",
+ srcs: ["tests/aidl_test_sentinel_searcher.cpp"],
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-Wunused-parameter",
+ ],
+}
diff --git a/Android.mk b/Android.mk
index 3c1463ad..a44dc0b6 100644
--- a/Android.mk
+++ b/Android.mk
@@ -17,107 +17,6 @@
LOCAL_PATH := $(call my-dir)
aidl_cflags := -Wall -Wextra -Werror
-aidl_static_libraries := libbase libcutils
-
-aidl_module_host_os := darwin linux windows
-ifdef BRILLO
- aidl_module_host_os := darwin linux
-endif
-
-# Logic shared between aidl and its unittests
-include $(CLEAR_VARS)
-LOCAL_MODULE := libaidl-common
-LOCAL_MODULE_HOST_OS := $(aidl_module_host_os)
-
-LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_prod
-LOCAL_CLANG_CFLAGS := $(aidl_cflags)
-# Tragically, the code is riddled with unused parameters.
-LOCAL_CLANG_CFLAGS += -Wno-unused-parameter
-# yacc dumps a lot of code *just in case*.
-LOCAL_CLANG_CFLAGS += -Wno-unused-function
-LOCAL_CLANG_CFLAGS += -Wno-unneeded-internal-declaration
-# yacc is a tool from a more civilized age.
-LOCAL_CLANG_CFLAGS += -Wno-deprecated-register
-# yacc also has a habit of using char* over const char*.
-LOCAL_CLANG_CFLAGS += -Wno-writable-strings
-LOCAL_STATIC_LIBRARIES := $(aidl_static_libraries)
-
-LOCAL_SRC_FILES := \
- aidl.cpp \
- aidl_language.cpp \
- aidl_language_l.ll \
- aidl_language_y.yy \
- ast_cpp.cpp \
- ast_java.cpp \
- code_writer.cpp \
- generate_cpp.cpp \
- generate_java.cpp \
- generate_java_binder.cpp \
- import_resolver.cpp \
- line_reader.cpp \
- io_delegate.cpp \
- options.cpp \
- type_cpp.cpp \
- type_java.cpp \
- type_namespace.cpp \
-
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-
-# aidl executable
-include $(CLEAR_VARS)
-LOCAL_MODULE := aidl
-
-LOCAL_MODULE_HOST_OS := $(aidl_module_host_os)
-LOCAL_CFLAGS := $(aidl_cflags)
-LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_prod
-LOCAL_SRC_FILES := main_java.cpp
-LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
-include $(BUILD_HOST_EXECUTABLE)
-
-# aidl-cpp executable
-include $(CLEAR_VARS)
-LOCAL_MODULE := aidl-cpp
-
-LOCAL_MODULE_HOST_OS := $(aidl_module_host_os)
-LOCAL_CFLAGS := $(aidl_cflags)
-LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_prod
-LOCAL_SRC_FILES := main_cpp.cpp
-LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
-include $(BUILD_HOST_EXECUTABLE)
-
-# Unit tests
-include $(CLEAR_VARS)
-LOCAL_MODULE := aidl_unittests
-LOCAL_MODULE_HOST_OS := darwin linux
-
-LOCAL_CFLAGS := $(aidl_cflags) -g -DUNIT_TEST
-# Tragically, the code is riddled with unused parameters.
-LOCAL_CLANG_CFLAGS := -Wno-unused-parameter
-LOCAL_SRC_FILES := \
- aidl_unittest.cpp \
- ast_cpp_unittest.cpp \
- ast_java_unittest.cpp \
- generate_cpp_unittest.cpp \
- io_delegate_unittest.cpp \
- options_unittest.cpp \
- tests/end_to_end_tests.cpp \
- tests/fake_io_delegate.cpp \
- tests/main.cpp \
- tests/test_data_example_interface.cpp \
- tests/test_data_ping_responder.cpp \
- tests/test_data_string_constants.cpp \
- tests/test_util.cpp \
- type_cpp_unittest.cpp \
- type_java_unittest.cpp \
-
-LOCAL_STATIC_LIBRARIES := \
- libaidl-common \
- $(aidl_static_libraries) \
- libgmock_host \
-
-LOCAL_LDLIBS_linux := -lrt
-include $(BUILD_HOST_NATIVE_TEST)
#
# Everything below here is used for integration testing of generated AIDL code.
@@ -169,12 +68,6 @@ LOCAL_SRC_FILES := \
tests/aidl_test_client_service_exceptions.cpp
include $(BUILD_EXECUTABLE)
-include $(CLEAR_VARS)
-LOCAL_MODULE := aidl_test_sentinel_searcher
-LOCAL_SRC_FILES := tests/aidl_test_sentinel_searcher.cpp
-LOCAL_CFLAGS := $(aidl_integration_test_cflags)
-include $(BUILD_EXECUTABLE)
-
# aidl on its own doesn't need the framework, but testing native/java
# compatibility introduces java dependencies.