aloisdeniel / flutter_sheet_localization

Generate Flutter localization from a simple online Google Sheets.
282 stars 81 forks source link

build_runner does not generate anything #66

Open illuminated opened 1 year ago

illuminated commented 1 year ago

Coming back to sheet_localization after several years and I'm struggling with the initial setup.

Running the build_runner reports a "severe" issue and nothing is generated:

→ flutter packages pub run build_runner build          
[INFO] Generating build script...
[INFO] Generating build script completed, took 375ms

[SEVERE] Nothing can be built, yet a build was requested.
[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 58ms

[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 471ms

[INFO] Running build...
[INFO] Running build completed, took 2ms

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 35ms

[INFO] Succeeded after 51ms with 0 outputs (0 actions)

The localization.dart is as in the ReadMe, placed in /lib folder:

import 'package:flutter/widgets.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_sheet_localization/flutter_sheet_localization.dart';

part 'localization.g.dart';

@SheetLocalization("redacted", "0", 2) // <- See 1. to get DOCID and SHEETID
// the `1` is the generated version. You must increment it each time you want to regenerate
// a new version of the labels.
class AppLocalizationsDelegate
    extends LocalizationsDelegate<AppLocalizationsData> {
  const AppLocalizationsDelegate();

  @override
  bool isSupported(Locale locale) => localizedLabels.containsKey(locale);

  @override
  Future<AppLocalizationsData> load(Locale locale) =>
      SynchronousFuture<AppLocalizationsData>(localizedLabels[locale]!);
  @override
  bool shouldReload(AppLocalizationsDelegate old) => false;
}

This happens on a MacOS.

Any help appreciated.

illuminated commented 1 year ago

My bad, haven't included the generator.... but it creates now a whole new problem:

→ flutter packages pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 444ms

[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[WARNING] Throwing away cached asset graph because the language version of some package(s) changed. This would most commonly happen when updating dependencies or changing your min sdk constraint.
[INFO] Cleaning up outputs from previous builds....
[INFO] Cleaning up outputs from previous builds. completed, took 3ms

[INFO] Generating build script...
[INFO] Generating build script completed, took 71ms

[WARNING] Invalidated precompiled build script due to missing asset graph.
[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 7.5s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 653ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] Generating SDK summary...
[SEVERE] flutter_sheet_localization_generator:flutter_sheet_localization on test/widget_test.dart:

Bad state: Unexpected diagnostics:
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:64 - Expected to find '('.
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:64 - Expected an identifier.
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:61 - Expected an identifier.
[SEVERE] flutter_sheet_localization_generator:flutter_sheet_localization on lib/main.dart:

Bad state: Unexpected diagnostics:
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:64 - Expected to find '('.
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:64 - Expected an identifier.
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:61 - Expected an identifier.
[SEVERE] flutter_sheet_localization_generator:flutter_sheet_localization on lib/localization.dart:

Bad state: Unexpected diagnostics:
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:64 - Expected to find '('.
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:64 - Expected an identifier.
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:61 - Expected an identifier.
[SEVERE] flutter_sheet_localization_generator:flutter_sheet_localization on lib/presentation/start.dart:

Bad state: Unexpected diagnostics:
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:64 - Expected to find '('.
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:64 - Expected an identifier.
/Users/milan/development/flutter/bin/cache/dart-sdk/lib/core/date_time.dart:919:61 - Expected an identifier.
[INFO] Running build completed, took 576ms

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 35ms

[SEVERE] Failed after 622ms
pub finished with exit code 1

My pubspec is the following (it's a new project):

environment:
  sdk: '>=2.19.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  flutter_sheet_localization: ^5.1.1
  cupertino_icons: ^1.0.5

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.1
  flutter_sheet_localization_generator: ^5.1.1
  build_runner: 2.2.0
zde-nekz commented 1 year ago

@illuminated I'm getting same error after flutter and dependencies updates

MostafaElswefy commented 1 year ago

Also I'm getting same error after flutter and dependencies updates Are there any package updates ?

bobatsar commented 1 year ago

As this package seems abandoned, see #61 for how to use a working fork.