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

Commit b907d52e authored by Zach Johnson's avatar Zach Johnson Committed by Gerrit Code Review
Browse files

Merge changes I471a49f6,If5879a76

* changes:
  Clean up facade naming and paths
  Add enforcement of module dependency declaration
parents ef66a1a6 2224c6a2
Loading
Loading
Loading
Loading
+18 −20
Original line number Diff line number Diff line
@@ -121,14 +121,14 @@ cc_binary {
    srcs: [
        "facade/stack_with_grpc_main.cc",
        "grpc/grpc_module.cc",
        ":BluetoothCertFacade_hci_hal",
        ":BluetoothFacade_hci_hal",
    ],
    generated_headers: [
        "BluetoothGeneratedPackets_h",
        "BluetoothCertFacadeGeneratedStub_h",
        "BluetoothFacadeGeneratedStub_h",
    ],
    generated_sources: [
        "BluetoothCertFacadeGeneratedStub_cc",
        "BluetoothFacadeGeneratedStub_cc",
    ],
    static_libs: [
        "libbluetooth_gd",
@@ -255,51 +255,51 @@ genrule {
}

filegroup {
    name: "BluetoothCertFacadeProto",
    name: "BluetoothFacadeProto",
    srcs: [
        "facade/common.proto",
        "hal/facade/api.proto",
        "hal/facade.proto",
    ],
}

genrule {
    name: "BluetoothCertFacadeGeneratedStub_h",
    name: "BluetoothFacadeGeneratedStub_h",
    tools: [
        "aprotoc",
        "protoc-gen-grpc-cpp-plugin",
    ],
    cmd: "$(location aprotoc) -Ipackages/modules/Bluetooth/system/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
    srcs: [
        ":BluetoothCertFacadeProto",
        ":BluetoothFacadeProto",
    ],
    out: [
        "facade/common.grpc.pb.h",
        "facade/common.pb.h",
        "hal/facade/api.grpc.pb.h",
        "hal/facade/api.pb.h",
        "hal/facade.grpc.pb.h",
        "hal/facade.pb.h",
    ],
}

genrule {
    name: "BluetoothCertFacadeGeneratedStub_cc",
    name: "BluetoothFacadeGeneratedStub_cc",
    tools: [
        "aprotoc",
        "protoc-gen-grpc-cpp-plugin",
    ],
    cmd: "$(location aprotoc) -Ipackages/modules/Bluetooth/system/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
    srcs: [
        ":BluetoothCertFacadeProto",
        ":BluetoothFacadeProto",
    ],
    out: [
        "facade/common.grpc.pb.cc",
        "facade/common.pb.cc",
        "hal/facade/api.grpc.pb.cc",
        "hal/facade/api.pb.cc",
        "hal/facade.grpc.pb.cc",
        "hal/facade.pb.cc",
    ],
}

genrule {
    name: "BluetoothCertFacadeGeneratedStub_py",
    name: "BluetoothFacadeGeneratedStub_py",
    tools: [
        "aprotoc",
        "protoc-gen-grpc-python-plugin",
@@ -307,10 +307,9 @@ genrule {
    cmd: "$(location aprotoc) -Ipackages/modules/Bluetooth/system/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) $(in) --grpc_out=$(genDir) --python_out=$(genDir); " +
        "touch $(genDir)/__init__.py; " +
        "touch $(genDir)/facade/__init__.py; " +
        "touch $(genDir)/hal/__init__.py; " +
        "touch $(genDir)/hal/facade/__init__.py; ",
        "touch $(genDir)/hal/__init__.py; ",
    srcs: [
        ":BluetoothCertFacadeProto",
        ":BluetoothFacadeProto",
    ],
    out: [
        "__init__.py",
@@ -318,8 +317,7 @@ genrule {
        "facade/common_pb2_grpc.py",
        "facade/common_pb2.py",
        "hal/__init__.py",
        "hal/facade/__init__.py",
        "hal/facade/api_pb2_grpc.py",
        "hal/facade/api_pb2.py",
        "hal/facade_pb2_grpc.py",
        "hal/facade_pb2.py",
    ],
}
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import subprocess

ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP')

sys.path.append(ANDROID_BUILD_TOP + '/out/soong/.intermediates/packages/modules/Bluetooth/system/gd/BluetoothCertFacadeGeneratedStub_py/gen')
sys.path.append(ANDROID_BUILD_TOP + '/out/soong/.intermediates/packages/modules/Bluetooth/system/gd/BluetoothFacadeGeneratedStub_py/gen')

ANDROID_HOST_OUT = os.environ.get('ANDROID_HOST_OUT')
ROOTCANAL = ANDROID_HOST_OUT + "/nativetest64/root-canal/root-canal"
+2 −3
Original line number Diff line number Diff line
@@ -35,8 +35,7 @@ from acts.libs.proc import job

import grpc

from hal.facade import api_pb2
from hal.facade import api_pb2_grpc
from hal import facade_pb2_grpc as hal_facade_pb2_grpc

ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP')
ANDROID_HOST_OUT = os.environ.get('ANDROID_HOST_OUT')
@@ -112,7 +111,7 @@ class GdDevice:
            stderr=self.backing_process_logs)

        self.grpc_channel = grpc.insecure_channel("localhost:" + grpc_port)
        self.hal = api_pb2_grpc.HciTransportationStub(self.grpc_channel)
        self.hal = hal_facade_pb2_grpc.HciHalFacadeStub(self.grpc_channel)

    def clean_up(self):
        self.grpc_channel.close()
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

#include "grpc/grpc_module.h"
#include "hal/hci_hal_host_rootcanal.h"
#include "hal/facade/facade.h"
#include "hal/facade.h"

#include <csignal>
#include <string>
@@ -58,7 +58,7 @@ int main(int argc, const char** argv) {
  }

  ModuleList modules;
  modules.add<::bluetooth::hal::facade::HalFacadeModule>();
  modules.add<::bluetooth::hal::HciHalFacadeModule>();

  Thread* stack_thread = new Thread("stack_thread", Thread::Priority::NORMAL);
  stack = new StackManager();
+6 −6
Original line number Diff line number Diff line
@@ -28,11 +28,11 @@ namespace grpc {
void GrpcModule::ListDependencies(ModuleList* list) {
}

void GrpcModule::Start(const ModuleRegistry* registry) {
void GrpcModule::Start() {
  ASSERT(!started_);
}

void GrpcModule::Stop(const ModuleRegistry* registry) {
void GrpcModule::Stop() {
  ASSERT(!started_);
}

@@ -111,12 +111,12 @@ void GrpcFacadeModule::ListDependencies(ModuleList* list) {
  list->add<GrpcModule>();
}

void GrpcFacadeModule::Start(const ModuleRegistry* registry) {
  registry->GetInstance<GrpcModule>()->Register(this);
void GrpcFacadeModule::Start() {
  GetDependency<GrpcModule>()->Register(this);
}

void GrpcFacadeModule::Stop(const ModuleRegistry* registry) {
  registry->GetInstance<GrpcModule>()->Unregister(this);
void GrpcFacadeModule::Stop() {
  GetDependency<GrpcModule>()->Unregister(this);
}

}  // namespace grpc
Loading