Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d0e3fbf
Add the concept of a primitive with a value
jadamcrain Oct 6, 2022
382963d
Add the concept of a Duration with a defautl value
jadamcrain Oct 6, 2022
58d2680
add parallel method and types for defining a default implementation r…
jadamcrain Oct 6, 2022
3ce9cca
add From impls for primitives
jadamcrain Oct 6, 2022
729d5bb
baseline C++ default method generation
jadamcrain Oct 7, 2022
8b03eb7
add a space between interface methods
jadamcrain Oct 7, 2022
316d918
add tests for enum and bool
jadamcrain Oct 7, 2022
7227d7f
identify and fix a JNI codegen bug where signed integers were not pro…
jadamcrain Oct 7, 2022
46556a3
document default constant return value in c++
jadamcrain Oct 9, 2022
990c596
require that the struct initializer be named and parameterless when u…
jadamcrain Oct 11, 2022
41127ac
just emit a warning for C#, b/c we're not prepared to move to C# 8.0 …
jadamcrain Oct 11, 2022
396cce8
implement default interface methods in Java backend
jadamcrain Oct 11, 2022
3cd84b1
explicitly build ffi/jni for target prior to running ci-script
jadamcrain Oct 12, 2022
702c44b
don't use target var for macos, us cross to build ffi/jni in linux cr…
jadamcrain Oct 12, 2022
5cf731f
first step towards making the .NET target framework configurable
jadamcrain Oct 12, 2022
242da64
convert the ci-script to use clap 4.0 with dervice macros
jadamcrain Oct 12, 2022
1590100
fix the package option
jadamcrain Oct 12, 2022
21c9977
set the .NET target framework in the CI script
jadamcrain Oct 12, 2022
593dbc9
Output default interface methods when the target framework is .NET St…
jadamcrain Oct 12, 2022
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
24 changes: 8 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,8 @@ jobs:
run: Copy-Item -Path .cargo/config-windows.toml -Destination .cargo/config.toml
- name: Caching
uses: Swatinem/rust-cache@v1
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Build FFI and JNI
run: cargo build -p foo-ffi -p foo-ffi-java --release --target ${{ matrix.target }}
- name: C bindings
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -190,11 +187,8 @@ jobs:
override: true
- name: Caching
uses: Swatinem/rust-cache@v1
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Build FFI and JNI
run: cargo build -p foo-ffi -p foo-ffi-java --release
- name: C bindings
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -247,12 +241,10 @@ jobs:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}
- name: Install Rust Cross
run: cargo install cross
- name: Build FFI and JNI
run: cross build -p foo-ffi -p foo-ffi-java --release --target ${{ matrix.target }}
- name: C bindings
uses: actions-rs/cargo@v1
with:
Expand Down
89 changes: 59 additions & 30 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion ci-script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ oo-bindgen = { path = "../oo-bindgen" }
c-oo-bindgen = { path = "../generators/c-oo-bindgen" }
dotnet-oo-bindgen = { path = "../generators/dotnet-oo-bindgen" }
java-oo-bindgen = { path = "../generators/java-oo-bindgen" }
clap = "3.2.17"
clap = { version = "^4", features = ["derive"] }
pathdiff = "0.2"
tracing = "^0.1"
5 changes: 5 additions & 0 deletions ci-script/src/builders/dotnet.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
use crate::{BindingBuilder, BindingBuilderSettings};
use dotnet_oo_bindgen::TargetFramework;
use oo_bindgen::backend::PlatformLocations;
use std::path::PathBuf;
use std::process::Command;

pub(crate) struct DotnetBindingBuilder {
settings: BindingBuilderSettings,
target_framework: TargetFramework,
platforms: PlatformLocations,
extra_files: Vec<PathBuf>,
}

impl DotnetBindingBuilder {
pub(crate) fn new(
settings: BindingBuilderSettings,
target_framework: TargetFramework,
platforms: PlatformLocations,
extra_files: &[PathBuf],
) -> Self {
Self {
settings,
target_framework,
platforms,
extra_files: extra_files.to_vec(),
}
Expand Down Expand Up @@ -52,6 +56,7 @@ impl BindingBuilder for DotnetBindingBuilder {
extra_files: self.extra_files.clone(),
platforms: self.platforms.clone(),
generate_doxygen,
target_framework: self.target_framework,
};

dotnet_oo_bindgen::generate_dotnet_bindings(&self.settings.library, &config).unwrap();
Expand Down
77 changes: 30 additions & 47 deletions ci-script/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
use clap::{App, Arg, ArgMatches};
use clap::Parser;
use dotnet_oo_bindgen::TargetFramework;
use std::path::PathBuf;

pub(crate) fn build() -> ArgMatches {
App::new("oo-bindgen")
.arg(
Arg::with_name("c")
.long("c")
.takes_value(false)
.help("Build C bindings"),
)
.arg(
Arg::with_name("dotnet")
.long("dotnet")
.takes_value(false)
.help("Build .NET Core bindings"),
)
.arg(
Arg::with_name("java")
.long("java")
.takes_value(false)
.help("Build Java (JNI) bindings"),
)
.arg(
Arg::with_name("doxygen")
.long("doxygen")
.takes_value(false)
.help("Generate Doxygen documentation"),
)
.arg(
Arg::with_name("no-tests")
.long("no-tests")
.takes_value(false)
.help("Do not run the unit tests"),
)
.arg(
Arg::with_name("package")
.long("package")
.takes_value(true)
.help("Generate package with the provided modules"),
)
.arg(
Arg::with_name("extra-files")
.short('f')
.long("extra-files")
.takes_value(true)
.help("Path to extra files to include in the generated bindings"),
)
.get_matches()
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
pub(crate) struct Args {
/// build the C bindings
#[arg(long = "c", default_value_t = false)]
pub(crate) build_c: bool,
/// build the .NET bindings
#[arg(long = "dotnet", default_value_t = false)]
pub(crate) build_dotnet: bool,
/// build the Java bindings
#[arg(long = "java", default_value_t = false)]
pub(crate) build_java: bool,
/// Target .NET framework, which indirectly determines the C# language version
#[arg(value_enum, short = 't', long = "target-dotnet-framework", default_value_t = TargetFramework::NetStandard2_0)]
pub(crate) target_framework: TargetFramework,
/// generate doxygen documentation
#[arg(long = "doxygen", default_value_t = false)]
pub(crate) generate_doxygen: bool,
/// do NOT run the unit tests
#[arg(long = "no-tests", default_value_t = false)]
pub(crate) no_tests: bool,
/// Generate package from the provided directory
#[arg(long = "package")]
pub(crate) package: Option<PathBuf>,
/// Path(s) to extra files to include in the generated bindings
#[arg(short = 'f', long = "extra-files")]
pub(crate) extra_files: Vec<PathBuf>,
}
Loading