Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45119335 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "dumpstate/Android.mk is converted to Android.bp"

parents 715778f8 b22e65d9
Loading
Loading
Loading
Loading
+127 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2017 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: "dumpstate_defaults",
    cflags: [
        "-Wall",
        "-Werror",
        "-Wno-missing-field-initializers",
        "-Wno-unused-variable",
        "-Wunused-parameter",
    ],
}

cc_library_headers {
    name: "dumpstate_headers",
    vendor_available: true,
    export_include_dirs: ["."],
    header_libs: [
        "libbase_headers",
        "libutils_headers",
    ],
    export_header_lib_headers: [
        "libbase_headers",
        "libutils_headers",
    ],
}

cc_library_shared {
    name: "libdumpstateutil",
    defaults: ["dumpstate_defaults"],
    vendor_available: true,
    header_libs: ["dumpstate_headers"],
    export_header_lib_headers: ["dumpstate_headers"],
    srcs: [
        "DumpstateInternal.cpp",
        "DumpstateUtil.cpp",
    ],
    shared_libs: [
        "libbase",
        "liblog",
    ],
}

cc_library_shared {
    name: "libdumpstateaidl",
    defaults: ["dumpstate_defaults"],
    shared_libs: [
        "libbinder",
        "libutils",
    ],
    aidl: {
        local_include_dirs: ["binder"],
        export_aidl_headers: true,
    },
    srcs: [
        "binder/android/os/IDumpstate.aidl",
        "binder/android/os/IDumpstateListener.aidl",
        "binder/android/os/IDumpstateToken.aidl",
    ],
}

cc_binary {
    name: "dumpstate",
    defaults: ["dumpstate_defaults"],
    header_libs: ["dumpstate_headers"],
    shared_libs: [
        "android.hardware.dumpstate@1.0",
        "libziparchive",
        "libbase",
        "libbinder",
        "libcrypto",
        "libcutils",
        "libdebuggerd_client",
        "libdumpstateaidl",
        "libdumpstateutil",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libutils",
    ],
    srcs: [
        "DumpstateInternal.cpp",
        "DumpstateService.cpp",
        "utils.cpp",
        "dumpstate.cpp",
    ],
    init_rc: ["dumpstate.rc"],
}

cc_test {
    name: "dumpstate_test",
    defaults: ["dumpstate_defaults"],
    header_libs: ["dumpstate_headers"],
    shared_libs: [
        "libziparchive",
        "libbase",
        "libbinder",
        "libcutils",
        "libdebuggerd_client",
        "libdumpstateaidl",
        "libdumpstateutil",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libutils",
    ],
    srcs: [
        "DumpstateInternal.cpp",
        "DumpstateService.cpp",
        "utils.cpp",
        "tests/dumpstate_test.cpp",
    ],
    static_libs: ["libgmock"],
}
+2 −133
Original line number Diff line number Diff line
LOCAL_PATH:= $(call my-dir)

# ================#
# Common settings #
# ================#
# ZipArchive support, the order matters here to get all symbols.
COMMON_ZIP_LIBRARIES := libziparchive libz libcrypto

# TODO: ideally the tests should depend on a shared dumpstate library, but currently libdumpstate
# is used to define the device-specific HAL library. Instead, both dumpstate and dumpstate_test
# shares a lot of common settings
COMMON_LOCAL_CFLAGS := \
       -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter
COMMON_SRC_FILES := \
        DumpstateInternal.cpp \
        utils.cpp
COMMON_SHARED_LIBRARIES := \
        android.hardware.dumpstate@1.0 \
        libhidlbase \
        libhidltransport \
        libbase \
        libbinder \
        libcutils \
        libdebuggerd_client \
        libdumpstateaidl \
        libdumpstateutil \
        liblog \
        libselinux \
        libutils \
        $(COMMON_ZIP_LIBRARIES)

# ====================#
# libdumpstateutil #
# ====================#
include $(CLEAR_VARS)

LOCAL_MODULE := libdumpstateutil

LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
LOCAL_SRC_FILES := \
        DumpstateInternal.cpp \
        DumpstateUtil.cpp
LOCAL_SHARED_LIBRARIES := \
        libbase \
        liblog \

include $(BUILD_SHARED_LIBRARY)

# ====================#
# libdumpstateheaders #
# ====================#
# TODO: this module is necessary so the device-specific libdumpstate implementations do not
# need to add any other dependency (like libbase). Should go away once dumpstate HAL changes.
include $(CLEAR_VARS)

LOCAL_EXPORT_C_INCLUDE_DIRS = $(LOCAL_PATH)
LOCAL_MODULE := libdumpstateheaders
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \
        $(COMMON_SHARED_LIBRARIES)
LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := \
        $(COMMON_STATIC_LIBRARIES)
# Soong requires that whats is on LOCAL_EXPORTED_ is also on LOCAL_
LOCAL_SHARED_LIBRARIES := $(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS)
LOCAL_STATIC_LIBRARIES := $(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS)

include $(BUILD_STATIC_LIBRARY)

# ================ #
# libdumpstateaidl #
# =================#
include $(CLEAR_VARS)

LOCAL_MODULE := libdumpstateaidl

LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)

LOCAL_SHARED_LIBRARIES := \
        libbinder \
        libutils
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/binder
LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder
LOCAL_C_INCLUDES := $(LOCAL_PATH)/binder
LOCAL_SRC_FILES := \
        binder/android/os/IDumpstate.aidl \
        binder/android/os/IDumpstateListener.aidl \
        binder/android/os/IDumpstateToken.aidl

include $(BUILD_SHARED_LIBRARY)

# ==========#
# dumpstate #
# ==========#
include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
        DumpstateService.cpp \
        dumpstate.cpp

LOCAL_MODULE := dumpstate

LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)

LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)

LOCAL_CFLAGS += $(COMMON_LOCAL_CFLAGS)

LOCAL_INIT_RC := dumpstate.rc

include $(BUILD_EXECUTABLE)

# ===============#
# dumpstate_test #
# ===============#
include $(CLEAR_VARS)

LOCAL_MODULE := dumpstate_test

LOCAL_MODULE_TAGS := tests

LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)

LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
        DumpstateService.cpp \
        tests/dumpstate_test.cpp

LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) \
        libgmock

LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)

include $(BUILD_NATIVE_TEST)

# =======================#
# dumpstate_test_fixture #
# =======================#
@@ -141,7 +9,8 @@ LOCAL_MODULE := dumpstate_test_fixture
LOCAL_COMPATIBILITY_SUITE := device-tests
LOCAL_MODULE_TAGS := tests

LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
LOCAL_CFLAGS := \
       -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter

LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk

+2 −1
Original line number Diff line number Diff line
@@ -25,13 +25,14 @@
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include <cstdint>
#include <string>
#include <vector>

#include <android-base/file.h>
#include <cutils/log.h>
#include <log/log.h>
#include <private/android_filesystem_config.h>

uint64_t Nanotime() {
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <cutils/log.h>
#include <log/log.h>

#include "DumpstateInternal.h"

+4 −1
Original line number Diff line number Diff line
@@ -26,10 +26,11 @@
#include <vector>

#include <android-base/macros.h>
#include <android/os/IDumpstateListener.h>
#include <utils/StrongPointer.h>
#include <ziparchive/zip_writer.h>

#include "DumpstateUtil.h"
#include "android/os/BnDumpstate.h"

// Workaround for const char *args[MAX_ARGS_ARRAY_SIZE] variables until they're converted to
// std::vector<std::string>
@@ -49,6 +50,8 @@ class ProgressTest;
}  // namespace os
}  // namespace android

class ZipWriter;

// TODO: remove once moved to HAL
#ifdef __cplusplus
extern "C" {