Skip to content

Commit

Permalink
fix workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sbag13 committed Aug 20, 2024
1 parent d53c4a1 commit 7ce5886
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ jobs:
run: cargo build --verbose
- name: Run clippy
run: cargo clippy --all-features
- name: Build tests crate
run: cd tests && cargo build
- name: Run c++ example
run: cd ./tests/cpp/ && ./test_cpp.sh && cd -
run: cd ./cpp/ && ./test_cpp.sh && cd -
- name: Run swift example
run: cd ./tests/swift/ && ./test_swift.sh && cd -
run: cd ./swift/ && ./test_swift.sh && cd -
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ fn write_swift_code(wrapper: &Wrapper) {
std::fs::create_dir_all(&ffi_module_path).expect("Unable to create Ffi directory");

let c_ffi_package_file = c_ffi_package_path.join("Package.swift");
write_to_file(swift_c_ffi_package_definition(), &c_ffi_package_file);
write_to_file(swift_c_ffi_package_definition(), c_ffi_package_file);

let ffi_package_file = ffi_package_path.join("Package.swift");
write_to_file(swift_ffi_package_definition(), &ffi_package_file);
write_to_file(swift_ffi_package_definition(), ffi_package_file);

let module_map = c_ffi_module_path.join("module.modulemap");
let package_name = std::env::var("CARGO_PKG_NAME").expect("Package name expected");
write_to_file(clang_module_map(package_name), &module_map);
write_to_file(clang_module_map(package_name), module_map);

write_to_file(swift_c_header_code_base(), &swift_header_path);

Expand Down Expand Up @@ -134,6 +134,7 @@ fn write_to_file(content: impl Display, path: impl AsRef<Path>) {
writeln!(file, "{}", content).expect("Unable to write data");
}

#[cfg(feature = "swift")]
fn append_to_file(content: impl Display, path: impl AsRef<Path>) {
let mut file = OpenOptions::new()
.create(true)
Expand Down

0 comments on commit 7ce5886

Please sign in to comment.