Skip to content

Commit

Permalink
v2.4.4
Browse files Browse the repository at this point in the history
- 🐛 fix(builder):
  - Use raw strings on class names.
  - `ignore_for_file`: added `deprecated_member_use` and `deprecated_member_use_from_same_package`.

- Change package `pubspec` to `pubspec_parse`.

- pubspec_parse: ^1.3.0
  • Loading branch information
gmpassos committed Jul 27, 2024
1 parent 8ad3c13 commit 74f1918
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 14 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 2.4.4

- 🐛 fix(builder):
- Use raw strings on class names.
- `ignore_for_file`: added `deprecated_member_use` and `deprecated_member_use_from_same_package`.

- Change package `pubspec` to `pubspec_parse`.

- pubspec_parse: ^1.3.0

## 2.4.3

- `ClassReflection`: optimize `createInstanceWithConstructors`.
Expand Down
6 changes: 4 additions & 2 deletions example/reflection_factory_bridge_example.reflection.g.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// GENERATED CODE - DO NOT MODIFY BY HAND!
// BUILDER: reflection_factory/2.4.3
// BUILDER: reflection_factory/2.4.4
// BUILD COMMAND: dart run build_runner build
//

Expand All @@ -9,6 +9,8 @@
// ignore_for_file: no_leading_underscores_for_local_identifiers
// ignore_for_file: camel_case_types
// ignore_for_file: camel_case_extensions
// ignore_for_file: deprecated_member_use
// ignore_for_file: deprecated_member_use_from_same_package
// ignore_for_file: unnecessary_const
// ignore_for_file: unnecessary_cast
// ignore_for_file: unnecessary_type_check
Expand All @@ -20,7 +22,7 @@ typedef __TI<T> = TypeInfo<T>;
typedef __PR = ParameterReflection;

mixin __ReflectionMixin {
static final Version _version = Version.parse('2.4.3');
static final Version _version = Version.parse('2.4.4');

Version get reflectionFactoryVersion => _version;

Expand Down
6 changes: 4 additions & 2 deletions example/reflection_factory_example.reflection.g.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// GENERATED CODE - DO NOT MODIFY BY HAND!
// BUILDER: reflection_factory/2.4.3
// BUILDER: reflection_factory/2.4.4
// BUILD COMMAND: dart run build_runner build
//

Expand All @@ -9,6 +9,8 @@
// ignore_for_file: no_leading_underscores_for_local_identifiers
// ignore_for_file: camel_case_types
// ignore_for_file: camel_case_extensions
// ignore_for_file: deprecated_member_use
// ignore_for_file: deprecated_member_use_from_same_package
// ignore_for_file: unnecessary_const
// ignore_for_file: unnecessary_cast
// ignore_for_file: unnecessary_type_check
Expand All @@ -20,7 +22,7 @@ typedef __TI<T> = TypeInfo<T>;
typedef __PR = ParameterReflection;

mixin __ReflectionMixin {
static final Version _version = Version.parse('2.4.3');
static final Version _version = Version.parse('2.4.4');

Version get reflectionFactoryVersion => _version;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/reflection_factory_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import 'reflection_factory_utils.dart';
/// Class with all registered reflections ([ClassReflection]).
class ReflectionFactory {
// ignore: constant_identifier_names
static const String VERSION = '2.4.3';
static const String VERSION = '2.4.4';

static final ReflectionFactory _instance = ReflectionFactory._();

Expand Down
3 changes: 3 additions & 0 deletions lib/src/reflection_factory_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ class ReflectionBuilder implements Builder {
'// ignore_for_file: no_leading_underscores_for_local_identifiers\n');
fullCode.write('// ignore_for_file: camel_case_types\n');
fullCode.write('// ignore_for_file: camel_case_extensions\n');
fullCode.write('// ignore_for_file: deprecated_member_use\n');
fullCode
.write('// ignore_for_file: deprecated_member_use_from_same_package\n');
fullCode.write('// ignore_for_file: unnecessary_const\n');
fullCode.write('// ignore_for_file: unnecessary_cast\n');
fullCode.write('// ignore_for_file: unnecessary_type_check\n\n');
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: reflection_factory
description: Allows Dart reflection with an easy approach, even for third-party classes, using code generation portable for all Dart platforms.
version: 2.4.3
version: 2.4.4
homepage: https://github.com/gmpassos/reflection_factory

environment:
Expand All @@ -23,7 +23,7 @@ dev_dependencies:
build_runner: ^2.4.11
build_test: ^2.2.2
lints: ^4.0.0
pubspec: ^2.3.0
pubspec_parse: ^1.3.0
data_serializer: ^1.1.0
dependency_validator: ^3.2.3
test: ^1.25.8
Expand Down
43 changes: 43 additions & 0 deletions test/reflection_factory_build_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,49 @@ void main() {
);
});

test('EnableReflection: TestEmpty', () async {
var builder = ReflectionBuilder(verbose: true);

var sourceAssets = {
'$_pkgName|lib/foo.dart': '''
import 'package:reflection_factory/reflection_factory.dart';
part 'foo.reflection.g.dart';
@EnableReflection()
class \$TestSpecial {}
'''
};

await testBuilder(
builder,
sourceAssets,
reader: await PackageAssetReader.currentIsolate(),
generateFor: {'$_pkgName|lib/foo.dart'},
outputs: {
'$_pkgName|lib/foo.reflection.g.dart': decodedMatches(allOf(
allOf(
contains('GENERATED CODE - DO NOT MODIFY BY HAND'),
contains(
'BUILDER: reflection_factory/${ReflectionFactory.VERSION}'),
contains("part of 'foo.dart'"),
contains(
"Version _version = Version.parse('${ReflectionFactory.VERSION}')"),
),
allOf(
contains('\$TestSpecial\$reflection'),
contains('\$TestSpecial\$reflectionExtension'),
),
)),
},
onLog: (msg) {
print(msg);
},
);
});

test('EnableReflection: User', () async {
var builder = ReflectionBuilder(verbose: true);

Expand Down
9 changes: 6 additions & 3 deletions test/reflection_factory_version_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
@Tags(['version'])
library;

import 'package:pubspec/pubspec.dart';
import 'package:test/test.dart';
import 'dart:io';

import 'package:path/path.dart' as path;
import 'package:pubspec_parse/pubspec_parse.dart';
import 'package:test/test.dart';

void main() {
group('ReflectionFactory.VERSION', () {
Expand All @@ -21,7 +21,10 @@ void main() {

print('pubspecFile: $pubspecFile');

var pubSpec = await PubSpec.loadFile(pubspecFile.path);
var pubSpec = Pubspec.parse(
pubspecFile.readAsStringSync(),
sourceUrl: pubspecFile.uri,
);

print('PubSpec.name: ${pubSpec.name}');
print('PubSpec.version: ${pubSpec.version}');
Expand Down
6 changes: 4 additions & 2 deletions test/src/reflection/user_with_reflection.g.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// GENERATED CODE - DO NOT MODIFY BY HAND!
// BUILDER: reflection_factory/2.4.3
// BUILDER: reflection_factory/2.4.4
// BUILD COMMAND: dart run build_runner build
//

Expand All @@ -9,6 +9,8 @@
// ignore_for_file: no_leading_underscores_for_local_identifiers
// ignore_for_file: camel_case_types
// ignore_for_file: camel_case_extensions
// ignore_for_file: deprecated_member_use
// ignore_for_file: deprecated_member_use_from_same_package
// ignore_for_file: unnecessary_const
// ignore_for_file: unnecessary_cast
// ignore_for_file: unnecessary_type_check
Expand All @@ -20,7 +22,7 @@ typedef __TI<T> = TypeInfo<T>;
typedef __PR = ParameterReflection;

mixin __ReflectionMixin {
static final Version _version = Version.parse('2.4.3');
static final Version _version = Version.parse('2.4.4');

Version get reflectionFactoryVersion => _version;

Expand Down
6 changes: 4 additions & 2 deletions test/src/user_reflection_bridge.reflection.g.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// GENERATED CODE - DO NOT MODIFY BY HAND!
// BUILDER: reflection_factory/2.4.3
// BUILDER: reflection_factory/2.4.4
// BUILD COMMAND: dart run build_runner build
//

Expand All @@ -9,6 +9,8 @@
// ignore_for_file: no_leading_underscores_for_local_identifiers
// ignore_for_file: camel_case_types
// ignore_for_file: camel_case_extensions
// ignore_for_file: deprecated_member_use
// ignore_for_file: deprecated_member_use_from_same_package
// ignore_for_file: unnecessary_const
// ignore_for_file: unnecessary_cast
// ignore_for_file: unnecessary_type_check
Expand All @@ -20,7 +22,7 @@ typedef __TI<T> = TypeInfo<T>;
typedef __PR = ParameterReflection;

mixin __ReflectionMixin {
static final Version _version = Version.parse('2.4.3');
static final Version _version = Version.parse('2.4.4');

Version get reflectionFactoryVersion => _version;

Expand Down

0 comments on commit 74f1918

Please sign in to comment.