Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for unsupported platforms instead of sending an error early on. #83

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

emgre
Copy link
Contributor

@emgre emgre commented Jan 27, 2022

Fix #82

  • Allow building and generating bindings even on unsupported platforms.
  • Add MacOS builds in the CI, without official support.
    • This will need basic validation from someone with a MacOS device.

@emgre emgre force-pushed the feature/allow-unknown-platforms branch 5 times, most recently from b45730a to fb34bfb Compare January 27, 2022 18:46
@emgre emgre force-pushed the feature/allow-unknown-platforms branch from fb34bfb to 3d37f55 Compare January 27, 2022 19:46
@emgre emgre marked this pull request as ready for review January 27, 2022 20:10
@emgre emgre merged commit f98a09b into feature/c++ Jan 27, 2022
@emgre emgre deleted the feature/allow-unknown-platforms branch January 27, 2022 20:13
emgre added a commit that referenced this pull request Feb 3, 2022
emgre added a commit that referenced this pull request Feb 3, 2022
emgre added a commit that referenced this pull request Feb 3, 2022
jadamcrain added a commit that referenced this pull request Apr 26, 2022
* Add the RStruct type

* constrain return types

* template ReturnType

* return values from functions are named FReturnType which is an alias to a templated type

* define a universal type and limit callback return values to use that type

* c callback test with iterator

* restore iterator tests in C# and Java

* incremental progress

* add the concept of constructors to the struct building process

* remove default values from the model entirely

* remove default values and constructors entirely, simplify structure types dramatically

* rename structures

* working compliation just lots of todo!()'s to fill in

* remove some code duplication

* Rust generator is compiling again

* get the c header generator working again

* restore the .NET generator

* consolidate some of the formatting stuff

* continue duplicate formatting routines purge

* restore the Java generator

* fix small typo in JNI conversions

* generate java sources again

* abandon abbreviations in favor of more explicit names

* partial progress

* partial C constructor generation

* working C constructors and tests

* partial progress on addressing universal structs

* restore the lifetime stuff in foo

* C test for embedded iterators with lifetimes similar to DNP3 use case with octet strings

* rename MaybeUniversal to UniversalOr

* remove unnecessary type definitions

* normalize names and fix clippy warnings

* flatten struct module hierarchy

* optimize imports

* factor universal struct schema so that it can be expaned to test interfaces

* change universal struct test case to include all 4 schema positions

* working C# constructors

* tweak C# constructor docs and start java constructor docs

* Java constructors, just need to figure out what to do for the OpaqueStruct

* Java constructor generation

* validate that constructor arguments can't be the same

* partial progress writing static method constructors in C#

* consolidate functionality

* compiling C# static constructors

* static constructors generation now working in C# and Java

* Add chunk iterator tests to C#

* double iterator test for Java

* remove dead file

* docuement static constructor return values

* remove unncessary STRING_TYPE constant

* add missing From impl

* Add missing From impl

* missing From impls

* missing From impl

* missing From impl

* missing From impl

* missing From impl

* allow classes as callback arguments

* add missing From impl

* rename Callback struct type

* missing impl

* allow universal structs to be used in iterators

* Static constructs can now share the same argument list

* add convienence From impl

* add convienence method for defining full constructors and rename new_constructor -> begin_constructor

* full constructor helper now creates DocString internally

* add some from impls and Number type that make defining constructors easier

* rename basic types and remove unused type parameter

* remove dead code

* add some helper traits for &str for constructing enum defaults in models

* make traits public

* add convience method for default struct constructor values

* add 2 more convienence methods

* fix C backend to generate class pointer in callback functions

* get_default_constructor should only find constructors of normal type

* Java static constructor names should have mixed casing

* start working on cpp again

* generate C++ interfaces again

* generate constructor definitions

* single function argument type

* separate C++ header and implementation generation

* more progress with the C++ class declarations

* explicitly say that it's mutable ref

* Add interface types

* conversions to native for function argument structs can either be const ref or mut ref depending on if any of the fields in the C++ type require a move operation

* compiling struct conversions

* Make the collection test class a static class

* Class declaration statements now include a type so that different backends can handle them differently, e.g. C++ ignores collection declarations

* make the structure test more interesting by factoring all the numbers separately and moving the interface to an inner struct

* progress on implementing interface conversions

* progress but having to write undesirable struct conversions b/c of taking StructRef as frunction argument

* use typed struct delarations to limit the types of StructRef's

* make opaque struct definitions explicit and limit them to universal types

* separate enum conversions

* Collections must be defined on unique class handles

* all C++ wrapper functions are now compiling

* remove unused snippet

* enable the other collection type. it was a bug in g++ 10.2!

* generate collection class implementations

* generate class destructors

* class constructors

* implement class methods and static methods

* make foo::CallbackInterface asynchronous

* generating async methods

* fix static constructor casing

* generate helpers for interfaces used in async methods

* progress on struct constructors

* working struct constructors

* generate full constructor implementations

* move c tests to sub dir so we can separate the from the cpp tests

* don't use designated initiailizers since msvc is stuck in the C++ stone age

* some working C++ tests!

* fix out parameters

* fix universal test changing the duration type from seconds to milliseconds

* export a cache varaible for the CPP file

* no need to print the variable

* test class exceptions and move operation guards

* duration tests

* iterator tests that doesn't link due to missing codegen

* iterator tests

* constant cpp tests

* add missing header for gcc

* add missing header for gcc

* cpp callback tests

* generate the cpp file in the 'src' directory

* add enum tests

* cpp string tests

* C++ stucture tests!

* allow universal struct refs as function return values

* return specialized class handles for collections and iterators

* use a specialized variable name that can't conflict

* try to fix class conversion in callbacks

* don't write a destructor implementation if there isn't a destructor

* make sure move types are moved in functions

* CType trait no longer requires the prefix argument

* don't support collections in structs

* enforce a normal naming format and reserved language keywords

* all backends working again

* simplify iterator declaration and validation

* simplify collection definitions and remove complicated internal validation

* add collection tests which revealed why it's best to transform returned types in the C++ wrapper functions, with the exception of classes and iterators

* future proof the iterator definition by defining an IteratorItemType enum and From impls

* add the ability to get backtraced errors in schema definitions

* progress

* all backends compiling

* rust gen and tests working

* validation functions now return Handles

* fix typo in JNI backend

* validate argument references in functions and callback functions

* validate argument references

* fix the .NET docs

* fix the collection and iterator conversions

* categorize functions during the definition process so that they can be easily filtered on in the Java backend

* move some things from library to struct module

* docs

* don't call the transform on the return value if we're not supposed to do it in the wrapper

* class methods now have their own specialized type which removes internal validation and promotes regular naming patterns

* add a ClassDestructor type that moves schema errors from runtime to compile time

* add specialized types for constructors

* use the type system to restrict how asynchronous methods are defined

* exhaustively match on the interface type when generating sync/send

* rename struct Constructor to Initializer to cleaning separate struct/class terminology

* remove duplicate doc logic in builders

* constrain how static methods are defined and added to classes

* overhaul how library ownership checks are performed

* generate templated lambda helpers for C++ future methods

* C/C++ generator now decoupled from heck

* ability to define constant Name(s) within the library itself

* liberate the java bindgen from heck

* use C89 style struct initialization b/c this doesn't produce lints on msvc

* add a ThreadClass to the schema that spins up a Rust thread so we can test native -> binding stuff properly

* Add thread tests for C#

* add java thread tests

* make the interface ctx/on_destroy constants configurable library settings

* generate functional helpers for all functional interfaces

* modify test to use the synchronous functional helper

* use functional adapter

* use functional interface in Java test

* test functional interfaces that return a value

* extend C# example

* extend java test

* the great error purge

* use functional helpers for the double iterator tests

* just use the functional helpers for all single callback interfaces

* Transform C# functional interfaces into functors in the public API

* Match all functor types

* change the way functional interface helpers are generated in C#

* define if functional transform are enabled in the schema

* Make interfaces internal if they have a functional optimization in C#

* library reference no longer required for C docstring printing

* eliminate unnecessary module

* separate the header stuff from the package stuff

* partial progress on c++ docs

* simplify return type handling

* more doc progress

* reduce c++ doc code duplication

* add struct default value docs

* doc tweaks

* change how sync/async interfaces are defined

* restrict function argument structs to only having *async* interfaces

* only write 1 type of interface conversion per interface instance

* use an object library instead of exporting the path to the cpp file

* use a common OptionalErrorType that will be re-used in the FutureInterface

* schema scaffolding for failable futures

* Rust and C/C++ failable futures

* preserve the full interface information for backends

* dotnet compiling

* failable future methods working in C++/C#

* Java compiling!

* Java now working

* remove remaining todo comments

* remove some unimplemented blocks

* public api

* separate Primitive from BasicType

* resolve C++ doxugen constructor links and a number of new clippy lints

* resolve issue with c++ doxygen destructor links

* don't explicitly link to enums and variants, they don't always work

* relax more broken doxygen explicit links

* don't explicitly link to interface methods

* use same license writing in C/C++. Add @file tag to C++

* fix incomplete documentation for class move constructors

* update dependencies

* simplifiy allowed licenses based on new SPDX OR expression parsing in complicense

* Move null checks from JNI to Java (#70)

* Few minor fixes after rodbus upgrade. **Breaking changes**

- Add missing type definitions for `Foo<Unvalidated>` sutff
- Renamed `declare_function_arg_struct` to `declare_function_argument_struct`
- Renamed `declare_callback_arg_struct` to `declare_callback_argument_struct`
- Add missing check for struct fields with same name as an initializer
- Add missing `From<EnumHandle> for BasicType` impl
- Exclude C++ CMake target if CXX language is not defined

* refactor JNI (#74)

* generate wrapper functions around Java native functions that perform the null checks

* recursive null checks on structure fields

* update test cases

* remove null checks from JNI

* comment for the wrapper class

* start by simplifying the function generation as this is where all the magic happens

* simplify JNI function signature generation

* separate function signature generation

* simplify string conversion

* some partial progress migrating to new traits

* make the invocaton a one liner

* remove unncessary newline

* put the signature generation stuff in its own trait

* remove now-redundant signature stuff from JniType

* start organizing the various conversion traits into their own child module

* move the JNI type id stuff to its own trait

* make JNI type id's lazier so that you don't have to tunnel the library path down everywhere its used

* remove unused method from JniType

* introduce separate trait for getting the Rust type during interface cache generation

* remove the as_rust_type method from JniType since that functionality has been moved to dedicated trait

* add a dedicated trait from unwrapped JValue's

* remove functionality moved to dedicated trait

* add a dedicated DefaultValue trait

* remove functionality moved to dedicated trait

* use the new to_rust conversions in favor of the old for callback return values

* implement the to_rust_from_object routine in the specialized trait

* use the specialized conversion when transforming Java list to Rust collection

* remove unused method from jni_type

* remove unused variables

* need to fix bools

* remove unused stuff

* use new callsite transform

* more dead code

* renaming for consistency

* collections and function arguments don't need conversion to jni

* delete unused conversions rust->java for interfaces

* dedicated conversion functions for iterators to Java list

* use new iterator conversion in callback conversion routines

* reduce string conversion to a one liner

* reduce structref -> jni conversion to one liner

* rework how rust -> jni transforms are applied

* get the env durign the thread attach

* change trait names

* simplify duration cache functions

* remove unused fractional second code

* go back to raw local references since we're going to use with_local_frame instead

* local frame with 0 works on Windows, but needs more testing

* generate wrapper functions around Java native functions that perform the null checks

* recursive null checks on structure fields

* start by simplifying the function generation as this is where all the magic happens

* simplify JNI function signature generation

* separate function signature generation

* simplify string conversion

* some partial progress migrating to new traits

* make the invocaton a one liner

* remove unncessary newline

* put the signature generation stuff in its own trait

* remove now-redundant signature stuff from JniType

* start organizing the various conversion traits into their own child module

* move the JNI type id stuff to its own trait

* make JNI type id's lazier so that you don't have to tunnel the library path down everywhere its used

* remove unused method from JniType

* introduce separate trait for getting the Rust type during interface cache generation

* remove the as_rust_type method from JniType since that functionality has been moved to dedicated trait

* add a dedicated trait from unwrapped JValue's

* remove functionality moved to dedicated trait

* add a dedicated DefaultValue trait

* remove functionality moved to dedicated trait

* use the new to_rust conversions in favor of the old for callback return values

* implement the to_rust_from_object routine in the specialized trait

* use the specialized conversion when transforming Java list to Rust collection

* remove unused method from jni_type

* remove unused variables

* need to fix bools

* remove unused stuff

* use new callsite transform

* more dead code

* renaming for consistency

* collections and function arguments don't need conversion to jni

* delete unused conversions rust->java for interfaces

* dedicated conversion functions for iterators to Java list

* use new iterator conversion in callback conversion routines

* reduce string conversion to a one liner

* reduce structref -> jni conversion to one liner

* rework how rust -> jni transforms are applied

* get the env durign the thread attach

* change trait names

* simplify duration cache functions

* remove unused fractional second code

* go back to raw local references since we're going to use with_local_frame instead

* local frame with 0 works on Windows, but needs more testing

* use auto_local when processing iterators to clean up as you good

* simplify enum conversions

* simplify the exception cache

* change visibility of class methods

* initial refactoring of class cache

* refactor the class cache

* cleanup the class cache

* simplify names in enum cache to guarantee no collisions with the _value_field

* refactor the primtive cache

* simplify existing struct generation

* correct visibility

* clean up the unsigned cache

* use JNIEnv::with_local_frame when converting native structs to JNI

* eliminate the FromStr usage for JavaType and add a trait that directly generate this enum. The object strings aren't even used in the implementation so there's no need to generate this extra heap alloc

* introduce struct guards

* use JniJavaType instead of parsing strings when invoking interface methods

* set upper bounds when using local frames in case this enables an optimization

* check list members for null in the Java native function wrappers

* small tweaks from joint review

* Feature/refactor dotnet (#77)

* move conversion stuff to submodule

* generate only the required struct conversions

* missing new line

* move the StructType logic to the struct module

* fix lots of repetitive lints

* inline out parameter declarations

* fix more lints

* call capital Version()

* make exception files CamelCase

* Better doxygen generation
- Add C# doxygen generation in ci-script
- Fix few issues in C, C++ and C# generated doxygen comments.
- Add doxygen-awesome theme.
- Add main page
- Add logo

* Move to Rust 2021 Edition.

* Automate documentation generation

* [java] Fix issue in boolean conversion.

* Add iterators over primitives (#78)

* stub in the IteratorItemType::PrimitiveRef.. lots of todos! and testing to do

* c/c++ compiling

* simplify IteratorItemType

* c tests

* c++ tests

* test in C#

* working C# primitive iterators

* working tests for Java

* pointer conversion trait

* Feature/refactor dotnet (#77)

* move conversion stuff to submodule

* generate only the required struct conversions

* missing new line

* move the StructType logic to the struct module

* fix lots of repetitive lints

* inline out parameter declarations

* fix more lints

* call capital Version()

* make exception files CamelCase

* stub in the IteratorItemType::PrimitiveRef.. lots of todos! and testing to do

* c/c++ compiling

* simplify IteratorItemType

* c tests

* c++ tests

* test in C#

* working C# primitive iterators

* working tests for Java

* pointer conversion trait

* small tweak to merge w/ doc update branch

* working Java tests for functions returning primitive pointers

* formatting

* Fix issue with Java collection conversions.

* reference trait method explicitly to avoid unused use statements in libraries that don't have these types of functions

* Add support for unknown platforms instead of sending an error early on.

* Add Apple M1 support in .NET and Java.

See #83.

* Add Cargo.lock file to the repository

* Add builder methods in C# and Java. (#84)

* Disable auto-linking in C and .NET.

* Add default values of struct initializers in the docs of all languages.

* Add Windows x86 bindings.

* Fix issue when there's a callback in an async method.

* C++ strings in callbacks are now passed by const char*.

* [dotnet] Fix issue in 32-bit callbacks.

The delegate of callbacks didn't have the proper calling convention.
It worked on x64, but not on x86 where it would play with memory
that it shouldn't. Now, all delegates explicitly set their calling
convention to `CallingConvention.Cdecl`

Co-authored-by: jadamcrain <jadamcrain@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant