From ff979d371a71cb31c361bb5448028b5d256363f6 Mon Sep 17 00:00:00 2001 From: Hossein Yousefi Date: Wed, 25 Jan 2023 15:12:13 +0100 Subject: [PATCH] [jnigen] 0.2.0 (#174) * 0.2.0 version on pub --- pkgs/jni/CHANGELOG.md | 10 ++++-- pkgs/jni/pubspec.yaml | 2 +- .../sub_parsers/compounddecl_parser.dart | 2 -- .../sub_parsers/enumdecl_parser.dart | 1 - .../sub_parsers/objcinterfacedecl_parser.dart | 1 - .../type_extractor/extractor.dart | 1 - pkgs/jnigen/CHANGELOG.md | 6 ++-- pkgs/jnigen/lib/src/elements/elements.dart | 34 +++++++++---------- pkgs/jnigen/pubspec.yaml | 2 +- 9 files changed, 31 insertions(+), 28 deletions(-) diff --git a/pkgs/jni/CHANGELOG.md b/pkgs/jni/CHANGELOG.md index be4847a86..8b4b98e71 100644 --- a/pkgs/jni/CHANGELOG.md +++ b/pkgs/jni/CHANGELOG.md @@ -1,5 +1,11 @@ -## 0.1.0 -* Initial version: Android and Linux support, JObject API +## 0.2.0 +* Added array support +* Added generic support +* `JniX` turned into `JX` for a more terse code. ## 0.1.1 * Windows support for running tests and examples on development machines. + +## 0.1.0 +* Initial version: Android and Linux support, JObject API + diff --git a/pkgs/jni/pubspec.yaml b/pkgs/jni/pubspec.yaml index dd4eda35a..9a08b37ba 100644 --- a/pkgs/jni/pubspec.yaml +++ b/pkgs/jni/pubspec.yaml @@ -1,6 +1,6 @@ name: jni description: Library to access JNI from dart and flutter -version: 0.1.1 +version: 0.2.0 repository: https://github.com/dart-lang/jnigen/tree/main/jni environment: diff --git a/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/compounddecl_parser.dart b/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/compounddecl_parser.dart index 6c7916f9f..a21d6e2a4 100644 --- a/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/compounddecl_parser.dart +++ b/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/compounddecl_parser.dart @@ -74,7 +74,6 @@ final _stack = Stack<_ParsedCompound>(); Compound? parseCompoundDeclaration( clang_types.CXCursor cursor, CompoundType compoundType, { - /// Option to ignore declaration filter (Useful in case of extracting /// declarations when they are passed/returned by an included function.) bool ignoreFilter = false, @@ -147,7 +146,6 @@ Compound? parseCompoundDeclaration( void fillCompoundMembersIfNeeded( Compound compound, clang_types.CXCursor cursor, { - /// Option to ignore declaration filter (Useful in case of extracting /// declarations when they are passed/returned by an included function.) bool ignoreFilter = false, diff --git a/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/enumdecl_parser.dart b/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/enumdecl_parser.dart index 4e5e1506c..68012ed29 100644 --- a/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/enumdecl_parser.dart +++ b/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/enumdecl_parser.dart @@ -27,7 +27,6 @@ final _stack = Stack<_ParsedEnum>(); /// Parses an enum declaration. EnumClass? parseEnumDeclaration( clang_types.CXCursor cursor, { - /// Option to ignore declaration filter (Useful in case of extracting /// declarations when they are passed/returned by an included function.) bool ignoreFilter = false, diff --git a/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart b/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart index bf9d03872..94fff9255 100644 --- a/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart +++ b/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart @@ -30,7 +30,6 @@ final _methodStack = Stack<_ParsedObjCMethod>(); Type? parseObjCInterfaceDeclaration( clang_types.CXCursor cursor, { - /// Option to ignore declaration filter (Useful in case of extracting /// declarations when they are passed/returned by an included function.) bool ignoreFilter = false, diff --git a/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/type_extractor/extractor.dart b/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/type_extractor/extractor.dart index 1a69715c4..7a497a3cc 100644 --- a/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/type_extractor/extractor.dart +++ b/pkgs/jni/third_party/ffigen_patch_jni/lib/src/header_parser/type_extractor/extractor.dart @@ -24,7 +24,6 @@ const _padding = ' '; /// Converts cxtype to a typestring code_generator can accept. Type getCodeGenType( clang_types.CXType cxtype, { - /// Option to ignore declaration filter (Useful in case of extracting /// declarations when they are passed/returned by an included function.) bool ignoreFilter = true, diff --git a/pkgs/jnigen/CHANGELOG.md b/pkgs/jnigen/CHANGELOG.md index f70e58819..107c11af0 100644 --- a/pkgs/jnigen/CHANGELOG.md +++ b/pkgs/jnigen/CHANGELOG.md @@ -1,6 +1,8 @@ -## 0.1.0 -* Initial version: Basic bindings generation, maven and android utilities +## 0.2.0 +* Support generating bindings for generics. ## 0.1.1 * Windows support for running tests and examples on development machines. +## 0.1.0 +* Initial version: Basic bindings generation, maven and android utilities diff --git a/pkgs/jnigen/lib/src/elements/elements.dart b/pkgs/jnigen/lib/src/elements/elements.dart index 80bdbb901..85269c2b4 100644 --- a/pkgs/jnigen/lib/src/elements/elements.dart +++ b/pkgs/jnigen/lib/src/elements/elements.dart @@ -96,36 +96,36 @@ class ClassDecl { // synthesized attributes /// Final name of this class - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) late String finalName; /// Parent's [ClassDecl] obtained from [parentName] - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) ClassDecl? parent; /// Type parameters including the ones from its ancestors - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) List allTypeParams = const []; /// Unique name obtained by renaming conflicting names with a number. /// /// This is used by C bindings instead of fully qualified name to reduce /// the verbosity of generated bindings - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) late String uniqueName; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) bool isPreprocessed = false; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) bool isIncluded = true; /// Contains number with which certain overload of a method is renamed to, /// so the overriding method in subclass can be renamed to same final name. - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) Map methodNumsAfterRenaming = {}; /// Name counts map, it's a field so that it can be later used by subclasses. - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) Map nameCounts = {..._definedSyms}; @override @@ -158,7 +158,7 @@ class TypeUsage { String shorthand; Kind kind; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) late ReferredType type; @JsonKey(name: "type") Map typeJson; @@ -282,14 +282,14 @@ class Method implements ClassMember { List params; TypeUsage returnType; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) late String finalName; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) late bool isOverridden; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) bool isIncluded = true; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) late String javaSig = _javaSig(); String _javaSig() { @@ -337,9 +337,9 @@ class Field implements ClassMember { TypeUsage type; Object? defaultValue; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) late String finalName; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) bool isIncluded = true; factory Field.fromJson(Map json) => _$FieldFromJson(json); @@ -351,7 +351,7 @@ class TypeParam { String name; List bounds; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) late String erasure; factory TypeParam.fromJson(Map json) => @@ -363,7 +363,7 @@ class JavaDocComment { JavaDocComment({String? comment}) : comment = comment ?? ''; String comment; - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false) late String dartDoc; factory JavaDocComment.fromJson(Map json) => diff --git a/pkgs/jnigen/pubspec.yaml b/pkgs/jnigen/pubspec.yaml index 54e2b36f6..0ac0eb516 100644 --- a/pkgs/jnigen/pubspec.yaml +++ b/pkgs/jnigen/pubspec.yaml @@ -3,7 +3,7 @@ # BSD-style license that can be found in the LICENSE file. name: jnigen -version: 0.1.1 +version: 0.2.0 description: Experimental generator for FFI+JNI bindings. repository: https://github.com/dart-lang/jnigen/tree/main/jnigen