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

Commit 62c220b2 authored by Joe Onorato's avatar Joe Onorato
Browse files

Fix how we build the statsd protos.

This lets us include frameworks protos, and use the constants
and messages from them.

Change-Id: I609d6e524f780e6a5beea543a68561bede47813e
Test: make
parent 37e9278c
Loading
Loading
Loading
Loading
+7 −19
Original line number Diff line number Diff line
@@ -677,35 +677,23 @@ cc_library {
        "-Werror",
        "-Wno-unused-parameter",
    ],
    target: {
        host: {
            proto: {
                type: "full",
            },

    srcs: [
        "core/proto/**/*.proto",
        "libs/incident/**/*.proto",
        "tools/streaming_proto/stream.proto",
    ],

    target: {
        host: {
            proto: {
                type: "full",
            },
        },
        android: {
            proto: {
                type: "lite",
            },
            // We only build the protos that are optimized for the lite
            // runtime, as well as the only protos that are actually
            // needed by the device.
            srcs: [
                "core/proto/android/os/cpufreq.proto",
                "core/proto/android/os/cpuinfo.proto",
                "core/proto/android/os/kernelwake.proto",
                "core/proto/android/os/pagetypeinfo.proto",
                "core/proto/android/os/procrank.proto",
                "core/proto/android/os/system_properties.proto",
                "core/proto/android/service/graphicsstats.proto",
                "libs/incident/proto/android/privacy.proto",
                "tools/streaming_proto/stream.proto",
            ],
            shared: {
                enabled: false,
            },
+12 −1
Original line number Diff line number Diff line
@@ -1008,7 +1008,7 @@ include $(BUILD_HOST_JAVA_LIBRARY)
# ====  java proto device library (for test only)  ==============================
include $(CLEAR_VARS)
LOCAL_MODULE := platformprotosnano
LOCAL_MODULE_TAGS := tests optional
LOCAL_MODULE_TAGS := tests
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTOC_FLAGS := \
    -Iexternal/protobuf/src
@@ -1020,6 +1020,17 @@ LOCAL_SRC_FILES := \
include $(BUILD_STATIC_JAVA_LIBRARY)


# ====  java proto device library (for test only)  ==============================
include $(CLEAR_VARS)
LOCAL_MODULE := platformprotoslite
LOCAL_MODULE_TAGS := tests
LOCAL_PROTOC_OPTIMIZE_TYPE := lite
LOCAL_PROTOC_FLAGS := \
    -Iexternal/protobuf/src
LOCAL_SRC_FILES := \
    $(call all-proto-files-under, core/proto)
include $(BUILD_STATIC_JAVA_LIBRARY)

# Include subdirectory makefiles
# ============================================================

+7 −4
Original line number Diff line number Diff line
@@ -50,12 +50,15 @@ cc_test {
        "testdata/*",
    ],

    shared_libs: [
        "libprotobuf-cpp-full",
    ],

    static_libs: [
        "libgmock",
        "libplatformprotos"
    ],

    shared_libs: [
        "libprotobuf-cpp-full"
    ],
    proto: {
        type: "full",
    },
}
+2 −9
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
#include <android-base/file.h>
#include <android-base/test_utils.h>
#include <gmock/gmock.h>
#include <google/protobuf/message.h>
#include <google/protobuf/message_lite.h>
#include <gtest/gtest.h>
#include <string.h>
#include <fcntl.h>
@@ -42,13 +42,6 @@ public:
        ASSERT_TRUE(tf.fd != -1);
    }

    string getSerializedString(::google::protobuf::Message& message) {
        string expectedStr;
        message.SerializeToFileDescriptor(tf.fd);
        ReadFileToString(tf.path, &expectedStr);
        return expectedStr;
    }

protected:
    TemporaryFile tf;

@@ -125,6 +118,6 @@ TEST_F(CpuFreqParserTest, Success) {

    CaptureStdout();
    ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
    close(fd);
}
+2 −9
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
#include <android-base/file.h>
#include <android-base/test_utils.h>
#include <gmock/gmock.h>
#include <google/protobuf/message.h>
#include <google/protobuf/message_lite.h>
#include <gtest/gtest.h>
#include <string.h>
#include <fcntl.h>
@@ -42,13 +42,6 @@ public:
        ASSERT_TRUE(tf.fd != -1);
    }

    string getSerializedString(::google::protobuf::Message& message) {
        string expectedStr;
        message.SerializeToFileDescriptor(tf.fd);
        ReadFileToString(tf.path, &expectedStr);
        return expectedStr;
    }

protected:
    TemporaryFile tf;

@@ -153,6 +146,6 @@ TEST_F(CpuInfoParserTest, Success) {

    CaptureStdout();
    ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
    EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected));
    EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
    close(fd);
}
Loading