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

Commit 0570b2d7 authored by Chris Manton's avatar Chris Manton
Browse files

Change bluetooth bundler tool to be host only

-Rename main root in schema

Bug: 157647700
Test: atest --host bluetooth_test_gd
Tag: #gd-refactor
Change-Id: I03570e047d643ff8e9a45a99c16062d3958a21fc
parent 593d18f1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -478,7 +478,7 @@ genrule {
    tools: [
            "bluetooth_flatbuffer_bundler",
    ],
    cmd: "$(location bluetooth_flatbuffer_bundler) -w -m DumpsysData -f module_schema_data -n bluetooth::dumpsys -g $(genDir) $(locations :BluetoothGeneratedModuleSchemaData_h)",
    cmd: "$(location bluetooth_flatbuffer_bundler) -w -m bluetooth.DumpsysData -f module_schema_data -n bluetooth::dumpsys -g $(genDir) $(locations :BluetoothGeneratedModuleSchemaData_h)",
    srcs: [
        "*.bfbs",
        ":BluetoothGeneratedModuleSchemaData_h",
+4 −2
Original line number Diff line number Diff line
@@ -28,9 +28,8 @@ genrule {
    ],
}

cc_binary {
cc_binary_host {
    name: "bluetooth_flatbuffer_bundler",
    host_supported: true,
    cflags: [
        "-Wall",
        "-Werror",
@@ -61,6 +60,9 @@ cc_test {
    srcs: [
        ":BluetoothFlatbufferBundlerTestSources",
    ],
    generated_headers: [
        "BluetoothGeneratedBundler_h",
    ],
    static_libs: [
        "libflatbuffers-cpp",
    ],
+9 −13
Original line number Diff line number Diff line
@@ -22,15 +22,10 @@
#include <vector>

#include "bundler.h"
#include "bundler_generated.h"
#include "flatbuffers/idl.h"
#include "flatbuffers/util.h"

#ifdef USE_TEST_GENERATED
#include "test_generated.h"
#else
#include "bundler_generated.h"  // Production
#endif

using namespace bluetooth;
using namespace dumpsys;

@@ -192,7 +187,7 @@ int ReadBundledSchema() {
  const flatbuffers::Vector<flatbuffers::Offset<BundleSchemaMap>>* map = bundle_schema->map();

  fprintf(stdout, "Bundle schema title:%s\n", bundle_schema->title()->c_str());
  fprintf(stdout, "Bundle schema root:%s\n", bundle_schema->root()->c_str());
  fprintf(stdout, "Bundle schema root_name:%s\n", bundle_schema->root_name()->c_str());
  int cnt = 0;
  for (auto it = map->cbegin(); it != map->cend(); ++it, cnt++) {
    fprintf(stdout, "   %d name:%s schema:%s\n", cnt, it->name()->c_str(), "schema");
@@ -204,9 +199,9 @@ int WriteBundledSchema() {
  const char* filename = opts.filename;
  assert(filename != nullptr);

  const char* main_root = opts.main_root;
  if (main_root == nullptr) {
    fprintf(stderr, "Must specify the name of the main root for this bundle\n");
  const char* main_root_name = opts.main_root_name;
  if (main_root_name == nullptr) {
    fprintf(stderr, "Must specify the name of the main root name for this bundle\n");
    return EXIT_FAILURE;
  }

@@ -228,7 +223,7 @@ int WriteBundledSchema() {
  }

  auto title = "Bundled schema tables";
  auto schema_offset = CreateBundleSchemaDirect(builder, title, main_root, &vector_map);
  auto schema_offset = CreateBundleSchemaDirect(builder, title, main_root_name, &vector_map);
  builder.Finish(schema_offset);

  std::string final_filename(opts.gen);
@@ -257,7 +252,8 @@ int WriteBundledSchema() {
int Usage(int argc, char** argv) {
  fprintf(
      stderr,
      "Usage: %s [-r | -w] [-f <filename>] [-g <gen_out_path>] [-n <namespace> ] [-v] -m <main_root> <file.bfbs ...>\n",
      "Usage: %s [-r | -w] [-f <filename>] [-g <gen_out_path>] [-n <namespace> ] [-v] -m <main_root_name> <file.bfbs "
      "...>\n",
      argv[0]);
  fprintf(stderr, " -r|-w : Read or write a dumpsys file\n");
  fprintf(stderr, " -f : Filename bundled schema to read or write (default:%s)\n", kDefaultBundleDataFile);
@@ -283,7 +279,7 @@ void ParseArgs(int argc, char** argv) {
        parsed_cnt++;
        break;
      case 'm':
        opts.main_root = optarg;
        opts.main_root_name = optarg;
        parsed_cnt++;
        break;
      case 'n':
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ table BundleSchemaMap {

table BundleSchema {
    title:string;
    root:string;
    root_name:string;
    map:[BundleSchemaMap];
}

+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ struct Opts {
  bool write{false};
  const char* filename{kDefaultBundleDataFile};
  const char* gen{kDefaultGeneratedOutputPath};
  const char* main_root{nullptr};
  const char* main_root_name{nullptr};
  const char* ns_name{kDefaultNamespace};
  struct {
    int c{0};
Loading