Skip to content

Commit c811b23

Browse files
authored
Prepare 0.8.7 (#126)
* modernize workspace * tests target .NET 8 * build ARM8 and x64 macos bindings * add arm64 MacOS to packaging * add additional version information to C# project file * bump version and changelog
1 parent 96ef55f commit c811b23

File tree

15 files changed

+37
-74
lines changed

15 files changed

+37
-74
lines changed

.github/workflows/ci.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,17 @@ jobs:
119119
- name: Java Bindings Tests
120120
if: ${{ matrix.test }}
121121
run: cargo run --bin foo-bindings -- --java -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release
122-
# Build bindings on MacOS [64-bit macOS (10.7+, Lion+) (x86_64-apple-darwin)]
122+
# Build bindings on MacOS
123123
bindings-macos:
124-
runs-on: macos-latest
124+
runs-on: ${{ matrix.runner }}
125125
strategy:
126126
fail-fast: false
127127
matrix:
128-
target:
129-
- x86_64-apple-darwin # 64-bit macOS (10.7+, Lion+)
128+
include:
129+
- runner: macos-14
130+
target: aarch64-apple-darwin
131+
- runner: macos-13
132+
target: x86_64-apple-darwin
130133
steps:
131134
- name: Checkout
132135
uses: actions/checkout@v3

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 0.8.7 ###
2+
* :star: Sets assembly version information to match the schema in C# backend
3+
14
### 0.8.6 ###
25
* :star: Improve Java native library loading. See [#124](https://github.com/stepfunc/oo_bindgen/pull/124).
36

oo-bindgen/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "oo-bindgen"
3-
version = "0.8.6"
3+
version = "0.8.7"
44
authors = ["Step Function I/O LLC <[email protected]>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"

oo-bindgen/src/backend/common/platforms.rs

-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use platforms::Platform;
33
use std::path::PathBuf;
44

55
pub(crate) trait PlatformExt {
6-
fn static_lib_filename<T: AsRef<str>>(&self, libname: T) -> String;
76
fn dyn_lib_filename<T: AsRef<str>>(&self, libname: T) -> String;
87
fn bin_filename<T: AsRef<str>>(&self, libname: T) -> String;
98
}
@@ -14,14 +13,6 @@ pub(crate) trait PlatformExt {
1413
// - https://github.com/rust-lang/rust/blob/1.58.1/library/std/src/sys/windows/env.rs
1514
// - https://github.com/rust-lang/rust/blob/1.58.1/src/tools/compiletest/src/runtest.rs
1615
impl PlatformExt for Platform {
17-
fn static_lib_filename<T: AsRef<str>>(&self, libname: T) -> String {
18-
if self.target_os == OS::Windows {
19-
format!("{}.lib", libname.as_ref())
20-
} else {
21-
format!("lib{}.a", libname.as_ref())
22-
}
23-
}
24-
2516
fn dyn_lib_filename<T: AsRef<str>>(&self, libname: T) -> String {
2617
if self.target_os == OS::Windows {
2718
format!("{}.dll.lib", libname.as_ref())

oo-bindgen/src/backend/common/util.rs

-42
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,8 @@ where
66
next: Option<I::Item>,
77
}
88

9-
impl<I> WithLast<I>
10-
where
11-
I: Iterator,
12-
{
13-
fn drop_last(self) -> DropLast<I> {
14-
DropLast { inner: self }
15-
}
16-
}
17-
18-
pub(crate) struct DropLast<I>
19-
where
20-
I: Iterator,
21-
{
22-
inner: WithLast<I>,
23-
}
24-
25-
impl<I> Iterator for DropLast<I>
26-
where
27-
I: Iterator,
28-
{
29-
type Item = I::Item;
30-
31-
fn next(&mut self) -> Option<Self::Item> {
32-
match self.inner.next() {
33-
None => None,
34-
Some((item, last)) => {
35-
if last {
36-
None
37-
} else {
38-
Some(item)
39-
}
40-
}
41-
}
42-
}
43-
}
44-
459
pub(crate) trait WithLastIndication: Iterator + Sized {
4610
fn with_last(self) -> WithLast<Self>;
47-
48-
fn drop_last(self) -> DropLast<Self>;
4911
}
5012

5113
impl<I> WithLastIndication for I
@@ -59,10 +21,6 @@ where
5921
next: first,
6022
}
6123
}
62-
63-
fn drop_last(self) -> DropLast<I> {
64-
self.with_last().drop_last()
65-
}
6624
}
6725

6826
impl<I> Iterator for WithLast<I>

oo-bindgen/src/backend/dotnet/mod.rs

+13
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ fn generate_csproj(lib: &Library, config: &DotnetBindgenConfig) -> FormattingRes
146146
" <TargetFramework>{}</TargetFramework>",
147147
config.target_framework.get_target_framework_str()
148148
))?;
149+
149150
f.writeln(" <GenerateDocumentationFile>true</GenerateDocumentationFile>")?;
150151
f.writeln(" <IncludeSymbols>true</IncludeSymbols>")?; // Include symbols
151152
f.writeln(" <SymbolPackageFormat>snupkg</SymbolPackageFormat>")?; // Use new file format
@@ -154,6 +155,18 @@ fn generate_csproj(lib: &Library, config: &DotnetBindgenConfig) -> FormattingRes
154155
" <PackageVersion>{}</PackageVersion>",
155156
lib.version
156157
))?;
158+
f.writeln(&format!(
159+
"<VersionPrefix>{}.{}.{}</VersionPrefix>",
160+
lib.version.major, lib.version.minor, lib.version.patch
161+
))?;
162+
163+
if !lib.version.pre.is_empty() {
164+
f.writeln(&format!(
165+
"<VersionSuffix>{}</VersionSuffix>",
166+
lib.version.pre
167+
))?;
168+
}
169+
157170
f.writeln(&format!(
158171
" <Description>{}</Description>",
159172
lib.info.description

oo-bindgen/src/cli/args.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::PathBuf;
55

66
impl Args {
77
pub(crate) fn get() -> Self {
8-
let mut args = crate::cli::Args::parse();
8+
let mut args = Args::parse();
99
if !(args.build_c || args.build_dotnet || args.build_java) {
1010
args.build_c = true;
1111
args.build_dotnet = true;

oo-bindgen/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ patterns_in_fns_without_body,
1010
pub_use_of_private_extern_crate,
1111
unknown_crate_types,
1212
order_dependent_trait_objects,
13-
illegal_floating_point_literal_pattern,
13+
1414
improper_ctypes,
1515
late_bound_lifetime_arguments,
1616
non_camel_case_types,

oo-bindgen/src/model/builder/library.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl LibraryBuilder {
582582
.returns(item_type.get_function_return_value(), "next value or NULL")?
583583
.build()?;
584584

585-
let iter = AbstractIteratorHandle::new(crate::model::iterator::AbstractIterator::new(
585+
let iter = AbstractIteratorHandle::new(AbstractIterator::new(
586586
has_lifetime,
587587
class.inner,
588588
next_function,
@@ -648,7 +648,7 @@ impl LibraryBuilder {
648648
.param("value", value_type.clone(), "value to add to the instance")?
649649
.build()?;
650650

651-
let collection = Handle::new(crate::model::collection::Collection::new(
651+
let collection = Handle::new(Collection::new(
652652
class_decl.inner,
653653
value_type,
654654
create_func,

oo-bindgen/src/model/interface.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ where
403403
/// This type of interface can be converted to a Functor-type in many backend languages
404404
pub(crate) fn get_functional_callback(&self) -> Option<&CallbackFunction<D>> {
405405
match self.callbacks.len() {
406-
1 => self.callbacks.get(0),
406+
1 => self.callbacks.first(),
407407
_ => None,
408408
}
409409
}

oo-bindgen/src/model/types.rs

-7
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,6 @@ pub(crate) trait TypeExtractor {
341341
_ => None,
342342
}
343343
}
344-
345-
fn get_enum_type(&self) -> Option<Handle<Enum<Unvalidated>>> {
346-
match self.get_basic_type() {
347-
Some(BasicType::Enum(x)) => Some(x.clone()),
348-
_ => None,
349-
}
350-
}
351344
}
352345

353346
impl TypeExtractor for FunctionArgStructField {

packaging.json

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"dotnet": true,
1616
"java": true
1717
},
18+
"aarch64-apple-darwin": {
19+
"cpp": false,
20+
"dotnet": true,
21+
"java": true
22+
},
1823
"x86_64-unknown-linux-gnu": {
1924
"cpp": true,
2025
"dotnet": true,

tests/bindings/dotnet/foo.Tests/foo.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

tests/foo-ffi/src/lifetime.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ pub unsafe fn chunk_iterator_next(it: *mut crate::ChunkIterator) -> Option<&crat
3939
None => None,
4040
Some(chunk) => {
4141
(*it.item.iter).values = chunk;
42-
it.bytes = match it.bytes.get(it.chunk_size..) {
43-
Some(x) => x,
44-
None => &[],
45-
};
42+
it.bytes = it.bytes.get(it.chunk_size..).unwrap_or_default();
4643
Some(&it.item)
4744
}
4845
}

tests/foo-ffi/src/strings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub unsafe fn string_class_destroy(string_class: *mut StringClass) {
2525

2626
pub unsafe fn string_class_echo(string_class: *mut StringClass, value: &CStr) -> &CStr {
2727
let string_class = string_class.as_mut().unwrap();
28-
string_class.value = value.to_owned();
28+
value.clone_into(&mut string_class.value);
2929
&string_class.value
3030
}
3131

0 commit comments

Comments
 (0)