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

Commit 34ec9a61 authored by Zach Johnson's avatar Zach Johnson
Browse files

rusty-packets: stub out rust generation function

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: I8767e4f9ebcf8de6930ab905142afc1a002fdb43
parent d88801f8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ cc_binary_host {
        "language_y.yy",
        "language_l.ll",
        "gen_cpp.cc",
        "gen_rust.cc",
    ],
    static_libs: [
        "libc++fs",
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 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.
 */

#include <filesystem>
#include "declarations.h"

bool generate_rust_source_one_file(
    __attribute__((unused)) const Declarations& decls,
    __attribute__((unused)) const std::filesystem::path& input_file,
    __attribute__((unused)) const std::filesystem::path& include_dir,
    __attribute__((unused)) const std::filesystem::path& out_dir,
    __attribute__((unused)) const std::string& root_namespace) {
  // TODO do fun things
  return true;
}
+11 −1
Original line number Diff line number Diff line
@@ -50,6 +50,13 @@ bool generate_pybind11_sources_one_file(
    const std::string& root_namespace,
    size_t num_shards);

bool generate_rust_source_one_file(
    const Declarations& decls,
    const std::filesystem::path& input_file,
    const std::filesystem::path& include_dir,
    const std::filesystem::path& out_dir,
    const std::string& root_namespace);

bool parse_declarations_one_file(const std::filesystem::path& input_file, Declarations* declarations) {
  void* scanner;
  yylex_init(&scanner);
@@ -139,7 +146,10 @@ int main(int argc, const char** argv) {
    }
    if (generate_rust) {
      std::cout << "generating rust" << std::endl;
      // TODO do fun things
      if (!generate_rust_source_one_file(declarations, input_files.front(), include_dir, out_dir, root_namespace)) {
        std::cerr << "Didn't generate rust source for " << input_files.front() << std::endl;
        return 5;
      }
    } else {
      std::cout << "generating c++ and pybind11" << std::endl;
      if (!generate_cpp_headers_one_file(declarations, input_files.front(), include_dir, out_dir, root_namespace)) {