Convert to Android.bp

See build/soong/README.md for more information.

I tested the following tests on a Nexus9 and linux host, and they
continued to pass:

/data/nativetest{,64}/bootstat_tests/bootstat_tests
out/host/linux-x86/bin/nativetest{,64}/bootstat_tests/bootstat_tests
/data/nativetest64/memunreachable_test/memunreachable_test
out/host/linux-x86/bin/nativetest{,64}/memunreachable_test/memunreachable_test

These continue to fail just like before this change:

/data/nativetest{,64}/sync_test/sync_test (was /system/bin/sync_test)
/data/nativetest{,64}/sync-unit-test/sync-unit-test
/data/nativetest/memunreachable_test/memunreachable_test

Test: See above
Change-Id: I691e564e0cf008dd363e3746223b153d712e024d
This commit is contained in:
Dan Willemsen 2016-08-26 15:01:36 -07:00
parent 091b631915
commit 194edf772e
7 changed files with 216 additions and 265 deletions

94
bootstat/Android.bp Normal file
View file

@ -0,0 +1,94 @@
//
// Copyright (C) 2016 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.
//
bootstat_lib_src_files = [
"boot_event_record_store.cpp",
"event_log_list_builder.cpp",
"histogram_logger.cpp",
"uptime_parser.cpp",
]
cc_defaults {
name: "bootstat_defaults",
cflags: [
"-Wall",
"-Wextra",
"-Werror",
// 524291 corresponds to sysui_histogram, from
// frameworks/base/core/java/com/android/internal/logging/EventLogTags.logtags
"-DHISTOGRAM_LOG_TAG=524291",
],
shared_libs: [
"libbase",
"libcutils",
"liblog",
],
whole_static_libs: ["libgtest_prod"],
// Clang is required because of C++14
clang: true,
}
// bootstat static library
// -----------------------------------------------------------------------------
cc_library_static {
name: "libbootstat",
defaults: ["bootstat_defaults"],
srcs: bootstat_lib_src_files,
}
// bootstat static library, debug
// -----------------------------------------------------------------------------
cc_library_static {
name: "libbootstat_debug",
defaults: ["bootstat_defaults"],
host_supported: true,
srcs: bootstat_lib_src_files,
target: {
host: {
cflags: ["-UNDEBUG"],
},
},
}
// bootstat binary
// -----------------------------------------------------------------------------
cc_binary {
name: "bootstat",
defaults: ["bootstat_defaults"],
static_libs: ["libbootstat"],
init_rc: ["bootstat.rc"],
srcs: ["bootstat.cpp"],
}
// Native tests
// -----------------------------------------------------------------------------
cc_test {
name: "bootstat_tests",
defaults: ["bootstat_defaults"],
host_supported: true,
static_libs: [
"libbootstat_debug",
"libgmock",
],
srcs: [
"boot_event_record_store_test.cpp",
"event_log_list_builder_test.cpp",
"testrunner.cpp",
],
}

View file

@ -1,141 +0,0 @@
#
# Copyright (C) 2016 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.
#
LOCAL_PATH := $(call my-dir)
bootstat_lib_src_files := \
boot_event_record_store.cpp \
event_log_list_builder.cpp \
histogram_logger.cpp \
uptime_parser.cpp \
bootstat_src_files := \
bootstat.cpp \
bootstat_test_src_files := \
boot_event_record_store_test.cpp \
event_log_list_builder_test.cpp \
testrunner.cpp \
bootstat_shared_libs := \
libbase \
libcutils \
liblog \
bootstat_cflags := \
-Wall \
-Wextra \
-Werror \
# 524291 corresponds to sysui_histogram, from
# frameworks/base/core/java/com/android/internal/logging/EventLogTags.logtags
bootstat_cflags += -DHISTOGRAM_LOG_TAG=524291
bootstat_debug_cflags := \
$(bootstat_cflags) \
-UNDEBUG \
# bootstat static library
# -----------------------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := libbootstat
LOCAL_CFLAGS := $(bootstat_cflags)
LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_prod
LOCAL_SHARED_LIBRARIES := $(bootstat_shared_libs)
LOCAL_SRC_FILES := $(bootstat_lib_src_files)
# Clang is required because of C++14
LOCAL_CLANG := true
include $(BUILD_STATIC_LIBRARY)
# bootstat static library, debug
# -----------------------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := libbootstat_debug
LOCAL_CFLAGS := $(bootstat_cflags)
LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_prod
LOCAL_SHARED_LIBRARIES := $(bootstat_shared_libs)
LOCAL_SRC_FILES := $(bootstat_lib_src_files)
# Clang is required because of C++14
LOCAL_CLANG := true
include $(BUILD_STATIC_LIBRARY)
# bootstat host static library, debug
# -----------------------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := libbootstat_host_debug
LOCAL_CFLAGS := $(bootstat_debug_cflags)
LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_prod
LOCAL_SHARED_LIBRARIES := $(bootstat_shared_libs)
LOCAL_SRC_FILES := $(bootstat_lib_src_files)
# Clang is required because of C++14
LOCAL_CLANG := true
include $(BUILD_HOST_STATIC_LIBRARY)
# bootstat binary
# -----------------------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := bootstat
LOCAL_CFLAGS := $(bootstat_cflags)
LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_prod
LOCAL_SHARED_LIBRARIES := $(bootstat_shared_libs)
LOCAL_STATIC_LIBRARIES := libbootstat
LOCAL_INIT_RC := bootstat.rc
LOCAL_SRC_FILES := $(bootstat_src_files)
# Clang is required because of C++14
LOCAL_CLANG := true
include $(BUILD_EXECUTABLE)
# Native tests
# -----------------------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := bootstat_tests
LOCAL_CFLAGS := $(bootstat_tests_cflags)
LOCAL_SHARED_LIBRARIES := $(bootstat_shared_libs)
LOCAL_STATIC_LIBRARIES := libbootstat_debug libgmock
LOCAL_SRC_FILES := $(bootstat_test_src_files)
# Clang is required because of C++14
LOCAL_CLANG := true
include $(BUILD_NATIVE_TEST)
# Host native tests
# -----------------------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := bootstat_tests
LOCAL_CFLAGS := $(bootstat_tests_cflags)
LOCAL_SHARED_LIBRARIES := $(bootstat_shared_libs)
LOCAL_STATIC_LIBRARIES := libbootstat_host_debug libgmock_host
LOCAL_SRC_FILES := $(bootstat_test_src_files)
# Clang is required because of C++14
LOCAL_CLANG := true
include $(BUILD_HOST_NATIVE_TEST)

View file

@ -0,0 +1,80 @@
cc_defaults {
name: "libmemunreachable_defaults",
cflags: [
"-std=c++14",
"-Wall",
"-Wextra",
"-Werror",
],
clang: true,
shared_libs: [
"libbase",
"liblog",
],
}
cc_library_shared {
name: "libmemunreachable",
defaults: ["libmemunreachable_defaults"],
srcs: [
"Allocator.cpp",
"HeapWalker.cpp",
"LeakFolding.cpp",
"LeakPipe.cpp",
"LineBuffer.cpp",
"MemUnreachable.cpp",
"ProcessMappings.cpp",
"PtracerThread.cpp",
"ThreadCapture.cpp",
],
static_libs: [
"libc_malloc_debug_backtrace",
"libc_logging",
],
// Only need this for arm since libc++ uses its own unwind code that
// doesn't mix with the other default unwind code.
arch: {
arm: {
static_libs: ["libunwind_llvm"],
},
},
export_include_dirs: ["include"],
local_include_dirs: ["include"],
}
cc_test {
name: "memunreachable_test",
defaults: ["libmemunreachable_defaults"],
host_supported: true,
srcs: [
"tests/Allocator_test.cpp",
"tests/HeapWalker_test.cpp",
"tests/LeakFolding_test.cpp",
],
target: {
android: {
srcs: [
"tests/DisableMalloc_test.cpp",
"tests/MemUnreachable_test.cpp",
"tests/ThreadCapture_test.cpp",
],
shared_libs: [
"libmemunreachable",
],
},
host: {
srcs: [
"Allocator.cpp",
"HeapWalker.cpp",
"LeakFolding.cpp",
"tests/HostMallocStub.cpp",
],
},
darwin: {
enabled: false,
},
},
}

View file

@ -1,65 +0,0 @@
LOCAL_PATH := $(call my-dir)
memunreachable_srcs := \
Allocator.cpp \
HeapWalker.cpp \
LeakFolding.cpp \
LeakPipe.cpp \
LineBuffer.cpp \
MemUnreachable.cpp \
ProcessMappings.cpp \
PtracerThread.cpp \
ThreadCapture.cpp \
memunreachable_test_srcs := \
tests/Allocator_test.cpp \
tests/DisableMalloc_test.cpp \
tests/HeapWalker_test.cpp \
tests/LeakFolding_test.cpp \
tests/MemUnreachable_test.cpp \
tests/ThreadCapture_test.cpp \
include $(CLEAR_VARS)
LOCAL_MODULE := libmemunreachable
LOCAL_SRC_FILES := $(memunreachable_srcs)
LOCAL_CFLAGS := -std=c++14 -Wall -Wextra -Werror
LOCAL_SHARED_LIBRARIES := libbase liblog
LOCAL_STATIC_LIBRARIES := libc_malloc_debug_backtrace libc_logging
# Only need this for arm since libc++ uses its own unwind code that
# doesn't mix with the other default unwind code.
LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CLANG := true
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := memunreachable_test
LOCAL_SRC_FILES := $(memunreachable_test_srcs)
LOCAL_CFLAGS := -std=c++14 -Wall -Wextra -Werror
LOCAL_CLANG := true
LOCAL_SHARED_LIBRARIES := libmemunreachable libbase liblog
include $(BUILD_NATIVE_TEST)
include $(CLEAR_VARS)
LOCAL_MODULE := memunreachable_test
LOCAL_SRC_FILES := \
Allocator.cpp \
HeapWalker.cpp \
LeakFolding.cpp \
tests/Allocator_test.cpp \
tests/HeapWalker_test.cpp \
tests/HostMallocStub.cpp \
tests/LeakFolding_test.cpp \
LOCAL_CFLAGS := -std=c++14 -Wall -Wextra -Werror
LOCAL_CLANG := true
LOCAL_SHARED_LIBRARIES := libbase liblog
LOCAL_MODULE_HOST_OS := linux
include $(BUILD_HOST_NATIVE_TEST)

42
libsync/Android.bp Normal file
View file

@ -0,0 +1,42 @@
cc_defaults {
name: "libsync_defaults",
srcs: ["sync.c"],
local_include_dirs: ["include"],
export_include_dirs: ["include"],
cflags: ["-Werror"],
}
cc_library_shared {
name: "libsync",
defaults: ["libsync_defaults"],
}
// libsync_recovery is only intended for the recovery binary.
// Future versions of the kernel WILL require an updated libsync, and will break
// anything statically linked against the current libsync.
cc_library_static {
name: "libsync_recovery",
defaults: ["libsync_defaults"],
}
cc_test {
name: "sync_test",
defaults: ["libsync_defaults"],
gtest: false,
srcs: ["sync_test.c"],
}
cc_test {
name: "sync-unit-tests",
shared_libs: ["libsync"],
srcs: ["tests/sync_test.cpp"],
cflags: [
"-g",
"-Wall",
"-Werror",
"-std=gnu++11",
"-Wno-missing-field-initializers",
"-Wno-sign-compare",
],
clang: true,
}

View file

@ -1,30 +0,0 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := sync.c
LOCAL_MODULE := libsync
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_CFLAGS := -Werror
include $(BUILD_SHARED_LIBRARY)
# libsync_recovery is only intended for the recovery binary.
# Future versions of the kernel WILL require an updated libsync, and will break
# anything statically linked against the current libsync.
include $(CLEAR_VARS)
LOCAL_SRC_FILES := sync.c
LOCAL_MODULE := libsync_recovery
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_CFLAGS := -Werror
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := sync.c sync_test.c
LOCAL_MODULE := sync_test
LOCAL_MODULE_TAGS := optional tests
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CFLAGS := -Werror
include $(BUILD_EXECUTABLE)

View file

@ -1,29 +0,0 @@
#
# Copyright 2014 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.
#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_MODULE := sync-unit-tests
LOCAL_CFLAGS += -g -Wall -Werror -std=gnu++11 -Wno-missing-field-initializers -Wno-sign-compare
LOCAL_SHARED_LIBRARIES += libsync
LOCAL_STATIC_LIBRARIES += libgtest_main
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
LOCAL_SRC_FILES := \
sync_test.cpp
include $(BUILD_NATIVE_TEST)