Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ jobs:
- name: Check diff
run: git diff --exit-code
# Todo: eventually we should check in bindings and test them
- name: Makefile tests
run: cd temporal_capi/cpp_tests && make
- name: FFI tests
run: |
pushd temporal_capi/tests/c && make && popd
pushd temporal_capi/tests/cpp && make && popd

# There's no guarantee that dependencies are no_std unless you test with a toolchain without `std`
- name: Install no_std toolchain
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ tzdata/

# Ignore log files
*.log

# Ignore clangd files
.cache
compile_commands.json
68 changes: 37 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 27 additions & 15 deletions diplomat-gen/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
use std::path::Path;
use std::{io, path::Path};

use diplomat_tool::config::Config;

fn main() -> std::io::Result<()> {
const LANGUAGES: [&str; 2] = ["c", "cpp"];

let manifest = Path::new(env!("CARGO_MANIFEST_DIR"));

let capi = manifest.parent().unwrap().join("temporal_capi");

let library_config = Default::default();
let library_config = Config::default();

for lang in LANGUAGES {
diplomat_tool::gen(
&capi.join("src/lib.rs"),
lang,
&{
let include = capi.join("bindings").join(lang);
if let Err(err) = std::fs::remove_dir_all(&include) {
if err.kind() != io::ErrorKind::NotFound {
return Err(err);
}
}
std::fs::create_dir(&include)?;
include
},
&Default::default(),
library_config.clone(),
false,
)?;
}

diplomat_tool::gen(
&capi.join("src/lib.rs"),
"cpp",
&{
let include = capi.join("bindings").join("cpp");
std::fs::remove_dir_all(&include)?;
std::fs::create_dir(&include)?;
include
},
&Default::default(),
library_config,
false,
)
Ok(())
}
39 changes: 39 additions & 0 deletions temporal_capi/bindings/c/AnyCalendarKind.d.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions temporal_capi/bindings/c/AnyCalendarKind.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions temporal_capi/bindings/c/ArithmeticOverflow.d.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions temporal_capi/bindings/c/ArithmeticOverflow.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions temporal_capi/bindings/c/Calendar.d.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading