diff --git a/very_good_flame_game/__brick__/{{project_name.snakeCase()}}/windows/runner/Runner.rc b/very_good_flame_game/__brick__/{{project_name.snakeCase()}}/windows/runner/Runner.rc index 79b7cc2..cd8d793 100644 --- a/very_good_flame_game/__brick__/{{project_name.snakeCase()}}/windows/runner/Runner.rc +++ b/very_good_flame_game/__brick__/{{project_name.snakeCase()}}/windows/runner/Runner.rc @@ -93,7 +93,7 @@ BEGIN VALUE "FileDescription", "{{project_name.snakeCase()}}" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "InternalName", "{{project_name.snakeCase()}}" "\0" - VALUE "LegalCopyright", "Copyright (C) 2022 {{windows_application_id}}. All rights reserved." "\0" + VALUE "LegalCopyright", "Copyright (C) {{current_year}} {{windows_application_id}}. All rights reserved." "\0" VALUE "OriginalFilename", "{{project_name.snakeCase()}}.exe" "\0" VALUE "ProductName", "{{project_name.titleCase()}}" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0" diff --git a/very_good_flame_game/hooks/pre_gen.dart b/very_good_flame_game/hooks/pre_gen.dart index 4e155ee..8d02d04 100644 --- a/very_good_flame_game/hooks/pre_gen.dart +++ b/very_good_flame_game/hooks/pre_gen.dart @@ -1,3 +1,4 @@ +import 'package:clock/clock.dart'; import 'package:mason/mason.dart'; import 'package:very_good_flame_game_hooks/very_good_core_hooks.dart'; @@ -42,5 +43,6 @@ void run(HookContext context) { 'ios_application_id': configuration.iOsApplicationId, 'macos_application_id': configuration.macOsApplicationId, 'windows_application_id': configuration.windowsApplicationId, + 'current_year': clock.now().year.toString(), }; } diff --git a/very_good_flame_game/hooks/pubspec.yaml b/very_good_flame_game/hooks/pubspec.yaml index c128468..494076d 100644 --- a/very_good_flame_game/hooks/pubspec.yaml +++ b/very_good_flame_game/hooks/pubspec.yaml @@ -4,6 +4,7 @@ environment: sdk: ^3.5.0 dependencies: + clock: ^1.1.1 equatable: ^2.0.5 mason: ^0.1.0-dev.52 very_good_core_hooks: diff --git a/very_good_flame_game/hooks/test/pre_gen_test.dart b/very_good_flame_game/hooks/test/pre_gen_test.dart index 80fc38c..67531de 100644 --- a/very_good_flame_game/hooks/test/pre_gen_test.dart +++ b/very_good_flame_game/hooks/test/pre_gen_test.dart @@ -1,3 +1,4 @@ +import 'package:clock/clock.dart'; import 'package:mason/mason.dart'; import 'package:mocktail/mocktail.dart'; import 'package:test/test.dart'; @@ -15,34 +16,37 @@ void main() { }); test('populates variables', () { - final vars = { - 'project_name': 'my_game', - 'org_name': 'com.example', - 'application_id': 'app.id', - 'description': 'A new Flame project.', - }; - when(() => context.vars).thenReturn(vars); - - pre_gen.run(context); - - final newVars = verify(() => context.vars = captureAny()).captured.last - as Map; - - expect( - newVars, - equals( - { - 'project_name': 'my_game', - 'org_name': 'com.example', - 'description': 'A new Flame project.', - 'android_namespace': 'app.id', - 'android_application_id': 'app.id', - 'ios_application_id': 'app.id', - 'macos_application_id': 'app.id', - 'windows_application_id': 'app.id', - }, - ), - ); + withClock(Clock.fixed(DateTime(2020)), () { + final vars = { + 'project_name': 'my_game', + 'org_name': 'com.example', + 'application_id': 'app.id', + 'description': 'A new Flame project.', + }; + when(() => context.vars).thenReturn(vars); + + pre_gen.run(context); + + final newVars = verify(() => context.vars = captureAny()).captured.last + as Map; + + expect( + newVars, + equals( + { + 'project_name': 'my_game', + 'org_name': 'com.example', + 'description': 'A new Flame project.', + 'android_namespace': 'app.id', + 'android_application_id': 'app.id', + 'ios_application_id': 'app.id', + 'macos_application_id': 'app.id', + 'windows_application_id': 'app.id', + 'current_year': '2020', + }, + ), + ); + }); }); }); }