Skip to content

Commit

Permalink
Commit flatbuffers because trying to compile it in CI is a pia
Browse files Browse the repository at this point in the history
  • Loading branch information
emesare committed Oct 23, 2024
1 parent 729aec3 commit c556bd8
Show file tree
Hide file tree
Showing 58 changed files with 6,926 additions and 14 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install -y flatbuffers-compiler
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo test --all-features
- run: cargo test --features fbcg_rust/dont_build

# Check formatting with rustfmt
formatting:
name: cargo fmt
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install -y flatbuffers-compiler
# Ensure rustfmt is installed and setup problem matcher
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand All @@ -32,7 +30,6 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install -y flatbuffers-compiler
- name: Install cargo-about
uses: baptiste0928/cargo-install@v3
with:
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Cargo.lock
# Best practice for something like this, the python scripts are not meant to be "deployed" from this repo state.
poetry.lock

gen_flatbuffers

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
5 changes: 4 additions & 1 deletion fbcg_rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ edition = "2021"
flatbuffers = "24.3.25"

[build-dependencies]
flatbuffers-build = "0.2.0"
flatbuffers-build = "0.2.0"

[features]
dont_build = []
10 changes: 7 additions & 3 deletions fbcg_rust/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use flatbuffers_build::BuilderOptions;

Check failure on line 1 in fbcg_rust/build.rs

View workflow job for this annotation

GitHub Actions / cargo test

unused import: `flatbuffers_build::BuilderOptions`
use std::path::PathBuf;

Check failure on line 2 in fbcg_rust/build.rs

View workflow job for this annotation

GitHub Actions / cargo test

unused import: `std::path::PathBuf`

#[cfg(feature = "dont_build")]
pub fn main() {}

#[cfg(not(feature = "dont_build"))]
pub fn main() {
// Remove leftover symlink dir.
let _ = std::fs::remove_dir_all("src/gen_flatbuffers");
Expand All @@ -10,7 +14,7 @@ pub fn main() {
workspace_dir.join("symbol.fbs"),

Check warning on line 14 in fbcg_rust/build.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/build.rs
workspace_dir.join("signature.fbs"),
])
.set_symlink_directory("src/gen_flatbuffers")
.compile()
.expect("flatbuffer compilation failed");
.set_output_path("src/gen_flatbuffers")
.compile()
.expect("flatbuffer compilation failed");
}
115 changes: 115 additions & 0 deletions fbcg_rust/src/gen_flatbuffers/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.

Check warning on line 1 in fbcg_rust/src/gen_flatbuffers/mod.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/src/gen_flatbuffers/mod.rs
// @generated
pub mod sig_bin {
use super::*;
mod basic_block_generated;
pub use self::basic_block_generated::*;
mod function_constraint_generated;
pub use self::function_constraint_generated::*;
mod function_constraints_generated;
pub use self::function_constraints_generated::*;
mod function_generated;
pub use self::function_generated::*;
mod data_generated;
pub use self::data_generated::*;
} // sig_bin
pub mod symbol_bin {
use super::*;
mod symbol_class_generated;
pub use self::symbol_class_generated::*;
mod symbol_modifiers_generated;
pub use self::symbol_modifiers_generated::*;
mod function_symbol_class_generated;
pub use self::function_symbol_class_generated::*;
mod data_symbol_class_generated;
pub use self::data_symbol_class_generated::*;
mod symbol_generated;
pub use self::symbol_generated::*;
} // symbol_bin
pub mod type_bin {
use super::*;
mod type_modifier_class_generated;
pub use self::type_modifier_class_generated::*;
mod type_alignment_generated;
pub use self::type_alignment_generated::*;
mod pointer_addressing_generated;
pub use self::pointer_addressing_generated::*;
mod array_modifiers_generated;
pub use self::array_modifiers_generated::*;
mod structure_member_modifiers_generated;
pub use self::structure_member_modifiers_generated::*;
mod location_class_generated;
pub use self::location_class_generated::*;
mod type_class_generated;
pub use self::type_class_generated::*;
mod unsigned_bit_offset_generated;
pub use self::unsigned_bit_offset_generated::*;
mod bit_offset_generated;
pub use self::bit_offset_generated::*;
mod bit_shift_generated;
pub use self::bit_shift_generated::*;
mod bit_size_generated;
pub use self::bit_size_generated::*;
mod bit_width_generated;
pub use self::bit_width_generated::*;
mod constant_modifier_class_generated;
pub use self::constant_modifier_class_generated::*;
mod volatile_modifier_class_generated;
pub use self::volatile_modifier_class_generated::*;
mod descriptor_modifier_class_generated;
pub use self::descriptor_modifier_class_generated::*;
mod metadata_modifier_class_generated;
pub use self::metadata_modifier_class_generated::*;
mod type_modifier_generated;
pub use self::type_modifier_generated::*;
mod access_alignment_generated;
pub use self::access_alignment_generated::*;
mod fixed_alignment_generated;
pub use self::fixed_alignment_generated::*;
mod void_generated;
pub use self::void_generated::*;
mod boolean_generated;
pub use self::boolean_generated::*;
mod float_generated;
pub use self::float_generated::*;
mod character_generated;
pub use self::character_generated::*;
mod integer_generated;
pub use self::integer_generated::*;
mod pointer_generated;
pub use self::pointer_generated::*;
mod array_generated;
pub use self::array_generated::*;
mod structure_member_generated;
pub use self::structure_member_generated::*;
mod structure_generated;
pub use self::structure_generated::*;
mod enumeration_member_generated;
pub use self::enumeration_member_generated::*;
mod enumeration_generated;
pub use self::enumeration_generated::*;
mod union_member_generated;
pub use self::union_member_generated::*;
mod union_generated;
pub use self::union_generated::*;
mod calling_convention_generated;
pub use self::calling_convention_generated::*;
mod register_location_generated;
pub use self::register_location_generated::*;
mod stack_location_generated;
pub use self::stack_location_generated::*;
mod function_member_location_generated;
pub use self::function_member_location_generated::*;
mod function_member_generated;
pub use self::function_member_generated::*;
mod function_generated;
pub use self::function_generated::*;
mod referrer_generated;
pub use self::referrer_generated::*;
mod type_generated;
pub use self::type_generated::*;
mod computed_type_generated;
pub use self::computed_type_generated::*;
mod data_generated;
pub use self::data_generated::*;
} // type_bin
109 changes: 109 additions & 0 deletions fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated

Check warning on line 2 in fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::mem;

Check warning on line 8 in fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs
use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum BasicBlockOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct BasicBlock<'a> {

Check warning on line 15 in fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs
pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for BasicBlock<'a> {
type Inner = BasicBlock<'a>;

Check warning on line 20 in fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}

impl<'a> BasicBlock<'a> {
pub const VT_GUID: flatbuffers::VOffsetT = 4;

Check warning on line 28 in fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs

#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
BasicBlock { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args BasicBlockArgs<'args>
) -> flatbuffers::WIPOffset<BasicBlock<'bldr>> {
let mut builder = BasicBlockBuilder::new(_fbb);
if let Some(x) = args.guid { builder.add_guid(x); }
builder.finish()
}


#[inline]
pub fn guid(&self) -> &'a str {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(BasicBlock::VT_GUID, None).unwrap()}
}
}

impl flatbuffers::Verifiable for BasicBlock<'_> {
#[inline]

Check warning on line 55 in fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("guid", Self::VT_GUID, true)?
.finish();
Ok(())
}
}
pub struct BasicBlockArgs<'a> {
pub guid: Option<flatbuffers::WIPOffset<&'a str>>,
}

Check warning on line 68 in fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs
impl<'a> Default for BasicBlockArgs<'a> {
#[inline]
fn default() -> Self {
BasicBlockArgs {
guid: None, // required field
}
}
}

pub struct BasicBlockBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,

Check warning on line 79 in fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/warp/warp/fbcg_rust/src/gen_flatbuffers/sig_bin/basic_block_generated.rs
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> BasicBlockBuilder<'a, 'b, A> {
#[inline]
pub fn add_guid(&mut self, guid: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(BasicBlock::VT_GUID, guid);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> BasicBlockBuilder<'a, 'b, A> {
let start = _fbb.start_table();
BasicBlockBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<BasicBlock<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, BasicBlock::VT_GUID,"guid");
flatbuffers::WIPOffset::new(o.value())
}
}

impl core::fmt::Debug for BasicBlock<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("BasicBlock");
ds.field("guid", &self.guid());
ds.finish()
}
}
Loading

0 comments on commit c556bd8

Please sign in to comment.