From fcbef06b7c6a73fb2d76e1c70ea702c2b0525aa0 Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Fri, 8 Oct 2021 18:10:48 +0200 Subject: [PATCH] Move generator to drift_dev --- drift/analysis_options.yaml | 15 ++ drift/pubspec.yaml | 6 +- drift_dev/LICENSE | 21 +++ drift_dev/analysis_options.yaml | 1 + drift_dev/bin/drift.dart | 6 + drift_dev/build.yaml | 42 +++++ drift_dev/dart_test.yaml | 4 + .../drift_dev.yaml | 2 +- drift_dev/lib/api/migrations.dart | 167 +++++++++++++++++ drift_dev/lib/integrations/build.dart | 14 ++ drift_dev/lib/integrations/plugin.dart | 9 + drift_dev/lib/moor_generator.dart | 1 + .../lib/src/analyzer/custom_row_class.dart | 4 +- .../lib/src/analyzer/dart/column_parser.dart | 0 .../lib/src/analyzer/dart/parser.dart | 14 +- .../lib/src/analyzer/dart/table_parser.dart | 0 .../lib/src/analyzer/dart/use_dao_parser.dart | 0 .../src/analyzer/dart/use_moor_parser.dart | 0 .../lib/src/analyzer/errors.dart | 0 .../analyzer/moor/create_table_reader.dart | 22 +-- .../lib/src/analyzer/moor/entity_handler.dart | 10 +- .../src/analyzer/moor/find_dart_class.dart | 4 +- .../src/analyzer/moor/moor_ffi_extension.dart | 0 .../lib/src/analyzer/moor/parser.dart | 12 +- .../lib/src/analyzer/options.dart | 0 .../lib/src/analyzer/options.g.dart | 0 .../lib/src/analyzer/runner/file_graph.dart | 2 +- .../lib/src/analyzer/runner/inputs.dart | 0 .../lib/src/analyzer/runner/results.dart | 8 +- .../lib/src/analyzer/runner/steps.dart | 30 ++-- .../analyzer/runner/steps/analyze_dart.dart | 0 .../analyzer/runner/steps/analyze_moor.dart | 0 .../src/analyzer/runner/steps/parse_dart.dart | 0 .../src/analyzer/runner/steps/parse_moor.dart | 0 .../lib/src/analyzer/runner/task.dart | 14 +- .../lib/src/analyzer/session.dart | 10 +- .../sql_queries/custom_result_class.dart | 4 +- .../explicit_alias_transformer.dart | 0 .../analyzer/sql_queries/lints/linter.dart | 2 +- .../analyzer/sql_queries/query_analyzer.dart | 18 +- .../analyzer/sql_queries/query_handler.dart | 10 +- .../sql_queries/required_variables.dart | 0 .../analyzer/sql_queries/type_mapping.dart | 8 +- .../lib/src/analyzer/view/view_analyzer.dart | 16 +- .../lib/src/backends/backend.dart | 0 .../lib/src/backends/build/build_backend.dart | 4 +- .../build/generators/dao_generator.dart | 8 +- .../build/generators/moor_generator.dart | 4 +- .../lib/src/backends/build/moor_builder.dart | 18 +- .../backends/build/preprocess_builder.dart | 2 +- .../lib/src/backends/common/driver.dart | 8 +- .../lib/src/backends/plugin/logger.dart | 2 +- .../lib/src/backends/plugin/plugin.dart | 18 +- .../plugin/services/autocomplete.dart | 2 +- .../src/backends/plugin/services/errors.dart | 6 +- .../src/backends/plugin/services/folding.dart | 2 +- .../backends/plugin/services/navigation.dart | 8 +- .../src/backends/plugin/services/outline.dart | 4 +- .../backends/plugin/services/requests.dart | 4 +- .../plugin/utils/ast_to_location.dart | 4 +- .../src/backends/plugin/utils/span_utils.dart | 0 .../lib/src/backends/standalone.dart | 0 .../lib/src/cli/cli.dart | 4 +- .../lib/src/cli/commands/analyze.dart | 0 .../src/cli/commands/identify_databases.dart | 2 +- .../lib/src/cli/commands/migrate.dart | 2 +- .../lib/src/cli/commands/schema.dart | 4 +- .../lib/src/cli/commands/schema/dump.dart | 4 +- .../cli/commands/schema/generate_utils.dart | 10 +- .../lib/src/cli/logging.dart | 0 .../lib/src/cli/project.dart | 4 +- .../lib/src/model/base_entity.dart | 4 +- .../lib/src/model/column.dart | 4 +- .../lib/src/model/database.dart | 6 +- .../lib/src/model/declarations/columns.dart | 0 .../lib/src/model/declarations/database.dart | 0 .../src/model/declarations/declaration.dart | 6 +- .../lib/src/model/declarations/index.dart | 0 .../model/declarations/special_queries.dart | 0 .../lib/src/model/declarations/tables.dart | 0 .../lib/src/model/declarations/trigger.dart | 0 .../lib/src/model/declarations/views.dart | 0 .../lib/src/model/index.dart | 4 +- .../lib/src/model/model.dart | 0 .../lib/src/model/sources.dart | 2 +- .../lib/src/model/special_queries.dart | 4 +- .../lib/src/model/sql_query.dart | 10 +- .../lib/src/model/table.dart | 6 +- .../lib/src/model/trigger.dart | 4 +- .../lib/src/model/types.dart | 6 +- .../lib/src/model/used_type_converter.dart | 6 +- .../lib/src/model/view.dart | 8 +- .../services/find_stream_update_rules.dart | 2 +- .../services/ide/assists/assist_service.dart | 2 +- .../ide/assists/column_nullability.dart | 0 .../lib/src/services/ide/highlights.dart | 2 +- .../lib/src/services/ide/moor_ide.dart | 4 +- .../lib/src/services/ide/utils.dart | 4 +- .../src/services/schema/find_differences.dart | 2 +- .../lib/src/services/schema/schema_files.dart | 4 +- .../src/services/schema/verifier_impl.dart | 2 +- .../src/utils/entity_reference_sorter.dart | 2 +- .../lib/src/utils/hash.dart | 0 .../lib/src/utils/names.dart | 0 .../lib/src/utils/options_reader.dart | 2 +- .../lib/src/utils/string_escaper.dart | 0 .../lib/src/utils/type_converter_hint.dart | 2 +- .../lib/src/utils/type_utils.dart | 9 +- .../lib/src/writer/database_writer.dart | 10 +- .../lib/src/writer/queries/query_writer.dart | 12 +- .../src/writer/queries/result_set_writer.dart | 8 +- .../lib/src/writer/queries/sql_writer.dart | 4 +- .../src/writer/tables/data_class_writer.dart | 8 +- .../lib/src/writer/tables/table_writer.dart | 10 +- .../tables/update_companion_writer.dart | 8 +- .../lib/src/writer/tables/view_writer.dart | 4 +- .../lib/src/writer/utils/hash_code.dart | 0 .../lib/src/writer/utils/memoized_getter.dart | 2 +- .../lib/src/writer/utils/override_equals.dart | 0 .../src/writer/utils/override_toString.dart | 0 .../lib/src/writer/writer.dart | 4 +- drift_dev/lib/writer.dart | 16 ++ drift_dev/pubspec.yaml | 64 +++++++ .../cyclic_moor_dart_dependency_test.dart | 6 +- .../dart/custom_row_classes_test.dart | 6 +- .../test/analyzer/dart/dart_test.dart | 6 +- .../test/analyzer/dart/enum_columns_test.dart | 6 +- .../analyzer/dart/regression_1172_test.dart | 0 .../test/analyzer/dart/table_parser_test.dart | 10 +- .../integration/dao_inheritance_test.dart | 2 +- .../integration/duplicate_tables_test.dart | 2 +- .../integration/integration_test.dart | 8 +- .../test/analyzer/moor/cfe_test.dart | 12 +- .../moor/create_table_reader_test.dart | 4 +- .../test/analyzer/moor/create_view_test.dart | 4 +- .../moor/custom_row_classes_test.dart | 4 +- .../analyzer/moor/entity_handler_test.dart | 2 +- ...errors_when_importing_part_files_test.dart | 2 +- .../moor/moor_ffi_extension_test.dart | 10 +- .../test/analyzer/moor/moor_parser_test.dart | 8 +- .../analyzer/moor/regression_1138_test.dart | 2 +- .../analyzer/moor/regression_754_test.dart | 2 +- .../analyzer/moor/sqlite_version_test.dart | 4 +- .../analyzer/moor/virtual_table_test.dart | 2 +- .../test/analyzer/options_test.dart | 2 +- .../test/analyzer/repro_1280_test.dart | 2 +- .../test/analyzer/repro_967_test.dart | 2 +- .../test/analyzer/runner/task_test.dart | 2 +- .../sql_queries/custom_result_class_test.dart | 8 +- .../explicit_alias_transformer_test.dart | 2 +- .../analyzer/sql_queries/inference_test.dart | 6 +- .../analyzer/sql_queries/linter_test.dart | 8 +- .../sql_queries/queries_from_views.dart | 6 +- .../sql_queries/query_analyzer_test.dart | 4 +- .../sql_queries/query_handler_test.dart | 16 +- .../sql_queries/type_mapping_test.dart | 4 +- .../test/analyzer/utils.dart | 10 +- .../backends/build/build_backend_test.dart | 4 +- .../build/generators/moor_generator_test.dart | 2 +- .../build/preprocess_builder_tests.dart | 2 +- .../test/cli/migrate_test.dart | 2 +- .../test/model/specified_table_test.dart | 4 +- .../find_stream_update_rules_test.dart | 4 +- .../ide/assists/column_nullability_test.dart | 0 .../test/services/ide/assists/utils.dart | 0 .../test/services/ide/highlights_test.dart | 2 +- .../test/services/ide/utils.dart | 4 +- .../schema/find_differences_test.dart | 2 +- .../services/schema/verifier_impl_test.dart | 2 +- .../test/services/schema/writer_test.dart | 12 +- .../utils/entity_reference_sorter_test.dart | 4 +- .../test/utils/string_escaper_test.dart | 2 +- .../test/utils/test_backend.dart | 2 +- .../mutable_classes_integration_test.dart | 2 +- .../writer/queries/query_writer_test.dart | 6 +- .../test/writer/queries/sql_writer_test.dart | 4 +- .../test/writer/utils/hash_code_test.dart | 2 +- .../writer/utils/override_equals_test.dart | 2 +- .../tool/debug_plugin.dart | 2 +- extras/migrations_example/pubspec.yaml | 2 + moor_generator/bin/moor_generator.dart | 2 +- moor_generator/lib/api/migrations.dart | 168 +----------------- moor_generator/lib/integrations/build.dart | 15 +- moor_generator/lib/integrations/plugin.dart | 9 +- moor_generator/lib/moor_generator.dart | 2 +- moor_generator/lib/plugin.dart | 4 - moor_generator/lib/writer.dart | 17 +- moor_generator/pubspec.yaml | 45 +---- 188 files changed, 741 insertions(+), 620 deletions(-) create mode 100644 drift/analysis_options.yaml create mode 100644 drift_dev/LICENSE create mode 100644 drift_dev/analysis_options.yaml create mode 100644 drift_dev/bin/drift.dart create mode 100644 drift_dev/build.yaml create mode 100644 drift_dev/dart_test.yaml rename moor_generator/moor_generator.build.yaml => drift_dev/drift_dev.yaml (52%) create mode 100644 drift_dev/lib/api/migrations.dart create mode 100644 drift_dev/lib/integrations/build.dart create mode 100644 drift_dev/lib/integrations/plugin.dart create mode 100644 drift_dev/lib/moor_generator.dart rename {moor_generator => drift_dev}/lib/src/analyzer/custom_row_class.dart (97%) rename {moor_generator => drift_dev}/lib/src/analyzer/dart/column_parser.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/dart/parser.dart (86%) rename {moor_generator => drift_dev}/lib/src/analyzer/dart/table_parser.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/dart/use_dao_parser.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/dart/use_moor_parser.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/errors.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/moor/create_table_reader.dart (93%) rename {moor_generator => drift_dev}/lib/src/analyzer/moor/entity_handler.dart (94%) rename {moor_generator => drift_dev}/lib/src/analyzer/moor/find_dart_class.dart (90%) rename {moor_generator => drift_dev}/lib/src/analyzer/moor/moor_ffi_extension.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/moor/parser.dart (88%) rename {moor_generator => drift_dev}/lib/src/analyzer/options.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/options.g.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/runner/file_graph.dart (98%) rename {moor_generator => drift_dev}/lib/src/analyzer/runner/inputs.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/runner/results.dart (87%) rename {moor_generator => drift_dev}/lib/src/analyzer/runner/steps.dart (57%) rename {moor_generator => drift_dev}/lib/src/analyzer/runner/steps/analyze_dart.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/runner/steps/analyze_moor.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/runner/steps/parse_dart.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/runner/steps/parse_moor.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/runner/task.dart (94%) rename {moor_generator => drift_dev}/lib/src/analyzer/session.dart (92%) rename {moor_generator => drift_dev}/lib/src/analyzer/sql_queries/custom_result_class.dart (97%) rename {moor_generator => drift_dev}/lib/src/analyzer/sql_queries/explicit_alias_transformer.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/sql_queries/lints/linter.dart (99%) rename {moor_generator => drift_dev}/lib/src/analyzer/sql_queries/query_analyzer.dart (91%) rename {moor_generator => drift_dev}/lib/src/analyzer/sql_queries/query_handler.dart (96%) rename {moor_generator => drift_dev}/lib/src/analyzer/sql_queries/required_variables.dart (100%) rename {moor_generator => drift_dev}/lib/src/analyzer/sql_queries/type_mapping.dart (98%) rename {moor_generator => drift_dev}/lib/src/analyzer/view/view_analyzer.dart (84%) rename {moor_generator => drift_dev}/lib/src/backends/backend.dart (100%) rename {moor_generator => drift_dev}/lib/src/backends/build/build_backend.dart (95%) rename {moor_generator => drift_dev}/lib/src/backends/build/generators/dao_generator.dart (84%) rename {moor_generator => drift_dev}/lib/src/backends/build/generators/moor_generator.dart (94%) rename {moor_generator => drift_dev}/lib/src/backends/build/moor_builder.dart (82%) rename {moor_generator => drift_dev}/lib/src/backends/build/preprocess_builder.dart (98%) rename {moor_generator => drift_dev}/lib/src/backends/common/driver.dart (93%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/logger.dart (95%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/plugin.dart (91%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/services/autocomplete.dart (93%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/services/errors.dart (89%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/services/folding.dart (95%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/services/navigation.dart (93%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/services/outline.dart (95%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/services/requests.dart (93%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/utils/ast_to_location.dart (90%) rename {moor_generator => drift_dev}/lib/src/backends/plugin/utils/span_utils.dart (100%) rename {moor_generator => drift_dev}/lib/src/backends/standalone.dart (100%) rename {moor_generator => drift_dev}/lib/src/cli/cli.dart (94%) rename {moor_generator => drift_dev}/lib/src/cli/commands/analyze.dart (100%) rename {moor_generator => drift_dev}/lib/src/cli/commands/identify_databases.dart (95%) rename {moor_generator => drift_dev}/lib/src/cli/commands/migrate.dart (99%) rename {moor_generator => drift_dev}/lib/src/cli/commands/schema.dart (72%) rename {moor_generator => drift_dev}/lib/src/cli/commands/schema/dump.dart (91%) rename {moor_generator => drift_dev}/lib/src/cli/commands/schema/generate_utils.dart (95%) rename {moor_generator => drift_dev}/lib/src/cli/logging.dart (100%) rename {moor_generator => drift_dev}/lib/src/cli/project.dart (91%) rename {moor_generator => drift_dev}/lib/src/model/base_entity.dart (96%) rename {moor_generator => drift_dev}/lib/src/model/column.dart (98%) rename {moor_generator => drift_dev}/lib/src/model/database.dart (93%) rename {moor_generator => drift_dev}/lib/src/model/declarations/columns.dart (100%) rename {moor_generator => drift_dev}/lib/src/model/declarations/database.dart (100%) rename {moor_generator => drift_dev}/lib/src/model/declarations/declaration.dart (89%) rename {moor_generator => drift_dev}/lib/src/model/declarations/index.dart (100%) rename {moor_generator => drift_dev}/lib/src/model/declarations/special_queries.dart (100%) rename {moor_generator => drift_dev}/lib/src/model/declarations/tables.dart (100%) rename {moor_generator => drift_dev}/lib/src/model/declarations/trigger.dart (100%) rename {moor_generator => drift_dev}/lib/src/model/declarations/views.dart (100%) rename {moor_generator => drift_dev}/lib/src/model/index.dart (91%) rename {moor_generator => drift_dev}/lib/src/model/model.dart (100%) rename {moor_generator => drift_dev}/lib/src/model/sources.dart (93%) rename {moor_generator => drift_dev}/lib/src/model/special_queries.dart (90%) rename {moor_generator => drift_dev}/lib/src/model/sql_query.dart (98%) rename {moor_generator => drift_dev}/lib/src/model/table.dart (97%) rename {moor_generator => drift_dev}/lib/src/model/trigger.dart (90%) rename {moor_generator => drift_dev}/lib/src/model/types.dart (95%) rename {moor_generator => drift_dev}/lib/src/model/used_type_converter.dart (94%) rename {moor_generator => drift_dev}/lib/src/model/view.dart (90%) rename {moor_generator => drift_dev}/lib/src/services/find_stream_update_rules.dart (98%) rename {moor_generator => drift_dev}/lib/src/services/ide/assists/assist_service.dart (96%) rename {moor_generator => drift_dev}/lib/src/services/ide/assists/column_nullability.dart (100%) rename {moor_generator => drift_dev}/lib/src/services/ide/highlights.dart (98%) rename {moor_generator => drift_dev}/lib/src/services/ide/moor_ide.dart (90%) rename {moor_generator => drift_dev}/lib/src/services/ide/utils.dart (62%) rename {moor_generator => drift_dev}/lib/src/services/schema/find_differences.dart (99%) rename {moor_generator => drift_dev}/lib/src/services/schema/schema_files.dart (98%) rename {moor_generator => drift_dev}/lib/src/services/schema/verifier_impl.dart (98%) rename {moor_generator => drift_dev}/lib/src/utils/entity_reference_sorter.dart (98%) rename {moor_generator => drift_dev}/lib/src/utils/hash.dart (100%) rename {moor_generator => drift_dev}/lib/src/utils/names.dart (100%) rename {moor_generator => drift_dev}/lib/src/utils/options_reader.dart (90%) rename {moor_generator => drift_dev}/lib/src/utils/string_escaper.dart (100%) rename {moor_generator => drift_dev}/lib/src/utils/type_converter_hint.dart (70%) rename {moor_generator => drift_dev}/lib/src/utils/type_utils.dart (76%) rename {moor_generator => drift_dev}/lib/src/writer/database_writer.dart (95%) rename {moor_generator => drift_dev}/lib/src/writer/queries/query_writer.dart (98%) rename {moor_generator => drift_dev}/lib/src/writer/queries/result_set_writer.dart (90%) rename {moor_generator => drift_dev}/lib/src/writer/queries/sql_writer.dart (97%) rename {moor_generator => drift_dev}/lib/src/writer/tables/data_class_writer.dart (97%) rename {moor_generator => drift_dev}/lib/src/writer/tables/table_writer.dart (97%) rename {moor_generator => drift_dev}/lib/src/writer/tables/update_companion_writer.dart (96%) rename {moor_generator => drift_dev}/lib/src/writer/tables/view_writer.dart (91%) rename {moor_generator => drift_dev}/lib/src/writer/utils/hash_code.dart (100%) rename {moor_generator => drift_dev}/lib/src/writer/utils/memoized_getter.dart (97%) rename {moor_generator => drift_dev}/lib/src/writer/utils/override_equals.dart (100%) rename {moor_generator => drift_dev}/lib/src/writer/utils/override_toString.dart (100%) rename {moor_generator => drift_dev}/lib/src/writer/writer.dart (97%) create mode 100644 drift_dev/lib/writer.dart create mode 100644 drift_dev/pubspec.yaml rename {moor_generator => drift_dev}/test/analyzer/cyclic_moor_dart_dependency_test.dart (87%) rename {moor_generator => drift_dev}/test/analyzer/dart/custom_row_classes_test.dart (96%) rename {moor_generator => drift_dev}/test/analyzer/dart/dart_test.dart (90%) rename {moor_generator => drift_dev}/test/analyzer/dart/enum_columns_test.dart (88%) rename {moor_generator => drift_dev}/test/analyzer/dart/regression_1172_test.dart (100%) rename {moor_generator => drift_dev}/test/analyzer/dart/table_parser_test.dart (97%) rename {moor_generator => drift_dev}/test/analyzer/integration/dao_inheritance_test.dart (95%) rename {moor_generator => drift_dev}/test/analyzer/integration/duplicate_tables_test.dart (92%) rename {moor_generator => drift_dev}/test/analyzer/integration/integration_test.dart (93%) rename {moor_generator => drift_dev}/test/analyzer/moor/cfe_test.dart (85%) rename {moor_generator => drift_dev}/test/analyzer/moor/create_table_reader_test.dart (96%) rename {moor_generator => drift_dev}/test/analyzer/moor/create_view_test.dart (96%) rename {moor_generator => drift_dev}/test/analyzer/moor/custom_row_classes_test.dart (96%) rename {moor_generator => drift_dev}/test/analyzer/moor/entity_handler_test.dart (98%) rename {moor_generator => drift_dev}/test/analyzer/moor/errors_when_importing_part_files_test.dart (95%) rename {moor_generator => drift_dev}/test/analyzer/moor/moor_ffi_extension_test.dart (91%) rename {moor_generator => drift_dev}/test/analyzer/moor/moor_parser_test.dart (91%) rename {moor_generator => drift_dev}/test/analyzer/moor/regression_1138_test.dart (95%) rename {moor_generator => drift_dev}/test/analyzer/moor/regression_754_test.dart (95%) rename {moor_generator => drift_dev}/test/analyzer/moor/sqlite_version_test.dart (92%) rename {moor_generator => drift_dev}/test/analyzer/moor/virtual_table_test.dart (95%) rename {moor_generator => drift_dev}/test/analyzer/options_test.dart (96%) rename {moor_generator => drift_dev}/test/analyzer/repro_1280_test.dart (95%) rename {moor_generator => drift_dev}/test/analyzer/repro_967_test.dart (91%) rename {moor_generator => drift_dev}/test/analyzer/runner/task_test.dart (95%) rename {moor_generator => drift_dev}/test/analyzer/sql_queries/custom_result_class_test.dart (90%) rename {moor_generator => drift_dev}/test/analyzer/sql_queries/explicit_alias_transformer_test.dart (96%) rename {moor_generator => drift_dev}/test/analyzer/sql_queries/inference_test.dart (89%) rename {moor_generator => drift_dev}/test/analyzer/sql_queries/linter_test.dart (95%) rename {moor_generator => drift_dev}/test/analyzer/sql_queries/queries_from_views.dart (89%) rename {moor_generator => drift_dev}/test/analyzer/sql_queries/query_analyzer_test.dart (92%) rename {moor_generator => drift_dev}/test/analyzer/sql_queries/query_handler_test.dart (91%) rename {moor_generator => drift_dev}/test/analyzer/sql_queries/type_mapping_test.dart (90%) rename {moor_generator => drift_dev}/test/analyzer/utils.dart (84%) rename {moor_generator => drift_dev}/test/backends/build/build_backend_test.dart (86%) rename {moor_generator => drift_dev}/test/backends/build/generators/moor_generator_test.dart (94%) rename {moor_generator => drift_dev}/test/backends/build/preprocess_builder_tests.dart (97%) rename {moor_generator => drift_dev}/test/cli/migrate_test.dart (99%) rename {moor_generator => drift_dev}/test/model/specified_table_test.dart (80%) rename {moor_generator => drift_dev}/test/services/find_stream_update_rules_test.dart (96%) rename {moor_generator => drift_dev}/test/services/ide/assists/column_nullability_test.dart (100%) rename {moor_generator => drift_dev}/test/services/ide/assists/utils.dart (100%) rename {moor_generator => drift_dev}/test/services/ide/highlights_test.dart (95%) rename {moor_generator => drift_dev}/test/services/ide/utils.dart (87%) rename {moor_generator => drift_dev}/test/services/schema/find_differences_test.dart (97%) rename {moor_generator => drift_dev}/test/services/schema/verifier_impl_test.dart (97%) rename {moor_generator => drift_dev}/test/services/schema/writer_test.dart (95%) rename {moor_generator => drift_dev}/test/utils/entity_reference_sorter_test.dart (94%) rename {moor_generator => drift_dev}/test/utils/string_escaper_test.dart (91%) rename {moor_generator => drift_dev}/test/utils/test_backend.dart (97%) rename {moor_generator => drift_dev}/test/writer/mutable_classes_integration_test.dart (98%) rename {moor_generator => drift_dev}/test/writer/queries/query_writer_test.dart (91%) rename {moor_generator => drift_dev}/test/writer/queries/sql_writer_test.dart (85%) rename {moor_generator => drift_dev}/test/writer/utils/hash_code_test.dart (91%) rename {moor_generator => drift_dev}/test/writer/utils/override_equals_test.dart (90%) rename {moor_generator => drift_dev}/tool/debug_plugin.dart (97%) delete mode 100644 moor_generator/lib/plugin.dart diff --git a/drift/analysis_options.yaml b/drift/analysis_options.yaml new file mode 100644 index 00000000..29506dfb --- /dev/null +++ b/drift/analysis_options.yaml @@ -0,0 +1,15 @@ +include: ../analysis_options.yaml + +analyzer: + errors: + public_member_api_docs: warning + deprecated_member_use_from_same_package: ignore + exclude: + - "example_web/**" + - "**/*.g.dart" + - "**/*.mocks.dart" + +linter: + rules: + # todo: Re-enable after https://dart-review.googlesource.com/c/sdk/+/204040 lands on beta + comment_references: false diff --git a/drift/pubspec.yaml b/drift/pubspec.yaml index 6a445223..c90deb94 100644 --- a/drift/pubspec.yaml +++ b/drift/pubspec.yaml @@ -20,7 +20,7 @@ dependencies: dev_dependencies: build_test: ^2.0.0 build_runner_core: ^7.0.0 - moor_generator: any + drift_dev: any uuid: ^3.0.0 path: ^1.8.0 build_runner: ^2.0.0 @@ -29,7 +29,7 @@ dev_dependencies: rxdart: ^0.27.0 dependency_overrides: - moor_generator: - path: ../moor_generator + drift_dev: + path: ../drift_dev sqlparser: path: ../sqlparser diff --git a/drift_dev/LICENSE b/drift_dev/LICENSE new file mode 100644 index 00000000..ed92ded9 --- /dev/null +++ b/drift_dev/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Simon Binder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/drift_dev/analysis_options.yaml b/drift_dev/analysis_options.yaml new file mode 100644 index 00000000..0caccc81 --- /dev/null +++ b/drift_dev/analysis_options.yaml @@ -0,0 +1 @@ +include: ../analysis_options.yaml \ No newline at end of file diff --git a/drift_dev/bin/drift.dart b/drift_dev/bin/drift.dart new file mode 100644 index 00000000..6ae44aae --- /dev/null +++ b/drift_dev/bin/drift.dart @@ -0,0 +1,6 @@ +//@dart=2.9 +import 'package:drift_dev/src/cli/cli.dart' as cli; + +Future main(List args) { + return cli.run(args); +} diff --git a/drift_dev/build.yaml b/drift_dev/build.yaml new file mode 100644 index 00000000..b9ff353b --- /dev/null +++ b/drift_dev/build.yaml @@ -0,0 +1,42 @@ +# Short description for each builder + +# - preparing_builder: Infers the type of inline Dart expressions in moor files. +# We create a `input.temp.dart` file containing the expressions so that they +# can be resolved. +# - moor_generator: The regular SharedPartBuilder for @UseMoor and @UseDao +# annotations +# - moor_generator_not_shared: Like moor_generator, but as a PartBuilder instead of +# a SharedPartBuilder. This builder is disabled by default, but users may choose +# to use it so that generated classes can be used by other builders. +# - moor_cleanup: Deletes the `.temp.dart` files generated by the `preparing_builder`. + +builders: + preparing_builder: + import: "package:drift_dev/integrations/build.dart" + builder_factories: ["preparingBuilder"] + build_extensions: {".moor": [".temp.dart", ".dart_in_moor"]} + build_to: cache + auto_apply: dependents + applies_builders: ["moor_generator|moor_cleanup"] + + moor_generator: + import: "package:drift_dev/integrations/build.dart" + builder_factories: ["moorBuilder"] + build_extensions: {".dart": [".moor.g.part"]} + auto_apply: dependents + build_to: cache + required_inputs: [".dart_in_moor"] + applies_builders: ["source_gen|combining_builder"] + + moor_generator_not_shared: + import: "package:drift_dev/integrations/build.dart" + builder_factories: ["moorBuilderNotShared"] + build_extensions: {".dart": [".moor.dart"]} + build_to: source + auto_apply: none + required_inputs: [".dart_in_moor"] + +post_process_builders: + moor_cleanup: + import: "package:drift_dev/integrations/build.dart" + builder_factory: "moorCleanup" \ No newline at end of file diff --git a/drift_dev/dart_test.yaml b/drift_dev/dart_test.yaml new file mode 100644 index 00000000..aed72c64 --- /dev/null +++ b/drift_dev/dart_test.yaml @@ -0,0 +1,4 @@ +tags: + # Tests that spawn a Dart analyzer + analyzer: + timeout: 4x # the analyzer can be slow \ No newline at end of file diff --git a/moor_generator/moor_generator.build.yaml b/drift_dev/drift_dev.yaml similarity index 52% rename from moor_generator/moor_generator.build.yaml rename to drift_dev/drift_dev.yaml index c8966aec..2ad8e796 100644 --- a/moor_generator/moor_generator.build.yaml +++ b/drift_dev/drift_dev.yaml @@ -1,3 +1,3 @@ -# Build config without moor-specific builders. When running a build in this directory, this file replaces build.yaml, +# Build config without drift-specific builders. When running a build in this directory, this file replaces build.yaml, # which is what we want! Our builders depend on generated code, so they break the generated build script at the start of # a build. diff --git a/drift_dev/lib/api/migrations.dart b/drift_dev/lib/api/migrations.dart new file mode 100644 index 00000000..8c9d8314 --- /dev/null +++ b/drift_dev/lib/api/migrations.dart @@ -0,0 +1,167 @@ +import 'package:meta/meta.dart'; +import 'package:moor/moor.dart'; + +import 'package:drift_dev/src/services/schema/verifier_impl.dart'; +import 'package:sqlite3/sqlite3.dart'; + +abstract class SchemaVerifier { + factory SchemaVerifier(SchemaInstantiationHelper helper) = + VerifierImplementation; + + /// Creates a [DatabaseConnection] that contains empty tables created for the + /// known schema [version]. + /// + /// This is useful as a starting point for a schema migration test. You can + /// use the [DatabaseConnection] returned to create an instance of your + /// application database, which can then be migrated through + /// [migrateAndValidate]. + /// + /// If you want to insert data in a migration test, use [schemaAt]. + Future startAt(int version); + + /// Creates a new database and instantiates the schema with the given + /// [version]. + /// + /// This can be used as a starting point for a complex schema migration test + /// to verify data integrity. You can roughly follow these steps to write such + /// tests: + /// + /// - call [schemaAt] with the starting version you want to test + /// - use the [InitializedSchema.rawDatabase] of the returned + /// [InitializedSchema] to insert data. + /// - connect your database class to the [InitializedSchema.connection] + /// - call [migrateAndValidate] with the database and your target schema + /// version to run a migration and verify that it yields the desired schema + /// when done. + /// - run select statements on your database to verify that the data from + /// step 2 hasn't been affected by the migration. + /// + /// If you only want to verify the schema without data, using [startAt] might + /// be easier. + Future schemaAt(int version); + + /// Runs a schema migration and verifies that it transforms the database into + /// a correct state. + /// + /// This involves opening the [db] and calling its + /// [GeneratedDatabase.migration] to migrate it to the latest version. + /// Finally, the method will read from `sqlite_schema` to verify that the + /// schema at runtime matches the expected schema version. + /// + /// The future completes normally if the schema migration succeeds and brings + /// the database into the expected schema. If the comparison fails, a + /// [SchemaMismatch] exception will be thrown. + /// + /// If [validateDropped] is enabled (defaults to `false`), the method also + /// validates that no further tables, triggers or views apart from those + /// expected exist. + Future migrateAndValidate(GeneratedDatabase db, int expectedVersion, + {bool validateDropped = false}); +} + +/// The implementation of this class is generated through the `moor_generator` +/// CLI tool. +abstract class SchemaInstantiationHelper { + GeneratedDatabase databaseForVersion(QueryExecutor db, int version); +} + +/// Thrown when trying to instantiate a schema that hasn't been saved. +class MissingSchemaException implements Exception { + /// The requested version that doesn't exist. + final int requested; + + /// All known schema versions. + final Iterable available; + + MissingSchemaException(this.requested, this.available); + + @override + String toString() { + return 'Unknown schema version $requested. ' + 'Known are ${available.join(', ')}.'; + } +} + +/// Thrown when the actual schema differs from the expected schema. +class SchemaMismatch implements Exception { + final String explanation; + + SchemaMismatch(this.explanation); + + @override + String toString() { + return 'Schema does not match\n$explanation'; + } +} + +/// Contains an initialized schema with all tables, views, triggers and indices. +/// +/// You can use the [connection] for your database class and the [rawDatabase] +/// to insert data before the migration. +class InitializedSchema { + /// The raw database from the `sqlite3` package. + /// + /// The database contains all tables, views, triggers and indices from the + /// requested schema. It can be used to insert data before a migration to + /// verify that it's still intact after the migration. + /// + /// This database backs the [connection], so it's not necessary to close it + /// if you're attaching a database later. + final Database rawDatabase; + + final DatabaseConnection Function() _createConnection; + + /// A database connection with a prepared schema. + /// + /// You can connect your database classes to this as a starting point for + /// migration tests. + @Deprecated('Use newConnection instead, and store the result') + late final DatabaseConnection connection = _createConnection(); + + @internal + InitializedSchema(this.rawDatabase, this._createConnection); + + /// Creates a new database connection. + /// + /// All connections returned by this method point to the [rawDatabase]. + /// However, each call to [newConnection] returns an independent connection + /// that is considered closed from moor's point of view. This means that the + /// [rawDatabase] can be used by multiple generated database classes that + /// can independently be opened and closed, albeit not simultaneously. + /// + /// ## Example + /// + /// When generating the schema helpers with the `--data-classes` and the + /// `--companions` command-line flags, this method can be used to create moor + /// databases inserting data at specific versions: + /// + /// ```dart + /// import 'generated/schema.dart'; + /// import 'generated/schema_v1.dart' as v1; + /// import 'generated/schema_v2.dart' as v2; + /// + /// test('data integrity from v1 to v2', () async { + /// final verifier = SchemaVerifier(GeneratedHelper()); + /// final schema = await verifier.schemaAt(1); + /// + /// // Insert some data from the view of the old database on an independent + /// // connection! + /// final oldDb = v1.DatabaseAtV1.connect(schema.newConnection()); + /// await oldDb.into(oldDb.users).insert(v1.UsersCompanion(id: Value(1))); + /// await oldDb.close(); + /// + /// // Run the migration on the real database class from your app + /// final dbForMigration = Database(schema.newConnection()); + /// await verifier.migrateAndValidate(dbForMigration, 2); + /// await dbForMigration.close(); + /// + /// // Make sure the user is still here with a new database at v2 + /// final checkDb = v2.DatabaseAtV2.connect(schema.newConnection()); + /// final user = await checkDb.select(checkDb.users).getSingle(); + /// expect(user.id, 1); + /// expect(user.name, 'default name from migration'); + /// await checkDb.close(); + /// }); + /// ``` + DatabaseConnection newConnection() => _createConnection(); +} diff --git a/drift_dev/lib/integrations/build.dart b/drift_dev/lib/integrations/build.dart new file mode 100644 index 00000000..bb2b54ad --- /dev/null +++ b/drift_dev/lib/integrations/build.dart @@ -0,0 +1,14 @@ +import 'package:build/build.dart'; +import 'package:drift_dev/src/backends/build/moor_builder.dart'; +import 'package:drift_dev/src/backends/build/preprocess_builder.dart'; + +Builder moorBuilder(BuilderOptions options) => MoorSharedPartBuilder(options); + +Builder moorBuilderNotShared(BuilderOptions options) => + MoorPartBuilder(options); + +Builder preparingBuilder(BuilderOptions options) => PreprocessBuilder(); + +PostProcessBuilder moorCleanup(BuilderOptions options) { + return const FileDeletingBuilder(['.temp.dart']); +} diff --git a/drift_dev/lib/integrations/plugin.dart b/drift_dev/lib/integrations/plugin.dart new file mode 100644 index 00000000..28ec088f --- /dev/null +++ b/drift_dev/lib/integrations/plugin.dart @@ -0,0 +1,9 @@ +//@dart=2.9 +import 'dart:isolate'; + +import 'package:analyzer_plugin/starter.dart'; +import 'package:drift_dev/src/backends/plugin/plugin.dart'; + +void start(List args, SendPort sendPort) { + ServerPluginStarter(MoorPlugin.forProduction()).start(sendPort); +} diff --git a/drift_dev/lib/moor_generator.dart b/drift_dev/lib/moor_generator.dart new file mode 100644 index 00000000..1eecbc2d --- /dev/null +++ b/drift_dev/lib/moor_generator.dart @@ -0,0 +1 @@ +export 'src/model/model.dart'; diff --git a/moor_generator/lib/src/analyzer/custom_row_class.dart b/drift_dev/lib/src/analyzer/custom_row_class.dart similarity index 97% rename from moor_generator/lib/src/analyzer/custom_row_class.dart rename to drift_dev/lib/src/analyzer/custom_row_class.dart index 4651cf2c..9d30634e 100644 --- a/moor_generator/lib/src/analyzer/custom_row_class.dart +++ b/drift_dev/lib/src/analyzer/custom_row_class.dart @@ -2,8 +2,8 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/dart/element/type_provider.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; class FoundDartClass { final ClassElement classElement; diff --git a/moor_generator/lib/src/analyzer/dart/column_parser.dart b/drift_dev/lib/src/analyzer/dart/column_parser.dart similarity index 100% rename from moor_generator/lib/src/analyzer/dart/column_parser.dart rename to drift_dev/lib/src/analyzer/dart/column_parser.dart diff --git a/moor_generator/lib/src/analyzer/dart/parser.dart b/drift_dev/lib/src/analyzer/dart/parser.dart similarity index 86% rename from moor_generator/lib/src/analyzer/dart/parser.dart rename to drift_dev/lib/src/analyzer/dart/parser.dart index f67faec9..a7f63aff 100644 --- a/moor_generator/lib/src/analyzer/dart/parser.dart +++ b/drift_dev/lib/src/analyzer/dart/parser.dart @@ -5,13 +5,13 @@ import 'package:analyzer/dart/element/type.dart'; import 'package:collection/collection.dart'; import 'package:meta/meta.dart'; import 'package:moor/sqlite_keywords.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/model/declarations/declaration.dart'; -import 'package:moor_generator/src/model/used_type_converter.dart'; -import 'package:moor_generator/src/utils/names.dart'; -import 'package:moor_generator/src/utils/type_utils.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/model/declarations/declaration.dart'; +import 'package:drift_dev/src/model/used_type_converter.dart'; +import 'package:drift_dev/src/utils/names.dart'; +import 'package:drift_dev/src/utils/type_utils.dart'; import 'package:recase/recase.dart'; import 'package:source_gen/source_gen.dart'; diff --git a/moor_generator/lib/src/analyzer/dart/table_parser.dart b/drift_dev/lib/src/analyzer/dart/table_parser.dart similarity index 100% rename from moor_generator/lib/src/analyzer/dart/table_parser.dart rename to drift_dev/lib/src/analyzer/dart/table_parser.dart diff --git a/moor_generator/lib/src/analyzer/dart/use_dao_parser.dart b/drift_dev/lib/src/analyzer/dart/use_dao_parser.dart similarity index 100% rename from moor_generator/lib/src/analyzer/dart/use_dao_parser.dart rename to drift_dev/lib/src/analyzer/dart/use_dao_parser.dart diff --git a/moor_generator/lib/src/analyzer/dart/use_moor_parser.dart b/drift_dev/lib/src/analyzer/dart/use_moor_parser.dart similarity index 100% rename from moor_generator/lib/src/analyzer/dart/use_moor_parser.dart rename to drift_dev/lib/src/analyzer/dart/use_moor_parser.dart diff --git a/moor_generator/lib/src/analyzer/errors.dart b/drift_dev/lib/src/analyzer/errors.dart similarity index 100% rename from moor_generator/lib/src/analyzer/errors.dart rename to drift_dev/lib/src/analyzer/errors.dart diff --git a/moor_generator/lib/src/analyzer/moor/create_table_reader.dart b/drift_dev/lib/src/analyzer/moor/create_table_reader.dart similarity index 93% rename from moor_generator/lib/src/analyzer/moor/create_table_reader.dart rename to drift_dev/lib/src/analyzer/moor/create_table_reader.dart index d3d908bb..9bf0d98b 100644 --- a/moor_generator/lib/src/analyzer/moor/create_table_reader.dart +++ b/drift_dev/lib/src/analyzer/moor/create_table_reader.dart @@ -1,16 +1,16 @@ import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/type_mapping.dart'; -import 'package:moor_generator/src/backends/backend.dart'; -import 'package:moor_generator/src/model/declarations/declaration.dart'; -import 'package:moor_generator/src/model/used_type_converter.dart'; -import 'package:moor_generator/src/utils/names.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; -import 'package:moor_generator/src/utils/type_converter_hint.dart'; -import 'package:moor_generator/src/utils/type_utils.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/type_mapping.dart'; +import 'package:drift_dev/src/backends/backend.dart'; +import 'package:drift_dev/src/model/declarations/declaration.dart'; +import 'package:drift_dev/src/model/used_type_converter.dart'; +import 'package:drift_dev/src/utils/names.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; +import 'package:drift_dev/src/utils/type_converter_hint.dart'; +import 'package:drift_dev/src/utils/type_utils.dart'; import 'package:recase/recase.dart'; import 'package:sqlparser/sqlparser.dart'; diff --git a/moor_generator/lib/src/analyzer/moor/entity_handler.dart b/drift_dev/lib/src/analyzer/moor/entity_handler.dart similarity index 94% rename from moor_generator/lib/src/analyzer/moor/entity_handler.dart rename to drift_dev/lib/src/analyzer/moor/entity_handler.dart index 13feb47a..11e7dc5f 100644 --- a/moor_generator/lib/src/analyzer/moor/entity_handler.dart +++ b/drift_dev/lib/src/analyzer/moor/entity_handler.dart @@ -1,9 +1,9 @@ import 'package:collection/collection.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/query_analyzer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/query_analyzer.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:sqlparser/utils/find_referenced_tables.dart'; diff --git a/moor_generator/lib/src/analyzer/moor/find_dart_class.dart b/drift_dev/lib/src/analyzer/moor/find_dart_class.dart similarity index 90% rename from moor_generator/lib/src/analyzer/moor/find_dart_class.dart rename to drift_dev/lib/src/analyzer/moor/find_dart_class.dart index e075b24f..a3f388e6 100644 --- a/moor_generator/lib/src/analyzer/moor/find_dart_class.dart +++ b/drift_dev/lib/src/analyzer/moor/find_dart_class.dart @@ -1,7 +1,7 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/backends/backend.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/backends/backend.dart'; import 'package:sqlparser/sqlparser.dart'; import '../custom_row_class.dart'; diff --git a/moor_generator/lib/src/analyzer/moor/moor_ffi_extension.dart b/drift_dev/lib/src/analyzer/moor/moor_ffi_extension.dart similarity index 100% rename from moor_generator/lib/src/analyzer/moor/moor_ffi_extension.dart rename to drift_dev/lib/src/analyzer/moor/moor_ffi_extension.dart diff --git a/moor_generator/lib/src/analyzer/moor/parser.dart b/drift_dev/lib/src/analyzer/moor/parser.dart similarity index 88% rename from moor_generator/lib/src/analyzer/moor/parser.dart rename to drift_dev/lib/src/analyzer/moor/parser.dart index 89dd7d08..eece8926 100644 --- a/moor_generator/lib/src/analyzer/moor/parser.dart +++ b/drift_dev/lib/src/analyzer/moor/parser.dart @@ -1,9 +1,9 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/moor/create_table_reader.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/moor/create_table_reader.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; import 'package:sqlparser/sqlparser.dart'; class MoorParser { diff --git a/moor_generator/lib/src/analyzer/options.dart b/drift_dev/lib/src/analyzer/options.dart similarity index 100% rename from moor_generator/lib/src/analyzer/options.dart rename to drift_dev/lib/src/analyzer/options.dart diff --git a/moor_generator/lib/src/analyzer/options.g.dart b/drift_dev/lib/src/analyzer/options.g.dart similarity index 100% rename from moor_generator/lib/src/analyzer/options.g.dart rename to drift_dev/lib/src/analyzer/options.g.dart diff --git a/moor_generator/lib/src/analyzer/runner/file_graph.dart b/drift_dev/lib/src/analyzer/runner/file_graph.dart similarity index 98% rename from moor_generator/lib/src/analyzer/runner/file_graph.dart rename to drift_dev/lib/src/analyzer/runner/file_graph.dart index 30c752cc..35b1974d 100644 --- a/moor_generator/lib/src/analyzer/runner/file_graph.dart +++ b/drift_dev/lib/src/analyzer/runner/file_graph.dart @@ -1,7 +1,7 @@ import 'dart:collection'; import 'package:collection/collection.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import '../errors.dart'; diff --git a/moor_generator/lib/src/analyzer/runner/inputs.dart b/drift_dev/lib/src/analyzer/runner/inputs.dart similarity index 100% rename from moor_generator/lib/src/analyzer/runner/inputs.dart rename to drift_dev/lib/src/analyzer/runner/inputs.dart diff --git a/moor_generator/lib/src/analyzer/runner/results.dart b/drift_dev/lib/src/analyzer/runner/results.dart similarity index 87% rename from moor_generator/lib/src/analyzer/runner/results.dart rename to drift_dev/lib/src/analyzer/runner/results.dart index 9726d64b..1efab092 100644 --- a/moor_generator/lib/src/analyzer/runner/results.dart +++ b/drift_dev/lib/src/analyzer/runner/results.dart @@ -1,8 +1,8 @@ import 'package:analyzer/dart/element/element.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; -import 'package:moor_generator/src/model/view.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; +import 'package:drift_dev/src/model/view.dart'; import 'package:sqlparser/sqlparser.dart'; abstract class FileResult { diff --git a/moor_generator/lib/src/analyzer/runner/steps.dart b/drift_dev/lib/src/analyzer/runner/steps.dart similarity index 57% rename from moor_generator/lib/src/analyzer/runner/steps.dart rename to drift_dev/lib/src/analyzer/runner/steps.dart index 4946d4ca..7a5b1ced 100644 --- a/moor_generator/lib/src/analyzer/runner/steps.dart +++ b/drift_dev/lib/src/analyzer/runner/steps.dart @@ -2,21 +2,21 @@ import 'package:analyzer/dart/constant/value.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:moor/moor.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/dart/parser.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/moor/entity_handler.dart'; -import 'package:moor_generator/src/analyzer/moor/parser.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/runner/task.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/custom_result_class.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/query_analyzer.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/type_mapping.dart'; -import 'package:moor_generator/src/analyzer/view/view_analyzer.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; -import 'package:moor_generator/src/model/view.dart'; -import 'package:moor_generator/src/utils/entity_reference_sorter.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/dart/parser.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/moor/entity_handler.dart'; +import 'package:drift_dev/src/analyzer/moor/parser.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/task.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/custom_result_class.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/query_analyzer.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/type_mapping.dart'; +import 'package:drift_dev/src/analyzer/view/view_analyzer.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; +import 'package:drift_dev/src/model/view.dart'; +import 'package:drift_dev/src/utils/entity_reference_sorter.dart'; import 'package:source_gen/source_gen.dart'; part 'steps/analyze_dart.dart'; diff --git a/moor_generator/lib/src/analyzer/runner/steps/analyze_dart.dart b/drift_dev/lib/src/analyzer/runner/steps/analyze_dart.dart similarity index 100% rename from moor_generator/lib/src/analyzer/runner/steps/analyze_dart.dart rename to drift_dev/lib/src/analyzer/runner/steps/analyze_dart.dart diff --git a/moor_generator/lib/src/analyzer/runner/steps/analyze_moor.dart b/drift_dev/lib/src/analyzer/runner/steps/analyze_moor.dart similarity index 100% rename from moor_generator/lib/src/analyzer/runner/steps/analyze_moor.dart rename to drift_dev/lib/src/analyzer/runner/steps/analyze_moor.dart diff --git a/moor_generator/lib/src/analyzer/runner/steps/parse_dart.dart b/drift_dev/lib/src/analyzer/runner/steps/parse_dart.dart similarity index 100% rename from moor_generator/lib/src/analyzer/runner/steps/parse_dart.dart rename to drift_dev/lib/src/analyzer/runner/steps/parse_dart.dart diff --git a/moor_generator/lib/src/analyzer/runner/steps/parse_moor.dart b/drift_dev/lib/src/analyzer/runner/steps/parse_moor.dart similarity index 100% rename from moor_generator/lib/src/analyzer/runner/steps/parse_moor.dart rename to drift_dev/lib/src/analyzer/runner/steps/parse_moor.dart diff --git a/moor_generator/lib/src/analyzer/runner/task.dart b/drift_dev/lib/src/analyzer/runner/task.dart similarity index 94% rename from moor_generator/lib/src/analyzer/runner/task.dart rename to drift_dev/lib/src/analyzer/runner/task.dart index 50e61248..80407a19 100644 --- a/moor_generator/lib/src/analyzer/runner/task.dart +++ b/drift_dev/lib/src/analyzer/runner/task.dart @@ -1,11 +1,11 @@ import 'package:analyzer/dart/element/element.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; -import 'package:moor_generator/src/backends/backend.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; +import 'package:drift_dev/src/backends/backend.dart'; import 'package:sqlparser/sqlparser.dart'; /// A task is used to fully parse and analyze files based on an input file. To diff --git a/moor_generator/lib/src/analyzer/session.dart b/drift_dev/lib/src/analyzer/session.dart similarity index 92% rename from moor_generator/lib/src/analyzer/session.dart rename to drift_dev/lib/src/analyzer/session.dart index f6a69509..6638ae56 100644 --- a/moor_generator/lib/src/analyzer/session.dart +++ b/drift_dev/lib/src/analyzer/session.dart @@ -1,10 +1,10 @@ import 'dart:async'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/moor/moor_ffi_extension.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/task.dart'; -import 'package:moor_generator/src/backends/backend.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/moor/moor_ffi_extension.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/task.dart'; +import 'package:drift_dev/src/backends/backend.dart'; import 'package:path/path.dart' as p; import 'package:sqlparser/sqlparser.dart'; diff --git a/moor_generator/lib/src/analyzer/sql_queries/custom_result_class.dart b/drift_dev/lib/src/analyzer/sql_queries/custom_result_class.dart similarity index 97% rename from moor_generator/lib/src/analyzer/sql_queries/custom_result_class.dart rename to drift_dev/lib/src/analyzer/sql_queries/custom_result_class.dart index 8b046a14..0063db04 100644 --- a/moor_generator/lib/src/analyzer/sql_queries/custom_result_class.dart +++ b/drift_dev/lib/src/analyzer/sql_queries/custom_result_class.dart @@ -1,5 +1,5 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; /// Transforms queries accessible to the [accessor] so that they use custom /// result names. diff --git a/moor_generator/lib/src/analyzer/sql_queries/explicit_alias_transformer.dart b/drift_dev/lib/src/analyzer/sql_queries/explicit_alias_transformer.dart similarity index 100% rename from moor_generator/lib/src/analyzer/sql_queries/explicit_alias_transformer.dart rename to drift_dev/lib/src/analyzer/sql_queries/explicit_alias_transformer.dart diff --git a/moor_generator/lib/src/analyzer/sql_queries/lints/linter.dart b/drift_dev/lib/src/analyzer/sql_queries/lints/linter.dart similarity index 99% rename from moor_generator/lib/src/analyzer/sql_queries/lints/linter.dart rename to drift_dev/lib/src/analyzer/sql_queries/lints/linter.dart index 72863eac..2245ca54 100644 --- a/moor_generator/lib/src/analyzer/sql_queries/lints/linter.dart +++ b/drift_dev/lib/src/analyzer/sql_queries/lints/linter.dart @@ -1,4 +1,4 @@ -import 'package:moor_generator/moor_generator.dart' show MoorColumn; +import 'package:drift_dev/moor_generator.dart' show MoorColumn; import 'package:sqlparser/sqlparser.dart'; import '../query_handler.dart'; diff --git a/moor_generator/lib/src/analyzer/sql_queries/query_analyzer.dart b/drift_dev/lib/src/analyzer/sql_queries/query_analyzer.dart similarity index 91% rename from moor_generator/lib/src/analyzer/sql_queries/query_analyzer.dart rename to drift_dev/lib/src/analyzer/sql_queries/query_analyzer.dart index 4f72f4be..cf735a3a 100644 --- a/moor_generator/lib/src/analyzer/sql_queries/query_analyzer.dart +++ b/drift_dev/lib/src/analyzer/sql_queries/query_analyzer.dart @@ -1,14 +1,14 @@ import 'package:build/build.dart'; import 'package:meta/meta.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/lints/linter.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/query_handler.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/type_mapping.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; -import 'package:moor_generator/src/model/view.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/lints/linter.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/query_handler.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/type_mapping.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; +import 'package:drift_dev/src/model/view.dart'; import 'package:sqlparser/sqlparser.dart' hide ResultColumn; import 'package:sqlparser/utils/find_referenced_tables.dart'; diff --git a/moor_generator/lib/src/analyzer/sql_queries/query_handler.dart b/drift_dev/lib/src/analyzer/sql_queries/query_handler.dart similarity index 96% rename from moor_generator/lib/src/analyzer/sql_queries/query_handler.dart rename to drift_dev/lib/src/analyzer/sql_queries/query_handler.dart index ab6c9ad6..980d539b 100644 --- a/moor_generator/lib/src/analyzer/sql_queries/query_handler.dart +++ b/drift_dev/lib/src/analyzer/sql_queries/query_handler.dart @@ -1,8 +1,8 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/type_mapping.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; -import 'package:moor_generator/src/model/used_type_converter.dart'; -import 'package:moor_generator/src/utils/type_converter_hint.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/type_mapping.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; +import 'package:drift_dev/src/model/used_type_converter.dart'; +import 'package:drift_dev/src/utils/type_converter_hint.dart'; import 'package:sqlparser/sqlparser.dart' hide ResultColumn; import 'package:sqlparser/utils/find_referenced_tables.dart'; diff --git a/moor_generator/lib/src/analyzer/sql_queries/required_variables.dart b/drift_dev/lib/src/analyzer/sql_queries/required_variables.dart similarity index 100% rename from moor_generator/lib/src/analyzer/sql_queries/required_variables.dart rename to drift_dev/lib/src/analyzer/sql_queries/required_variables.dart diff --git a/moor_generator/lib/src/analyzer/sql_queries/type_mapping.dart b/drift_dev/lib/src/analyzer/sql_queries/type_mapping.dart similarity index 98% rename from moor_generator/lib/src/analyzer/sql_queries/type_mapping.dart rename to drift_dev/lib/src/analyzer/sql_queries/type_mapping.dart index cc5d34ef..b5b47edd 100644 --- a/moor_generator/lib/src/analyzer/sql_queries/type_mapping.dart +++ b/drift_dev/lib/src/analyzer/sql_queries/type_mapping.dart @@ -1,8 +1,8 @@ import 'package:moor/moor.dart' as m; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; -import 'package:moor_generator/src/model/view.dart'; -import 'package:moor_generator/src/utils/type_converter_hint.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; +import 'package:drift_dev/src/model/view.dart'; +import 'package:drift_dev/src/utils/type_converter_hint.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:sqlparser/utils/find_referenced_tables.dart' as s; diff --git a/moor_generator/lib/src/analyzer/view/view_analyzer.dart b/drift_dev/lib/src/analyzer/view/view_analyzer.dart similarity index 84% rename from moor_generator/lib/src/analyzer/view/view_analyzer.dart rename to drift_dev/lib/src/analyzer/view/view_analyzer.dart index 5f2c234b..7a7b7b9d 100644 --- a/moor_generator/lib/src/analyzer/view/view_analyzer.dart +++ b/drift_dev/lib/src/analyzer/view/view_analyzer.dart @@ -1,11 +1,11 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/moor/find_dart_class.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/query_analyzer.dart'; -import 'package:moor_generator/src/model/table.dart'; -import 'package:moor_generator/src/model/view.dart'; -import 'package:moor_generator/src/utils/type_converter_hint.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/moor/find_dart_class.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/query_analyzer.dart'; +import 'package:drift_dev/src/model/table.dart'; +import 'package:drift_dev/src/model/view.dart'; +import 'package:drift_dev/src/utils/type_converter_hint.dart'; import 'package:recase/recase.dart'; import 'package:sqlparser/sqlparser.dart'; diff --git a/moor_generator/lib/src/backends/backend.dart b/drift_dev/lib/src/backends/backend.dart similarity index 100% rename from moor_generator/lib/src/backends/backend.dart rename to drift_dev/lib/src/backends/backend.dart diff --git a/moor_generator/lib/src/backends/build/build_backend.dart b/drift_dev/lib/src/backends/build/build_backend.dart similarity index 95% rename from moor_generator/lib/src/backends/build/build_backend.dart rename to drift_dev/lib/src/backends/build/build_backend.dart index 72ee6e0b..c51bb021 100644 --- a/moor_generator/lib/src/backends/build/build_backend.dart +++ b/drift_dev/lib/src/backends/build/build_backend.dart @@ -5,8 +5,8 @@ import 'package:analyzer/dart/element/type.dart'; import 'package:build/build.dart' hide log; import 'package:build/build.dart' as build show log; import 'package:logging/logging.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/backends/backend.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/backends/backend.dart'; class BuildBackend extends Backend { final MoorOptions options; diff --git a/moor_generator/lib/src/backends/build/generators/dao_generator.dart b/drift_dev/lib/src/backends/build/generators/dao_generator.dart similarity index 84% rename from moor_generator/lib/src/backends/build/generators/dao_generator.dart rename to drift_dev/lib/src/backends/build/generators/dao_generator.dart index 478875f0..ae7d332b 100644 --- a/moor_generator/lib/src/backends/build/generators/dao_generator.dart +++ b/drift_dev/lib/src/backends/build/generators/dao_generator.dart @@ -1,8 +1,8 @@ import 'package:build/build.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/backends/build/moor_builder.dart'; -import 'package:moor_generator/src/utils/type_utils.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/backends/build/moor_builder.dart'; +import 'package:drift_dev/src/utils/type_utils.dart'; +import 'package:drift_dev/writer.dart'; import 'package:source_gen/source_gen.dart'; class DaoGenerator extends Generator implements BaseGenerator { diff --git a/moor_generator/lib/src/backends/build/generators/moor_generator.dart b/drift_dev/lib/src/backends/build/generators/moor_generator.dart similarity index 94% rename from moor_generator/lib/src/backends/build/generators/moor_generator.dart rename to drift_dev/lib/src/backends/build/generators/moor_generator.dart index 8fea29b6..722385bb 100644 --- a/moor_generator/lib/src/backends/build/generators/moor_generator.dart +++ b/drift_dev/lib/src/backends/build/generators/moor_generator.dart @@ -1,6 +1,6 @@ import 'package:build/build.dart'; -import 'package:moor_generator/src/backends/build/moor_builder.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/src/backends/build/moor_builder.dart'; +import 'package:drift_dev/writer.dart'; import 'package:source_gen/source_gen.dart'; const _ignoredLints = [ diff --git a/moor_generator/lib/src/backends/build/moor_builder.dart b/drift_dev/lib/src/backends/build/moor_builder.dart similarity index 82% rename from moor_generator/lib/src/backends/build/moor_builder.dart rename to drift_dev/lib/src/backends/build/moor_builder.dart index b9017021..23485d1a 100644 --- a/moor_generator/lib/src/backends/build/moor_builder.dart +++ b/drift_dev/lib/src/backends/build/moor_builder.dart @@ -1,13 +1,13 @@ import 'package:build/build.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/runner/task.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; -import 'package:moor_generator/src/backends/build/build_backend.dart'; -import 'package:moor_generator/src/backends/build/generators/dao_generator.dart'; -import 'package:moor_generator/src/backends/build/generators/moor_generator.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/task.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; +import 'package:drift_dev/src/backends/build/build_backend.dart'; +import 'package:drift_dev/src/backends/build/generators/dao_generator.dart'; +import 'package:drift_dev/src/backends/build/generators/moor_generator.dart'; +import 'package:drift_dev/writer.dart'; import 'package:source_gen/source_gen.dart'; class _BuilderFlags { diff --git a/moor_generator/lib/src/backends/build/preprocess_builder.dart b/drift_dev/lib/src/backends/build/preprocess_builder.dart similarity index 98% rename from moor_generator/lib/src/backends/build/preprocess_builder.dart rename to drift_dev/lib/src/backends/build/preprocess_builder.dart index cc67ac49..37f6facf 100644 --- a/moor_generator/lib/src/backends/build/preprocess_builder.dart +++ b/drift_dev/lib/src/backends/build/preprocess_builder.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'package:build/build.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; import 'package:sqlparser/sqlparser.dart'; /// A support builder that runs before the main moor_generator to parse and diff --git a/moor_generator/lib/src/backends/common/driver.dart b/drift_dev/lib/src/backends/common/driver.dart similarity index 93% rename from moor_generator/lib/src/backends/common/driver.dart rename to drift_dev/lib/src/backends/common/driver.dart index b8aaa421..d799b5c1 100644 --- a/moor_generator/lib/src/backends/common/driver.dart +++ b/drift_dev/lib/src/backends/common/driver.dart @@ -8,10 +8,10 @@ import 'package:analyzer/file_system/overlay_file_system.dart'; // ignore: implementation_imports import 'package:drift/src/utils/synchronized.dart'; import 'package:logging/logging.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; -import 'package:moor_generator/src/utils/options_reader.dart' as options; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; +import 'package:drift_dev/src/utils/options_reader.dart' as options; import '../standalone.dart'; diff --git a/moor_generator/lib/src/backends/plugin/logger.dart b/drift_dev/lib/src/backends/plugin/logger.dart similarity index 95% rename from moor_generator/lib/src/backends/plugin/logger.dart rename to drift_dev/lib/src/backends/plugin/logger.dart index bae1252b..b58c73d8 100644 --- a/moor_generator/lib/src/backends/plugin/logger.dart +++ b/drift_dev/lib/src/backends/plugin/logger.dart @@ -1,7 +1,7 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_generated.dart'; import 'package:logging/logging.dart'; -import 'package:moor_generator/src/backends/plugin/plugin.dart'; +import 'package:drift_dev/src/backends/plugin/plugin.dart'; var _initialized = false; diff --git a/moor_generator/lib/src/backends/plugin/plugin.dart b/drift_dev/lib/src/backends/plugin/plugin.dart similarity index 91% rename from moor_generator/lib/src/backends/plugin/plugin.dart rename to drift_dev/lib/src/backends/plugin/plugin.dart index 36e1df6b..ef36cd39 100644 --- a/moor_generator/lib/src/backends/plugin/plugin.dart +++ b/drift_dev/lib/src/backends/plugin/plugin.dart @@ -13,15 +13,15 @@ import 'package:analyzer_plugin/utilities/completion/completion_core.dart'; import 'package:analyzer_plugin/utilities/folding/folding.dart'; import 'package:analyzer_plugin/utilities/navigation/navigation.dart'; import 'package:analyzer_plugin/utilities/outline/outline.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/backends/common/driver.dart'; -import 'package:moor_generator/src/backends/plugin/services/autocomplete.dart'; -import 'package:moor_generator/src/backends/plugin/services/errors.dart'; -import 'package:moor_generator/src/backends/plugin/services/folding.dart'; -import 'package:moor_generator/src/backends/plugin/services/navigation.dart'; -import 'package:moor_generator/src/backends/plugin/services/outline.dart'; -import 'package:moor_generator/src/backends/plugin/services/requests.dart'; -import 'package:moor_generator/src/services/ide/moor_ide.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/backends/common/driver.dart'; +import 'package:drift_dev/src/backends/plugin/services/autocomplete.dart'; +import 'package:drift_dev/src/backends/plugin/services/errors.dart'; +import 'package:drift_dev/src/backends/plugin/services/folding.dart'; +import 'package:drift_dev/src/backends/plugin/services/navigation.dart'; +import 'package:drift_dev/src/backends/plugin/services/outline.dart'; +import 'package:drift_dev/src/backends/plugin/services/requests.dart'; +import 'package:drift_dev/src/services/ide/moor_ide.dart'; import 'logger.dart'; diff --git a/moor_generator/lib/src/backends/plugin/services/autocomplete.dart b/drift_dev/lib/src/backends/plugin/services/autocomplete.dart similarity index 93% rename from moor_generator/lib/src/backends/plugin/services/autocomplete.dart rename to drift_dev/lib/src/backends/plugin/services/autocomplete.dart index 2083c774..4fb42135 100644 --- a/moor_generator/lib/src/backends/plugin/services/autocomplete.dart +++ b/drift_dev/lib/src/backends/plugin/services/autocomplete.dart @@ -1,7 +1,7 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:analyzer_plugin/utilities/completion/completion_core.dart'; -import 'package:moor_generator/src/backends/plugin/services/requests.dart'; +import 'package:drift_dev/src/backends/plugin/services/requests.dart'; class MoorCompletingContributor implements CompletionContributor { const MoorCompletingContributor(); diff --git a/moor_generator/lib/src/backends/plugin/services/errors.dart b/drift_dev/lib/src/backends/plugin/services/errors.dart similarity index 89% rename from moor_generator/lib/src/backends/plugin/services/errors.dart rename to drift_dev/lib/src/backends/plugin/services/errors.dart index ff7fdcb9..7e1b411f 100644 --- a/moor_generator/lib/src/backends/plugin/services/errors.dart +++ b/drift_dev/lib/src/backends/plugin/services/errors.dart @@ -1,9 +1,9 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:analyzer_plugin/protocol/protocol_generated.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/backends/plugin/plugin.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/backends/plugin/plugin.dart'; const _genericError = 'moor.errorGeneric'; diff --git a/moor_generator/lib/src/backends/plugin/services/folding.dart b/drift_dev/lib/src/backends/plugin/services/folding.dart similarity index 95% rename from moor_generator/lib/src/backends/plugin/services/folding.dart rename to drift_dev/lib/src/backends/plugin/services/folding.dart index 26641eb2..d146fc34 100644 --- a/moor_generator/lib/src/backends/plugin/services/folding.dart +++ b/drift_dev/lib/src/backends/plugin/services/folding.dart @@ -1,7 +1,7 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:analyzer_plugin/utilities/folding/folding.dart'; -import 'package:moor_generator/src/backends/plugin/services/requests.dart'; +import 'package:drift_dev/src/backends/plugin/services/requests.dart'; import 'package:sqlparser/sqlparser.dart'; class MoorFoldingContributor implements FoldingContributor { diff --git a/moor_generator/lib/src/backends/plugin/services/navigation.dart b/drift_dev/lib/src/backends/plugin/services/navigation.dart similarity index 93% rename from moor_generator/lib/src/backends/plugin/services/navigation.dart rename to drift_dev/lib/src/backends/plugin/services/navigation.dart index 6c95ed0d..4edec602 100644 --- a/moor_generator/lib/src/backends/plugin/services/navigation.dart +++ b/drift_dev/lib/src/backends/plugin/services/navigation.dart @@ -1,10 +1,10 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:analyzer_plugin/utilities/navigation/navigation.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/backends/plugin/services/requests.dart'; -import 'package:moor_generator/src/backends/plugin/utils/ast_to_location.dart'; -import 'package:moor_generator/src/backends/plugin/utils/span_utils.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/backends/plugin/services/requests.dart'; +import 'package:drift_dev/src/backends/plugin/utils/ast_to_location.dart'; +import 'package:drift_dev/src/backends/plugin/utils/span_utils.dart'; import 'package:source_span/source_span.dart'; import 'package:sqlparser/sqlparser.dart'; diff --git a/moor_generator/lib/src/backends/plugin/services/outline.dart b/drift_dev/lib/src/backends/plugin/services/outline.dart similarity index 95% rename from moor_generator/lib/src/backends/plugin/services/outline.dart rename to drift_dev/lib/src/backends/plugin/services/outline.dart index b531a05e..17f06a93 100644 --- a/moor_generator/lib/src/backends/plugin/services/outline.dart +++ b/drift_dev/lib/src/backends/plugin/services/outline.dart @@ -1,8 +1,8 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:analyzer_plugin/utilities/outline/outline.dart'; -import 'package:moor_generator/src/backends/plugin/services/requests.dart'; -import 'package:moor_generator/src/backends/plugin/utils/ast_to_location.dart'; +import 'package:drift_dev/src/backends/plugin/services/requests.dart'; +import 'package:drift_dev/src/backends/plugin/utils/ast_to_location.dart'; import 'package:sqlparser/sqlparser.dart'; const _defaultFlags = 0; diff --git a/moor_generator/lib/src/backends/plugin/services/requests.dart b/drift_dev/lib/src/backends/plugin/services/requests.dart similarity index 93% rename from moor_generator/lib/src/backends/plugin/services/requests.dart rename to drift_dev/lib/src/backends/plugin/services/requests.dart index ba307010..5999c133 100644 --- a/moor_generator/lib/src/backends/plugin/services/requests.dart +++ b/drift_dev/lib/src/backends/plugin/services/requests.dart @@ -6,8 +6,8 @@ import 'package:analyzer_plugin/utilities/folding/folding.dart'; import 'package:analyzer_plugin/utilities/highlights/highlights.dart'; import 'package:analyzer_plugin/utilities/navigation/navigation.dart'; import 'package:analyzer_plugin/utilities/outline/outline.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:source_span/source_span.dart'; mixin _MoorBaseRequest { diff --git a/moor_generator/lib/src/backends/plugin/utils/ast_to_location.dart b/drift_dev/lib/src/backends/plugin/utils/ast_to_location.dart similarity index 90% rename from moor_generator/lib/src/backends/plugin/utils/ast_to_location.dart rename to drift_dev/lib/src/backends/plugin/utils/ast_to_location.dart index 4835ea20..8e50f1c7 100644 --- a/moor_generator/lib/src/backends/plugin/utils/ast_to_location.dart +++ b/drift_dev/lib/src/backends/plugin/utils/ast_to_location.dart @@ -1,7 +1,7 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; import 'package:source_gen/source_gen.dart' show spanForElement; import 'package:source_span/source_span.dart'; import 'package:sqlparser/sqlparser.dart'; diff --git a/moor_generator/lib/src/backends/plugin/utils/span_utils.dart b/drift_dev/lib/src/backends/plugin/utils/span_utils.dart similarity index 100% rename from moor_generator/lib/src/backends/plugin/utils/span_utils.dart rename to drift_dev/lib/src/backends/plugin/utils/span_utils.dart diff --git a/moor_generator/lib/src/backends/standalone.dart b/drift_dev/lib/src/backends/standalone.dart similarity index 100% rename from moor_generator/lib/src/backends/standalone.dart rename to drift_dev/lib/src/backends/standalone.dart diff --git a/moor_generator/lib/src/cli/cli.dart b/drift_dev/lib/src/cli/cli.dart similarity index 94% rename from moor_generator/lib/src/cli/cli.dart rename to drift_dev/lib/src/cli/cli.dart index c8985f89..5603ca20 100644 --- a/moor_generator/lib/src/cli/cli.dart +++ b/drift_dev/lib/src/cli/cli.dart @@ -5,8 +5,8 @@ import 'dart:io'; import 'package:analyzer/file_system/physical_file_system.dart'; import 'package:args/command_runner.dart'; import 'package:logging/logging.dart'; -import 'package:moor_generator/src/backends/common/driver.dart'; -import 'package:moor_generator/src/cli/project.dart'; +import 'package:drift_dev/src/backends/common/driver.dart'; +import 'package:drift_dev/src/cli/project.dart'; import 'commands/analyze.dart'; import 'commands/identify_databases.dart'; diff --git a/moor_generator/lib/src/cli/commands/analyze.dart b/drift_dev/lib/src/cli/commands/analyze.dart similarity index 100% rename from moor_generator/lib/src/cli/commands/analyze.dart rename to drift_dev/lib/src/cli/commands/analyze.dart diff --git a/moor_generator/lib/src/cli/commands/identify_databases.dart b/drift_dev/lib/src/cli/commands/identify_databases.dart similarity index 95% rename from moor_generator/lib/src/cli/commands/identify_databases.dart rename to drift_dev/lib/src/cli/commands/identify_databases.dart index 444e479f..282831eb 100644 --- a/moor_generator/lib/src/cli/commands/identify_databases.dart +++ b/drift_dev/lib/src/cli/commands/identify_databases.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'dart:io'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:path/path.dart' as p; import '../cli.dart'; diff --git a/moor_generator/lib/src/cli/commands/migrate.dart b/drift_dev/lib/src/cli/commands/migrate.dart similarity index 99% rename from moor_generator/lib/src/cli/commands/migrate.dart rename to drift_dev/lib/src/cli/commands/migrate.dart index c793355c..8a226ce8 100644 --- a/moor_generator/lib/src/cli/commands/migrate.dart +++ b/drift_dev/lib/src/cli/commands/migrate.dart @@ -7,7 +7,7 @@ import 'package:analyzer/dart/analysis/results.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/visitor.dart'; import 'package:analyzer/dart/element/type.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; import 'package:path/path.dart' as p; import 'package:sqlparser/sqlparser.dart' hide AnalysisContext, StringLiteral; import 'package:yaml/yaml.dart'; diff --git a/moor_generator/lib/src/cli/commands/schema.dart b/drift_dev/lib/src/cli/commands/schema.dart similarity index 72% rename from moor_generator/lib/src/cli/commands/schema.dart rename to drift_dev/lib/src/cli/commands/schema.dart index 9c94e40d..4217930c 100644 --- a/moor_generator/lib/src/cli/commands/schema.dart +++ b/drift_dev/lib/src/cli/commands/schema.dart @@ -1,7 +1,7 @@ //@dart=2.9 import 'package:args/command_runner.dart'; -import 'package:moor_generator/src/cli/commands/schema/dump.dart'; -import 'package:moor_generator/src/cli/commands/schema/generate_utils.dart'; +import 'package:drift_dev/src/cli/commands/schema/dump.dart'; +import 'package:drift_dev/src/cli/commands/schema/generate_utils.dart'; import '../cli.dart'; diff --git a/moor_generator/lib/src/cli/commands/schema/dump.dart b/drift_dev/lib/src/cli/commands/schema/dump.dart similarity index 91% rename from moor_generator/lib/src/cli/commands/schema/dump.dart rename to drift_dev/lib/src/cli/commands/schema/dump.dart index c042e3a6..690d5995 100644 --- a/moor_generator/lib/src/cli/commands/schema/dump.dart +++ b/drift_dev/lib/src/cli/commands/schema/dump.dart @@ -3,8 +3,8 @@ import 'dart:convert'; import 'dart:io'; import 'package:args/command_runner.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/services/schema/schema_files.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/services/schema/schema_files.dart'; import '../../cli.dart'; diff --git a/moor_generator/lib/src/cli/commands/schema/generate_utils.dart b/drift_dev/lib/src/cli/commands/schema/generate_utils.dart similarity index 95% rename from moor_generator/lib/src/cli/commands/schema/generate_utils.dart rename to drift_dev/lib/src/cli/commands/schema/generate_utils.dart index f81fc47b..f6f38f91 100644 --- a/moor_generator/lib/src/cli/commands/schema/generate_utils.dart +++ b/drift_dev/lib/src/cli/commands/schema/generate_utils.dart @@ -5,10 +5,10 @@ import 'dart:io'; import 'package:analyzer/dart/analysis/features.dart'; import 'package:args/command_runner.dart'; import 'package:dart_style/dart_style.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/cli/cli.dart'; -import 'package:moor_generator/src/services/schema/schema_files.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/cli/cli.dart'; +import 'package:drift_dev/src/services/schema/schema_files.dart'; +import 'package:drift_dev/writer.dart'; import 'package:package_config/package_config.dart'; import 'package:path/path.dart' as p; import 'package:pub_semver/pub_semver.dart'; @@ -166,7 +166,7 @@ class GenerateUtilsCommand extends Command { ..writeln(_prefix) ..writeDartVersion(nnbd) ..writeln("import 'package:moor/moor.dart';") - ..writeln("import 'package:moor_generator/api/migrations.dart';"); + ..writeln("import 'package:drift_dev/api/migrations.dart';"); for (final version in versions) { buffer.writeln("import '${_filenameForVersion(version)}' as v$version;"); diff --git a/moor_generator/lib/src/cli/logging.dart b/drift_dev/lib/src/cli/logging.dart similarity index 100% rename from moor_generator/lib/src/cli/logging.dart rename to drift_dev/lib/src/cli/logging.dart diff --git a/moor_generator/lib/src/cli/project.dart b/drift_dev/lib/src/cli/project.dart similarity index 91% rename from moor_generator/lib/src/cli/project.dart rename to drift_dev/lib/src/cli/project.dart index eb5f4fe5..a356677f 100644 --- a/moor_generator/lib/src/cli/project.dart +++ b/drift_dev/lib/src/cli/project.dart @@ -2,8 +2,8 @@ import 'dart:io'; import 'package:build_config/build_config.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/utils/options_reader.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/utils/options_reader.dart'; import 'package:path/path.dart' as p; import 'package:stream_transform/stream_transform.dart'; diff --git a/moor_generator/lib/src/model/base_entity.dart b/drift_dev/lib/src/model/base_entity.dart similarity index 96% rename from moor_generator/lib/src/model/base_entity.dart rename to drift_dev/lib/src/model/base_entity.dart index d5928be0..71ef2ee0 100644 --- a/moor_generator/lib/src/model/base_entity.dart +++ b/drift_dev/lib/src/model/base_entity.dart @@ -1,8 +1,8 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/writer.dart'; /// Some schema entity found. /// diff --git a/moor_generator/lib/src/model/column.dart b/drift_dev/lib/src/model/column.dart similarity index 98% rename from moor_generator/lib/src/model/column.dart rename to drift_dev/lib/src/model/column.dart index 551f1719..687f3479 100644 --- a/moor_generator/lib/src/model/column.dart +++ b/drift_dev/lib/src/model/column.dart @@ -1,5 +1,5 @@ -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/writer.dart'; import 'declarations/declaration.dart'; import 'types.dart'; diff --git a/moor_generator/lib/src/model/database.dart b/drift_dev/lib/src/model/database.dart similarity index 93% rename from moor_generator/lib/src/model/database.dart rename to drift_dev/lib/src/model/database.dart index eedfb75d..df036932 100644 --- a/moor_generator/lib/src/model/database.dart +++ b/drift_dev/lib/src/model/database.dart @@ -1,8 +1,8 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; import 'declarations/declaration.dart'; import 'table.dart'; diff --git a/moor_generator/lib/src/model/declarations/columns.dart b/drift_dev/lib/src/model/declarations/columns.dart similarity index 100% rename from moor_generator/lib/src/model/declarations/columns.dart rename to drift_dev/lib/src/model/declarations/columns.dart diff --git a/moor_generator/lib/src/model/declarations/database.dart b/drift_dev/lib/src/model/declarations/database.dart similarity index 100% rename from moor_generator/lib/src/model/declarations/database.dart rename to drift_dev/lib/src/model/declarations/database.dart diff --git a/moor_generator/lib/src/model/declarations/declaration.dart b/drift_dev/lib/src/model/declarations/declaration.dart similarity index 89% rename from moor_generator/lib/src/model/declarations/declaration.dart rename to drift_dev/lib/src/model/declarations/declaration.dart index 77e30ee1..64b7382b 100644 --- a/moor_generator/lib/src/model/declarations/declaration.dart +++ b/drift_dev/lib/src/model/declarations/declaration.dart @@ -1,7 +1,7 @@ import 'package:analyzer/dart/element/element.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/model/sources.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/model/sources.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:sqlparser/utils/node_to_text.dart'; diff --git a/moor_generator/lib/src/model/declarations/index.dart b/drift_dev/lib/src/model/declarations/index.dart similarity index 100% rename from moor_generator/lib/src/model/declarations/index.dart rename to drift_dev/lib/src/model/declarations/index.dart diff --git a/moor_generator/lib/src/model/declarations/special_queries.dart b/drift_dev/lib/src/model/declarations/special_queries.dart similarity index 100% rename from moor_generator/lib/src/model/declarations/special_queries.dart rename to drift_dev/lib/src/model/declarations/special_queries.dart diff --git a/moor_generator/lib/src/model/declarations/tables.dart b/drift_dev/lib/src/model/declarations/tables.dart similarity index 100% rename from moor_generator/lib/src/model/declarations/tables.dart rename to drift_dev/lib/src/model/declarations/tables.dart diff --git a/moor_generator/lib/src/model/declarations/trigger.dart b/drift_dev/lib/src/model/declarations/trigger.dart similarity index 100% rename from moor_generator/lib/src/model/declarations/trigger.dart rename to drift_dev/lib/src/model/declarations/trigger.dart diff --git a/moor_generator/lib/src/model/declarations/views.dart b/drift_dev/lib/src/model/declarations/views.dart similarity index 100% rename from moor_generator/lib/src/model/declarations/views.dart rename to drift_dev/lib/src/model/declarations/views.dart diff --git a/moor_generator/lib/src/model/index.dart b/drift_dev/lib/src/model/index.dart similarity index 91% rename from moor_generator/lib/src/model/index.dart rename to drift_dev/lib/src/model/index.dart index 97f4abba..d27477ef 100644 --- a/moor_generator/lib/src/model/index.dart +++ b/drift_dev/lib/src/model/index.dart @@ -1,5 +1,5 @@ -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; import 'package:sqlparser/sqlparser.dart'; import 'model.dart'; diff --git a/moor_generator/lib/src/model/model.dart b/drift_dev/lib/src/model/model.dart similarity index 100% rename from moor_generator/lib/src/model/model.dart rename to drift_dev/lib/src/model/model.dart diff --git a/moor_generator/lib/src/model/sources.dart b/drift_dev/lib/src/model/sources.dart similarity index 93% rename from moor_generator/lib/src/model/sources.dart rename to drift_dev/lib/src/model/sources.dart index 985f9af8..c9de6280 100644 --- a/moor_generator/lib/src/model/sources.dart +++ b/drift_dev/lib/src/model/sources.dart @@ -1,5 +1,5 @@ import 'package:analyzer/dart/element/element.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; import 'package:sqlparser/sqlparser.dart'; /// Represents a single location accessible to analysis services. diff --git a/moor_generator/lib/src/model/special_queries.dart b/drift_dev/lib/src/model/special_queries.dart similarity index 90% rename from moor_generator/lib/src/model/special_queries.dart rename to drift_dev/lib/src/model/special_queries.dart index 37b2edec..1bd2fb7d 100644 --- a/moor_generator/lib/src/model/special_queries.dart +++ b/drift_dev/lib/src/model/special_queries.dart @@ -1,5 +1,5 @@ -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:sqlparser/utils/node_to_text.dart'; diff --git a/moor_generator/lib/src/model/sql_query.dart b/drift_dev/lib/src/model/sql_query.dart similarity index 98% rename from moor_generator/lib/src/model/sql_query.dart rename to drift_dev/lib/src/model/sql_query.dart index 15fd8268..80cce2ce 100644 --- a/moor_generator/lib/src/model/sql_query.dart +++ b/drift_dev/lib/src/model/sql_query.dart @@ -1,10 +1,10 @@ import 'package:collection/collection.dart'; import 'package:moor/moor.dart' show $mrjf, $mrjc, UpdateKind; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/model/base_entity.dart'; -import 'package:moor_generator/src/utils/hash.dart'; -import 'package:moor_generator/src/writer/writer.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/model/base_entity.dart'; +import 'package:drift_dev/src/utils/hash.dart'; +import 'package:drift_dev/src/writer/writer.dart'; import 'package:recase/recase.dart'; import 'package:sqlparser/sqlparser.dart'; diff --git a/moor_generator/lib/src/model/table.dart b/drift_dev/lib/src/model/table.dart similarity index 97% rename from moor_generator/lib/src/model/table.dart rename to drift_dev/lib/src/model/table.dart index 242e80cd..84beced0 100644 --- a/moor_generator/lib/src/model/table.dart +++ b/drift_dev/lib/src/model/table.dart @@ -1,8 +1,8 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:moor/moor.dart' show UpdateKind; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/model/used_type_converter.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/model/used_type_converter.dart'; +import 'package:drift_dev/writer.dart'; import 'package:recase/recase.dart'; import 'package:sqlparser/sqlparser.dart'; diff --git a/moor_generator/lib/src/model/trigger.dart b/drift_dev/lib/src/model/trigger.dart similarity index 90% rename from moor_generator/lib/src/model/trigger.dart rename to drift_dev/lib/src/model/trigger.dart index 19fe1e15..42dbc4fc 100644 --- a/moor_generator/lib/src/model/trigger.dart +++ b/drift_dev/lib/src/model/trigger.dart @@ -1,5 +1,5 @@ -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; import 'package:sqlparser/sqlparser.dart'; import 'model.dart'; diff --git a/moor_generator/lib/src/model/types.dart b/drift_dev/lib/src/model/types.dart similarity index 95% rename from moor_generator/lib/src/model/types.dart rename to drift_dev/lib/src/model/types.dart index dfaac430..b3ccadfb 100644 --- a/moor_generator/lib/src/model/types.dart +++ b/drift_dev/lib/src/model/types.dart @@ -1,6 +1,6 @@ -import 'package:moor_generator/src/model/model.dart'; -import 'package:moor_generator/src/utils/type_utils.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/src/model/model.dart'; +import 'package:drift_dev/src/utils/type_utils.dart'; +import 'package:drift_dev/writer.dart'; /// Something that has a type. /// diff --git a/moor_generator/lib/src/model/used_type_converter.dart b/drift_dev/lib/src/model/used_type_converter.dart similarity index 94% rename from moor_generator/lib/src/model/used_type_converter.dart rename to drift_dev/lib/src/model/used_type_converter.dart index b0d6598f..1747f0ef 100644 --- a/moor_generator/lib/src/model/used_type_converter.dart +++ b/drift_dev/lib/src/model/used_type_converter.dart @@ -1,9 +1,9 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; -import 'package:moor_generator/src/model/table.dart'; -import 'package:moor_generator/src/utils/type_utils.dart'; -import 'package:moor_generator/src/writer/writer.dart'; +import 'package:drift_dev/src/model/table.dart'; +import 'package:drift_dev/src/utils/type_utils.dart'; +import 'package:drift_dev/src/writer/writer.dart'; import 'column.dart'; import 'types.dart'; diff --git a/moor_generator/lib/src/model/view.dart b/drift_dev/lib/src/model/view.dart similarity index 90% rename from moor_generator/lib/src/model/view.dart rename to drift_dev/lib/src/model/view.dart index 77e5f063..66bb2087 100644 --- a/moor_generator/lib/src/model/view.dart +++ b/drift_dev/lib/src/model/view.dart @@ -1,7 +1,7 @@ -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/utils/names.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/utils/names.dart'; import 'package:recase/recase.dart'; import 'package:sqlparser/sqlparser.dart'; diff --git a/moor_generator/lib/src/services/find_stream_update_rules.dart b/drift_dev/lib/src/services/find_stream_update_rules.dart similarity index 98% rename from moor_generator/lib/src/services/find_stream_update_rules.dart rename to drift_dev/lib/src/services/find_stream_update_rules.dart index 232f2ed8..7fdd9d62 100644 --- a/moor_generator/lib/src/services/find_stream_update_rules.dart +++ b/drift_dev/lib/src/services/find_stream_update_rules.dart @@ -1,6 +1,6 @@ import 'package:collection/collection.dart'; import 'package:moor/moor.dart'; -import 'package:moor_generator/moor_generator.dart'; +import 'package:drift_dev/moor_generator.dart'; import 'package:sqlparser/sqlparser.dart'; class FindStreamUpdateRules { diff --git a/moor_generator/lib/src/services/ide/assists/assist_service.dart b/drift_dev/lib/src/services/ide/assists/assist_service.dart similarity index 96% rename from moor_generator/lib/src/services/ide/assists/assist_service.dart rename to drift_dev/lib/src/services/ide/assists/assist_service.dart index 71f222e2..bdb285aa 100644 --- a/moor_generator/lib/src/services/ide/assists/assist_service.dart +++ b/drift_dev/lib/src/services/ide/assists/assist_service.dart @@ -2,7 +2,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:analyzer_plugin/protocol/protocol_generated.dart'; import 'package:analyzer_plugin/utilities/assist/assist.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; import 'package:sqlparser/sqlparser.dart'; import '../utils.dart'; diff --git a/moor_generator/lib/src/services/ide/assists/column_nullability.dart b/drift_dev/lib/src/services/ide/assists/column_nullability.dart similarity index 100% rename from moor_generator/lib/src/services/ide/assists/column_nullability.dart rename to drift_dev/lib/src/services/ide/assists/column_nullability.dart diff --git a/moor_generator/lib/src/services/ide/highlights.dart b/drift_dev/lib/src/services/ide/highlights.dart similarity index 98% rename from moor_generator/lib/src/services/ide/highlights.dart rename to drift_dev/lib/src/services/ide/highlights.dart index 09837ffd..7e3214b5 100644 --- a/moor_generator/lib/src/services/ide/highlights.dart +++ b/drift_dev/lib/src/services/ide/highlights.dart @@ -1,6 +1,6 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; import 'package:sqlparser/sqlparser.dart'; import 'utils.dart'; diff --git a/moor_generator/lib/src/services/ide/moor_ide.dart b/drift_dev/lib/src/services/ide/moor_ide.dart similarity index 90% rename from moor_generator/lib/src/services/ide/moor_ide.dart rename to drift_dev/lib/src/services/ide/moor_ide.dart index 78e62f74..4a069e4c 100644 --- a/moor_generator/lib/src/services/ide/moor_ide.dart +++ b/drift_dev/lib/src/services/ide/moor_ide.dart @@ -1,8 +1,8 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:analyzer_plugin/protocol/protocol_generated.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; -import 'package:moor_generator/src/services/ide/assists/assist_service.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; +import 'package:drift_dev/src/services/ide/assists/assist_service.dart'; import 'package:path/path.dart'; diff --git a/moor_generator/lib/src/services/ide/utils.dart b/drift_dev/lib/src/services/ide/utils.dart similarity index 62% rename from moor_generator/lib/src/services/ide/utils.dart rename to drift_dev/lib/src/services/ide/utils.dart index 4cde75fc..0fce756c 100644 --- a/moor_generator/lib/src/services/ide/utils.dart +++ b/drift_dev/lib/src/services/ide/utils.dart @@ -1,6 +1,6 @@ //@dart=2.9 -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; extension CurrentResults on FoundFile { ParsedMoorFile get parsedMoorOrNull { diff --git a/moor_generator/lib/src/services/schema/find_differences.dart b/drift_dev/lib/src/services/schema/find_differences.dart similarity index 99% rename from moor_generator/lib/src/services/schema/find_differences.dart rename to drift_dev/lib/src/services/schema/find_differences.dart index 731bc003..59afa2da 100644 --- a/moor_generator/lib/src/services/schema/find_differences.dart +++ b/drift_dev/lib/src/services/schema/find_differences.dart @@ -1,4 +1,4 @@ -import 'package:moor_generator/src/analyzer/moor/moor_ffi_extension.dart'; +import 'package:drift_dev/src/analyzer/moor/moor_ffi_extension.dart'; import 'package:sqlparser/sqlparser.dart'; // ignore: implementation_imports import 'package:sqlparser/src/utils/ast_equality.dart'; diff --git a/moor_generator/lib/src/services/schema/schema_files.dart b/drift_dev/lib/src/services/schema/schema_files.dart similarity index 98% rename from moor_generator/lib/src/services/schema/schema_files.dart rename to drift_dev/lib/src/services/schema/schema_files.dart index acf89318..c6430fac 100644 --- a/moor_generator/lib/src/services/schema/schema_files.dart +++ b/drift_dev/lib/src/services/schema/schema_files.dart @@ -1,6 +1,6 @@ //@dart=2.9 -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; import 'package:recase/recase.dart'; import 'package:sqlparser/sqlparser.dart'; diff --git a/moor_generator/lib/src/services/schema/verifier_impl.dart b/drift_dev/lib/src/services/schema/verifier_impl.dart similarity index 98% rename from moor_generator/lib/src/services/schema/verifier_impl.dart rename to drift_dev/lib/src/services/schema/verifier_impl.dart index e2a87601..a6f206ed 100644 --- a/moor_generator/lib/src/services/schema/verifier_impl.dart +++ b/drift_dev/lib/src/services/schema/verifier_impl.dart @@ -2,7 +2,7 @@ import 'dart:math'; import 'package:moor/ffi.dart'; import 'package:moor/moor.dart'; -import 'package:moor_generator/api/migrations.dart'; +import 'package:drift_dev/api/migrations.dart'; import 'package:sqlite3/sqlite3.dart'; import 'find_differences.dart'; diff --git a/moor_generator/lib/src/utils/entity_reference_sorter.dart b/drift_dev/lib/src/utils/entity_reference_sorter.dart similarity index 98% rename from moor_generator/lib/src/utils/entity_reference_sorter.dart rename to drift_dev/lib/src/utils/entity_reference_sorter.dart index 0d32b4bd..14d1211f 100644 --- a/moor_generator/lib/src/utils/entity_reference_sorter.dart +++ b/drift_dev/lib/src/utils/entity_reference_sorter.dart @@ -1,4 +1,4 @@ -import 'package:moor_generator/moor_generator.dart'; +import 'package:drift_dev/moor_generator.dart'; /// Topologically sorts a list of [MoorSchemaEntity]s by their /// [MoorSchemaEntity.references] relationship: Tables appearing first in the diff --git a/moor_generator/lib/src/utils/hash.dart b/drift_dev/lib/src/utils/hash.dart similarity index 100% rename from moor_generator/lib/src/utils/hash.dart rename to drift_dev/lib/src/utils/hash.dart diff --git a/moor_generator/lib/src/utils/names.dart b/drift_dev/lib/src/utils/names.dart similarity index 100% rename from moor_generator/lib/src/utils/names.dart rename to drift_dev/lib/src/utils/names.dart diff --git a/moor_generator/lib/src/utils/options_reader.dart b/drift_dev/lib/src/utils/options_reader.dart similarity index 90% rename from moor_generator/lib/src/utils/options_reader.dart rename to drift_dev/lib/src/utils/options_reader.dart index dd54148b..cad6a5a1 100644 --- a/moor_generator/lib/src/utils/options_reader.dart +++ b/drift_dev/lib/src/utils/options_reader.dart @@ -1,5 +1,5 @@ import 'package:build_config/build_config.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; Future fromRootDir(String path) async { final options = await BuildConfig.fromPackageDir(path); diff --git a/moor_generator/lib/src/utils/string_escaper.dart b/drift_dev/lib/src/utils/string_escaper.dart similarity index 100% rename from moor_generator/lib/src/utils/string_escaper.dart rename to drift_dev/lib/src/utils/string_escaper.dart diff --git a/moor_generator/lib/src/utils/type_converter_hint.dart b/drift_dev/lib/src/utils/type_converter_hint.dart similarity index 70% rename from moor_generator/lib/src/utils/type_converter_hint.dart rename to drift_dev/lib/src/utils/type_converter_hint.dart index ae0cf867..b05e6e75 100644 --- a/moor_generator/lib/src/utils/type_converter_hint.dart +++ b/drift_dev/lib/src/utils/type_converter_hint.dart @@ -1,4 +1,4 @@ -import 'package:moor_generator/src/model/used_type_converter.dart'; +import 'package:drift_dev/src/model/used_type_converter.dart'; import 'package:sqlparser/sqlparser.dart'; class TypeConverterHint extends TypeHint { diff --git a/moor_generator/lib/src/utils/type_utils.dart b/drift_dev/lib/src/utils/type_utils.dart similarity index 76% rename from moor_generator/lib/src/utils/type_utils.dart rename to drift_dev/lib/src/utils/type_utils.dart index ae27377c..7b5c1d61 100644 --- a/moor_generator/lib/src/utils/type_utils.dart +++ b/drift_dev/lib/src/utils/type_utils.dart @@ -1,10 +1,13 @@ import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; -import 'package:moor_generator/src/writer/writer.dart'; +import 'package:drift_dev/src/writer/writer.dart'; bool isFromMoor(DartType type) { - return type.element?.library?.location?.components.first.contains('moor') ?? - false; + final firstComponent = type.element?.library?.location?.components.first; + + if (firstComponent == null) return false; + + return firstComponent.contains('drift') || firstComponent.contains('moor'); } bool isColumn(DartType type) { diff --git a/moor_generator/lib/src/writer/database_writer.dart b/drift_dev/lib/src/writer/database_writer.dart similarity index 95% rename from moor_generator/lib/src/writer/database_writer.dart rename to drift_dev/lib/src/writer/database_writer.dart index bc17a669..0568678a 100644 --- a/moor_generator/lib/src/writer/database_writer.dart +++ b/drift_dev/lib/src/writer/database_writer.dart @@ -1,11 +1,11 @@ // ignore: implementation_imports import 'package:drift/src/runtime/executor/stream_queries.dart'; import 'package:moor/moor.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/services/find_stream_update_rules.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; -import 'package:moor_generator/src/utils/type_utils.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/services/find_stream_update_rules.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; +import 'package:drift_dev/src/utils/type_utils.dart'; +import 'package:drift_dev/writer.dart'; import 'package:recase/recase.dart'; import 'tables/view_writer.dart'; diff --git a/moor_generator/lib/src/writer/queries/query_writer.dart b/drift_dev/lib/src/writer/queries/query_writer.dart similarity index 98% rename from moor_generator/lib/src/writer/queries/query_writer.dart rename to drift_dev/lib/src/writer/queries/query_writer.dart index 95d382f3..0a4e49d6 100644 --- a/moor_generator/lib/src/writer/queries/query_writer.dart +++ b/drift_dev/lib/src/writer/queries/query_writer.dart @@ -1,11 +1,11 @@ import 'dart:math' show max; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/explicit_alias_transformer.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/explicit_alias_transformer.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; +import 'package:drift_dev/writer.dart'; import 'package:recase/recase.dart'; import 'package:sqlparser/sqlparser.dart' hide ResultColumn; import 'package:sqlparser/utils/node_to_text.dart'; diff --git a/moor_generator/lib/src/writer/queries/result_set_writer.dart b/drift_dev/lib/src/writer/queries/result_set_writer.dart similarity index 90% rename from moor_generator/lib/src/writer/queries/result_set_writer.dart rename to drift_dev/lib/src/writer/queries/result_set_writer.dart index 3e0196fc..6e53bbe9 100644 --- a/moor_generator/lib/src/writer/queries/result_set_writer.dart +++ b/drift_dev/lib/src/writer/queries/result_set_writer.dart @@ -1,7 +1,7 @@ -import 'package:moor_generator/src/model/sql_query.dart'; -import 'package:moor_generator/src/model/types.dart'; -import 'package:moor_generator/src/writer/utils/override_toString.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; +import 'package:drift_dev/src/model/types.dart'; +import 'package:drift_dev/src/writer/utils/override_toString.dart'; +import 'package:drift_dev/writer.dart'; /// Writes a class holding the result of an sql query into Dart. class ResultSetWriter { diff --git a/moor_generator/lib/src/writer/queries/sql_writer.dart b/drift_dev/lib/src/writer/queries/sql_writer.dart similarity index 97% rename from moor_generator/lib/src/writer/queries/sql_writer.dart rename to drift_dev/lib/src/writer/queries/sql_writer.dart index 9cead3f7..6c9fde1a 100644 --- a/moor_generator/lib/src/writer/queries/sql_writer.dart +++ b/drift_dev/lib/src/writer/queries/sql_writer.dart @@ -1,7 +1,7 @@ import 'package:charcode/ascii.dart'; import 'package:collection/collection.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:sqlparser/utils/node_to_text.dart'; diff --git a/moor_generator/lib/src/writer/tables/data_class_writer.dart b/drift_dev/lib/src/writer/tables/data_class_writer.dart similarity index 97% rename from moor_generator/lib/src/writer/tables/data_class_writer.dart rename to drift_dev/lib/src/writer/tables/data_class_writer.dart index ee0e48f6..e45d3ee9 100644 --- a/moor_generator/lib/src/writer/tables/data_class_writer.dart +++ b/drift_dev/lib/src/writer/tables/data_class_writer.dart @@ -1,7 +1,7 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; -import 'package:moor_generator/src/writer/utils/override_toString.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; +import 'package:drift_dev/src/writer/utils/override_toString.dart'; +import 'package:drift_dev/writer.dart'; class DataClassWriter { final MoorEntityWithResultSet table; diff --git a/moor_generator/lib/src/writer/tables/table_writer.dart b/drift_dev/lib/src/writer/tables/table_writer.dart similarity index 97% rename from moor_generator/lib/src/writer/tables/table_writer.dart rename to drift_dev/lib/src/writer/tables/table_writer.dart index dd6b6aec..59342cc9 100644 --- a/moor_generator/lib/src/writer/tables/table_writer.dart +++ b/drift_dev/lib/src/writer/tables/table_writer.dart @@ -1,9 +1,9 @@ import 'package:moor/sqlite_keywords.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/model/declarations/declaration.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; -import 'package:moor_generator/src/utils/type_utils.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/model/declarations/declaration.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; +import 'package:drift_dev/src/utils/type_utils.dart'; +import 'package:drift_dev/writer.dart'; import 'package:sqlparser/sqlparser.dart'; /// Common writer for tables or views. diff --git a/moor_generator/lib/src/writer/tables/update_companion_writer.dart b/drift_dev/lib/src/writer/tables/update_companion_writer.dart similarity index 96% rename from moor_generator/lib/src/writer/tables/update_companion_writer.dart rename to drift_dev/lib/src/writer/tables/update_companion_writer.dart index 3dd8b542..41622966 100644 --- a/moor_generator/lib/src/writer/tables/update_companion_writer.dart +++ b/drift_dev/lib/src/writer/tables/update_companion_writer.dart @@ -1,7 +1,7 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; -import 'package:moor_generator/src/writer/utils/override_toString.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; +import 'package:drift_dev/src/writer/utils/override_toString.dart'; +import 'package:drift_dev/writer.dart'; class UpdateCompanionWriter { final MoorTable table; diff --git a/moor_generator/lib/src/writer/tables/view_writer.dart b/drift_dev/lib/src/writer/tables/view_writer.dart similarity index 91% rename from moor_generator/lib/src/writer/tables/view_writer.dart rename to drift_dev/lib/src/writer/tables/view_writer.dart index b88c125f..4126bdb1 100644 --- a/moor_generator/lib/src/writer/tables/view_writer.dart +++ b/drift_dev/lib/src/writer/tables/view_writer.dart @@ -1,5 +1,5 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/utils/string_escaper.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; import '../writer.dart'; import 'data_class_writer.dart'; diff --git a/moor_generator/lib/src/writer/utils/hash_code.dart b/drift_dev/lib/src/writer/utils/hash_code.dart similarity index 100% rename from moor_generator/lib/src/writer/utils/hash_code.dart rename to drift_dev/lib/src/writer/utils/hash_code.dart diff --git a/moor_generator/lib/src/writer/utils/memoized_getter.dart b/drift_dev/lib/src/writer/utils/memoized_getter.dart similarity index 97% rename from moor_generator/lib/src/writer/utils/memoized_getter.dart rename to drift_dev/lib/src/writer/utils/memoized_getter.dart index 681d661a..b2ac1c2d 100644 --- a/moor_generator/lib/src/writer/utils/memoized_getter.dart +++ b/drift_dev/lib/src/writer/utils/memoized_getter.dart @@ -1,4 +1,4 @@ -import 'package:moor_generator/src/writer/writer.dart'; +import 'package:drift_dev/src/writer/writer.dart'; import 'package:recase/recase.dart'; /// Writes the following dart code into the [buffer]: diff --git a/moor_generator/lib/src/writer/utils/override_equals.dart b/drift_dev/lib/src/writer/utils/override_equals.dart similarity index 100% rename from moor_generator/lib/src/writer/utils/override_equals.dart rename to drift_dev/lib/src/writer/utils/override_equals.dart diff --git a/moor_generator/lib/src/writer/utils/override_toString.dart b/drift_dev/lib/src/writer/utils/override_toString.dart similarity index 100% rename from moor_generator/lib/src/writer/utils/override_toString.dart rename to drift_dev/lib/src/writer/utils/override_toString.dart diff --git a/moor_generator/lib/src/writer/writer.dart b/drift_dev/lib/src/writer/writer.dart similarity index 97% rename from moor_generator/lib/src/writer/writer.dart rename to drift_dev/lib/src/writer/writer.dart index 66fbd756..7fb5e2db 100644 --- a/moor_generator/lib/src/writer/writer.dart +++ b/drift_dev/lib/src/writer/writer.dart @@ -1,5 +1,5 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; /// Manages a tree structure which we use to generate code. /// diff --git a/drift_dev/lib/writer.dart b/drift_dev/lib/writer.dart new file mode 100644 index 00000000..8765fd01 --- /dev/null +++ b/drift_dev/lib/writer.dart @@ -0,0 +1,16 @@ +/// Provides access to the [Writer], which can generate Dart code for parsed +/// databases, daos, queries, tables and more. +library writer; + +import 'src/writer/writer.dart' show Writer; + +export 'src/writer/database_writer.dart'; +export 'src/writer/queries/query_writer.dart'; +export 'src/writer/queries/result_set_writer.dart'; +export 'src/writer/tables/data_class_writer.dart'; +export 'src/writer/tables/table_writer.dart'; +export 'src/writer/tables/update_companion_writer.dart'; +export 'src/writer/utils/hash_code.dart'; +export 'src/writer/utils/memoized_getter.dart'; +export 'src/writer/utils/override_equals.dart'; +export 'src/writer/writer.dart'; diff --git a/drift_dev/pubspec.yaml b/drift_dev/pubspec.yaml new file mode 100644 index 00000000..172392bb --- /dev/null +++ b/drift_dev/pubspec.yaml @@ -0,0 +1,64 @@ +name: drift_dev +description: Dev-dependency for users of drift. Contains a the generator and development tools. +version: 4.5.1 +repository: https://github.com/simolus3/moor +homepage: https://moor.simonbinder.eu/ +issue_tracker: https://github.com/simolus3/moor/issues + +environment: + sdk: '>=2.12.0 <3.0.0' + +dependencies: + charcode: ^1.2.0 + collection: ^1.14.0 + recase: '>=2.0.1 <5.0.0' + meta: ^1.1.0 + path: ^1.6.0 + json_annotation: ^4.1.0 + stream_transform: '>=0.1.0 <3.0.0' + + # CLI + args: ">=1.5.0 <3.0.0" + logging: '>=0.11.0 <2.0.0' + cli_util: '>=0.2.0 <0.4.0' + yaml_edit: ^2.0.1 + yaml: ^3.1.0 + + # Moor-specific analysis and apis + moor: ^4.4.0 + drift: ^4.6.0 + sqlite3: '>=0.1.6 <2.0.0' + sqlparser: ^0.17.0 + + # Dart analysis + analyzer: "^2.1.0" + analyzer_plugin: ^0.7.0 + source_span: ^1.5.5 + package_config: ^2.0.0 + pub_semver: ^2.0.0 + + # Build system + build: ^2.0.0 + build_resolvers: ^2.0.0 + build_config: '>=0.3.1 <2.0.0' + dart_style: '>=1.3.3 <3.0.0' + source_gen: '>=0.9.4 <2.0.0' + +dev_dependencies: + checked_yaml: ^2.0.1 + test: ^1.16.0 + test_descriptor: ^2.0.0 + build_runner: ^2.0.0 + build_test: ^2.0.0 + json_serializable: ^5.0.0 + +executables: + moor_generator: + +dependency_overrides: + drift: + path: ../drift + sqlparser: + path: ../sqlparser + moor: + path: ../moor diff --git a/moor_generator/test/analyzer/cyclic_moor_dart_dependency_test.dart b/drift_dev/test/analyzer/cyclic_moor_dart_dependency_test.dart similarity index 87% rename from moor_generator/test/analyzer/cyclic_moor_dart_dependency_test.dart rename to drift_dev/test/analyzer/cyclic_moor_dart_dependency_test.dart index ccfe14b2..b8e870f5 100644 --- a/moor_generator/test/analyzer/cyclic_moor_dart_dependency_test.dart +++ b/drift_dev/test/analyzer/cyclic_moor_dart_dependency_test.dart @@ -1,9 +1,9 @@ //@dart=2.9 @Tags(['analyzer']) import 'package:build/build.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; import 'package:test/test.dart'; import '../utils/test_backend.dart'; diff --git a/moor_generator/test/analyzer/dart/custom_row_classes_test.dart b/drift_dev/test/analyzer/dart/custom_row_classes_test.dart similarity index 96% rename from moor_generator/test/analyzer/dart/custom_row_classes_test.dart rename to drift_dev/test/analyzer/dart/custom_row_classes_test.dart index 73e93b15..aa22066c 100644 --- a/moor_generator/test/analyzer/dart/custom_row_classes_test.dart +++ b/drift_dev/test/analyzer/dart/custom_row_classes_test.dart @@ -1,8 +1,8 @@ @Tags(['analyzer']) import 'package:analyzer/dart/element/type.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/model/base_entity.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/model/base_entity.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/dart/dart_test.dart b/drift_dev/test/analyzer/dart/dart_test.dart similarity index 90% rename from moor_generator/test/analyzer/dart/dart_test.dart rename to drift_dev/test/analyzer/dart/dart_test.dart index e80468d9..c1bcea42 100644 --- a/moor_generator/test/analyzer/dart/dart_test.dart +++ b/drift_dev/test/analyzer/dart/dart_test.dart @@ -4,9 +4,9 @@ import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:build/build.dart'; -import 'package:moor_generator/src/analyzer/dart/parser.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; +import 'package:drift_dev/src/analyzer/dart/parser.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; import 'package:test/test.dart'; import '../../utils/test_backend.dart'; diff --git a/moor_generator/test/analyzer/dart/enum_columns_test.dart b/drift_dev/test/analyzer/dart/enum_columns_test.dart similarity index 88% rename from moor_generator/test/analyzer/dart/enum_columns_test.dart rename to drift_dev/test/analyzer/dart/enum_columns_test.dart index f1fe8796..85227f23 100644 --- a/moor_generator/test/analyzer/dart/enum_columns_test.dart +++ b/drift_dev/test/analyzer/dart/enum_columns_test.dart @@ -1,8 +1,8 @@ //@dart=2.9 @Tags(['analyzer']) -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/dart/regression_1172_test.dart b/drift_dev/test/analyzer/dart/regression_1172_test.dart similarity index 100% rename from moor_generator/test/analyzer/dart/regression_1172_test.dart rename to drift_dev/test/analyzer/dart/regression_1172_test.dart diff --git a/moor_generator/test/analyzer/dart/table_parser_test.dart b/drift_dev/test/analyzer/dart/table_parser_test.dart similarity index 97% rename from moor_generator/test/analyzer/dart/table_parser_test.dart rename to drift_dev/test/analyzer/dart/table_parser_test.dart index e1bca816..61ba3163 100644 --- a/moor_generator/test/analyzer/dart/table_parser_test.dart +++ b/drift_dev/test/analyzer/dart/table_parser_test.dart @@ -3,11 +3,11 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:build/build.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/dart/parser.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/dart/parser.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; import 'package:test/test.dart'; import '../../utils/test_backend.dart'; diff --git a/moor_generator/test/analyzer/integration/dao_inheritance_test.dart b/drift_dev/test/analyzer/integration/dao_inheritance_test.dart similarity index 95% rename from moor_generator/test/analyzer/integration/dao_inheritance_test.dart rename to drift_dev/test/analyzer/integration/dao_inheritance_test.dart index 874f39ee..4d6140f5 100644 --- a/moor_generator/test/analyzer/integration/dao_inheritance_test.dart +++ b/drift_dev/test/analyzer/integration/dao_inheritance_test.dart @@ -1,6 +1,6 @@ //@dart=2.9 @Tags(['analyzer']) -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/integration/duplicate_tables_test.dart b/drift_dev/test/analyzer/integration/duplicate_tables_test.dart similarity index 92% rename from moor_generator/test/analyzer/integration/duplicate_tables_test.dart rename to drift_dev/test/analyzer/integration/duplicate_tables_test.dart index 67a5f636..5d1aac9f 100644 --- a/moor_generator/test/analyzer/integration/duplicate_tables_test.dart +++ b/drift_dev/test/analyzer/integration/duplicate_tables_test.dart @@ -1,5 +1,5 @@ //@dart=2.9 -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/integration/integration_test.dart b/drift_dev/test/analyzer/integration/integration_test.dart similarity index 93% rename from moor_generator/test/analyzer/integration/integration_test.dart rename to drift_dev/test/analyzer/integration/integration_test.dart index 03480059..a7072c0f 100644 --- a/moor_generator/test/analyzer/integration/integration_test.dart +++ b/drift_dev/test/analyzer/integration/integration_test.dart @@ -1,9 +1,9 @@ //@dart=2.9 @Tags(['analyzer']) -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/moor/cfe_test.dart b/drift_dev/test/analyzer/moor/cfe_test.dart similarity index 85% rename from moor_generator/test/analyzer/moor/cfe_test.dart rename to drift_dev/test/analyzer/moor/cfe_test.dart index ee4f3440..374d5b4e 100644 --- a/moor_generator/test/analyzer/moor/cfe_test.dart +++ b/drift_dev/test/analyzer/moor/cfe_test.dart @@ -1,11 +1,11 @@ //@dart=2.9 import 'package:build/build.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/runner/task.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/task.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; import 'package:test/test.dart'; import '../../utils/test_backend.dart'; diff --git a/moor_generator/test/analyzer/moor/create_table_reader_test.dart b/drift_dev/test/analyzer/moor/create_table_reader_test.dart similarity index 96% rename from moor_generator/test/analyzer/moor/create_table_reader_test.dart rename to drift_dev/test/analyzer/moor/create_table_reader_test.dart index 806fd3e1..7ebb2f31 100644 --- a/moor_generator/test/analyzer/moor/create_table_reader_test.dart +++ b/drift_dev/test/analyzer/moor/create_table_reader_test.dart @@ -1,7 +1,7 @@ //@dart=2.9 @Tags(['analyzer']) -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/moor/create_view_test.dart b/drift_dev/test/analyzer/moor/create_view_test.dart similarity index 96% rename from moor_generator/test/analyzer/moor/create_view_test.dart rename to drift_dev/test/analyzer/moor/create_view_test.dart index 8477529a..5aeca04b 100644 --- a/moor_generator/test/analyzer/moor/create_view_test.dart +++ b/drift_dev/test/analyzer/moor/create_view_test.dart @@ -1,7 +1,7 @@ //@dart=2.9 @Tags(['analyzer']) -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/model/table.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/model/table.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/moor/custom_row_classes_test.dart b/drift_dev/test/analyzer/moor/custom_row_classes_test.dart similarity index 96% rename from moor_generator/test/analyzer/moor/custom_row_classes_test.dart rename to drift_dev/test/analyzer/moor/custom_row_classes_test.dart index 75978c25..3eb219a9 100644 --- a/moor_generator/test/analyzer/moor/custom_row_classes_test.dart +++ b/drift_dev/test/analyzer/moor/custom_row_classes_test.dart @@ -1,7 +1,7 @@ // @dart=2.9 import 'package:analyzer/dart/element/type.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/scaffolding.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/moor/entity_handler_test.dart b/drift_dev/test/analyzer/moor/entity_handler_test.dart similarity index 98% rename from moor_generator/test/analyzer/moor/entity_handler_test.dart rename to drift_dev/test/analyzer/moor/entity_handler_test.dart index a44d0ec9..2731234e 100644 --- a/moor_generator/test/analyzer/moor/entity_handler_test.dart +++ b/drift_dev/test/analyzer/moor/entity_handler_test.dart @@ -1,5 +1,5 @@ //@dart=2.9 -import 'package:moor_generator/moor_generator.dart'; +import 'package:drift_dev/moor_generator.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/moor/errors_when_importing_part_files_test.dart b/drift_dev/test/analyzer/moor/errors_when_importing_part_files_test.dart similarity index 95% rename from moor_generator/test/analyzer/moor/errors_when_importing_part_files_test.dart rename to drift_dev/test/analyzer/moor/errors_when_importing_part_files_test.dart index 2cc2de88..272ebe84 100644 --- a/moor_generator/test/analyzer/moor/errors_when_importing_part_files_test.dart +++ b/drift_dev/test/analyzer/moor/errors_when_importing_part_files_test.dart @@ -1,6 +1,6 @@ //@dart=2.9 @Tags(['analyzer']) -import 'package:moor_generator/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/moor/moor_ffi_extension_test.dart b/drift_dev/test/analyzer/moor/moor_ffi_extension_test.dart similarity index 91% rename from moor_generator/test/analyzer/moor/moor_ffi_extension_test.dart rename to drift_dev/test/analyzer/moor/moor_ffi_extension_test.dart index 0dcebd4d..bd7f2203 100644 --- a/moor_generator/test/analyzer/moor/moor_ffi_extension_test.dart +++ b/drift_dev/test/analyzer/moor/moor_ffi_extension_test.dart @@ -1,9 +1,9 @@ //@dart=2.9 -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/moor/moor_ffi_extension.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/moor/moor_ffi_extension.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:sqlparser/sqlparser.dart' hide ResultColumn; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/moor/moor_parser_test.dart b/drift_dev/test/analyzer/moor/moor_parser_test.dart similarity index 91% rename from moor_generator/test/analyzer/moor/moor_parser_test.dart rename to drift_dev/test/analyzer/moor/moor_parser_test.dart index 3769939d..0d6d60db 100644 --- a/moor_generator/test/analyzer/moor/moor_parser_test.dart +++ b/drift_dev/test/analyzer/moor/moor_parser_test.dart @@ -1,9 +1,9 @@ //@dart=2.9 import 'package:build/build.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; -import 'package:moor_generator/src/model/types.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; +import 'package:drift_dev/src/model/types.dart'; import 'package:test/test.dart'; import '../../utils/test_backend.dart'; diff --git a/moor_generator/test/analyzer/moor/regression_1138_test.dart b/drift_dev/test/analyzer/moor/regression_1138_test.dart similarity index 95% rename from moor_generator/test/analyzer/moor/regression_1138_test.dart rename to drift_dev/test/analyzer/moor/regression_1138_test.dart index ba0f1a51..e9f3cba2 100644 --- a/moor_generator/test/analyzer/moor/regression_1138_test.dart +++ b/drift_dev/test/analyzer/moor/regression_1138_test.dart @@ -1,5 +1,5 @@ // @dart=2.9 -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/moor/regression_754_test.dart b/drift_dev/test/analyzer/moor/regression_754_test.dart similarity index 95% rename from moor_generator/test/analyzer/moor/regression_754_test.dart rename to drift_dev/test/analyzer/moor/regression_754_test.dart index d0e6be47..8bf2871c 100644 --- a/moor_generator/test/analyzer/moor/regression_754_test.dart +++ b/drift_dev/test/analyzer/moor/regression_754_test.dart @@ -1,5 +1,5 @@ //@dart=2.9 -import 'package:moor_generator/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/moor/sqlite_version_test.dart b/drift_dev/test/analyzer/moor/sqlite_version_test.dart similarity index 92% rename from moor_generator/test/analyzer/moor/sqlite_version_test.dart rename to drift_dev/test/analyzer/moor/sqlite_version_test.dart index bd229c75..073617a4 100644 --- a/moor_generator/test/analyzer/moor/sqlite_version_test.dart +++ b/drift_dev/test/analyzer/moor/sqlite_version_test.dart @@ -1,6 +1,6 @@ //@dart=2.9 -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/moor/virtual_table_test.dart b/drift_dev/test/analyzer/moor/virtual_table_test.dart similarity index 95% rename from moor_generator/test/analyzer/moor/virtual_table_test.dart rename to drift_dev/test/analyzer/moor/virtual_table_test.dart index 80d1b5fc..f41325a0 100644 --- a/moor_generator/test/analyzer/moor/virtual_table_test.dart +++ b/drift_dev/test/analyzer/moor/virtual_table_test.dart @@ -1,4 +1,4 @@ -import 'package:moor_generator/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; import 'package:test/scaffolding.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/options_test.dart b/drift_dev/test/analyzer/options_test.dart similarity index 96% rename from moor_generator/test/analyzer/options_test.dart rename to drift_dev/test/analyzer/options_test.dart index c0d487e6..7a61d025 100644 --- a/moor_generator/test/analyzer/options_test.dart +++ b/drift_dev/test/analyzer/options_test.dart @@ -1,5 +1,5 @@ import 'package:checked_yaml/checked_yaml.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/repro_1280_test.dart b/drift_dev/test/analyzer/repro_1280_test.dart similarity index 95% rename from moor_generator/test/analyzer/repro_1280_test.dart rename to drift_dev/test/analyzer/repro_1280_test.dart index ab509fec..3291e2b0 100644 --- a/moor_generator/test/analyzer/repro_1280_test.dart +++ b/drift_dev/test/analyzer/repro_1280_test.dart @@ -1,5 +1,5 @@ // @dart=2.9 -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/test.dart'; import 'utils.dart'; diff --git a/moor_generator/test/analyzer/repro_967_test.dart b/drift_dev/test/analyzer/repro_967_test.dart similarity index 91% rename from moor_generator/test/analyzer/repro_967_test.dart rename to drift_dev/test/analyzer/repro_967_test.dart index 2413ad21..6cca674b 100644 --- a/moor_generator/test/analyzer/repro_967_test.dart +++ b/drift_dev/test/analyzer/repro_967_test.dart @@ -1,5 +1,5 @@ //@dart=2.9 -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/test.dart'; import 'utils.dart'; diff --git a/moor_generator/test/analyzer/runner/task_test.dart b/drift_dev/test/analyzer/runner/task_test.dart similarity index 95% rename from moor_generator/test/analyzer/runner/task_test.dart rename to drift_dev/test/analyzer/runner/task_test.dart index 27dcc975..35dcb7a2 100644 --- a/moor_generator/test/analyzer/runner/task_test.dart +++ b/drift_dev/test/analyzer/runner/task_test.dart @@ -1,5 +1,5 @@ //@dart=2.9 -import 'package:moor_generator/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/sql_queries/custom_result_class_test.dart b/drift_dev/test/analyzer/sql_queries/custom_result_class_test.dart similarity index 90% rename from moor_generator/test/analyzer/sql_queries/custom_result_class_test.dart rename to drift_dev/test/analyzer/sql_queries/custom_result_class_test.dart index 737f4b0c..ee738a7f 100644 --- a/moor_generator/test/analyzer/sql_queries/custom_result_class_test.dart +++ b/drift_dev/test/analyzer/sql_queries/custom_result_class_test.dart @@ -1,7 +1,7 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/custom_result_class.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/custom_result_class.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/sql_queries/explicit_alias_transformer_test.dart b/drift_dev/test/analyzer/sql_queries/explicit_alias_transformer_test.dart similarity index 96% rename from moor_generator/test/analyzer/sql_queries/explicit_alias_transformer_test.dart rename to drift_dev/test/analyzer/sql_queries/explicit_alias_transformer_test.dart index 15d08575..362a0a92 100644 --- a/moor_generator/test/analyzer/sql_queries/explicit_alias_transformer_test.dart +++ b/drift_dev/test/analyzer/sql_queries/explicit_alias_transformer_test.dart @@ -1,4 +1,4 @@ -import 'package:moor_generator/src/analyzer/sql_queries/explicit_alias_transformer.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/explicit_alias_transformer.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:sqlparser/utils/node_to_text.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/sql_queries/inference_test.dart b/drift_dev/test/analyzer/sql_queries/inference_test.dart similarity index 89% rename from moor_generator/test/analyzer/sql_queries/inference_test.dart rename to drift_dev/test/analyzer/sql_queries/inference_test.dart index efcd920f..adcaf39e 100644 --- a/moor_generator/test/analyzer/sql_queries/inference_test.dart +++ b/drift_dev/test/analyzer/sql_queries/inference_test.dart @@ -1,7 +1,7 @@ //@dart=2.9 -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/sql_queries/linter_test.dart b/drift_dev/test/analyzer/sql_queries/linter_test.dart similarity index 95% rename from moor_generator/test/analyzer/sql_queries/linter_test.dart rename to drift_dev/test/analyzer/sql_queries/linter_test.dart index 24f24157..cf11aaaa 100644 --- a/moor_generator/test/analyzer/sql_queries/linter_test.dart +++ b/drift_dev/test/analyzer/sql_queries/linter_test.dart @@ -1,8 +1,8 @@ //@dart=2.9 -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/errors.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/query_handler.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/type_mapping.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/errors.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/query_handler.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/type_mapping.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/sql_queries/queries_from_views.dart b/drift_dev/test/analyzer/sql_queries/queries_from_views.dart similarity index 89% rename from moor_generator/test/analyzer/sql_queries/queries_from_views.dart rename to drift_dev/test/analyzer/sql_queries/queries_from_views.dart index f6a08106..687d111b 100644 --- a/moor_generator/test/analyzer/sql_queries/queries_from_views.dart +++ b/drift_dev/test/analyzer/sql_queries/queries_from_views.dart @@ -1,7 +1,7 @@ //@dart=2.9 -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/sql_queries/query_analyzer_test.dart b/drift_dev/test/analyzer/sql_queries/query_analyzer_test.dart similarity index 92% rename from moor_generator/test/analyzer/sql_queries/query_analyzer_test.dart rename to drift_dev/test/analyzer/sql_queries/query_analyzer_test.dart index baeb621b..c0022972 100644 --- a/moor_generator/test/analyzer/sql_queries/query_analyzer_test.dart +++ b/drift_dev/test/analyzer/sql_queries/query_analyzer_test.dart @@ -1,6 +1,6 @@ //@dart=2.9 -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; import 'package:test/test.dart'; import '../utils.dart'; diff --git a/moor_generator/test/analyzer/sql_queries/query_handler_test.dart b/drift_dev/test/analyzer/sql_queries/query_handler_test.dart similarity index 91% rename from moor_generator/test/analyzer/sql_queries/query_handler_test.dart rename to drift_dev/test/analyzer/sql_queries/query_handler_test.dart index 22fc60a3..08ed8310 100644 --- a/moor_generator/test/analyzer/sql_queries/query_handler_test.dart +++ b/drift_dev/test/analyzer/sql_queries/query_handler_test.dart @@ -1,12 +1,12 @@ //@dart=2.9 -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/moor/create_table_reader.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/analyzer/runner/steps.dart'; -import 'package:moor_generator/src/analyzer/runner/task.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/query_handler.dart'; -import 'package:moor_generator/src/analyzer/sql_queries/type_mapping.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/moor/create_table_reader.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/analyzer/runner/steps.dart'; +import 'package:drift_dev/src/analyzer/runner/task.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/query_handler.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/type_mapping.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/sql_queries/type_mapping_test.dart b/drift_dev/test/analyzer/sql_queries/type_mapping_test.dart similarity index 90% rename from moor_generator/test/analyzer/sql_queries/type_mapping_test.dart rename to drift_dev/test/analyzer/sql_queries/type_mapping_test.dart index f6a229c2..2a4df4dd 100644 --- a/moor_generator/test/analyzer/sql_queries/type_mapping_test.dart +++ b/drift_dev/test/analyzer/sql_queries/type_mapping_test.dart @@ -1,6 +1,6 @@ //@dart=2.9 -import 'package:moor_generator/src/analyzer/sql_queries/type_mapping.dart'; -import 'package:moor_generator/src/model/sql_query.dart'; +import 'package:drift_dev/src/analyzer/sql_queries/type_mapping.dart'; +import 'package:drift_dev/src/model/sql_query.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/analyzer/utils.dart b/drift_dev/test/analyzer/utils.dart similarity index 84% rename from moor_generator/test/analyzer/utils.dart rename to drift_dev/test/analyzer/utils.dart index 3a737b27..97695555 100644 --- a/moor_generator/test/analyzer/utils.dart +++ b/drift_dev/test/analyzer/utils.dart @@ -1,9 +1,9 @@ import 'package:build/build.dart'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/file_graph.dart'; -import 'package:moor_generator/src/analyzer/runner/task.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/file_graph.dart'; +import 'package:drift_dev/src/analyzer/runner/task.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; import 'package:test/test.dart'; import '../utils/test_backend.dart'; diff --git a/moor_generator/test/backends/build/build_backend_test.dart b/drift_dev/test/backends/build/build_backend_test.dart similarity index 86% rename from moor_generator/test/backends/build/build_backend_test.dart rename to drift_dev/test/backends/build/build_backend_test.dart index bd80979a..f4d57f07 100644 --- a/moor_generator/test/backends/build/build_backend_test.dart +++ b/drift_dev/test/backends/build/build_backend_test.dart @@ -1,8 +1,8 @@ //@dart=2.9 @Tags(['analyzer']) import 'package:build_test/build_test.dart'; -import 'package:moor_generator/src/backends/backend.dart'; -import 'package:moor_generator/src/backends/build/build_backend.dart'; +import 'package:drift_dev/src/backends/backend.dart'; +import 'package:drift_dev/src/backends/build/build_backend.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/test/backends/build/generators/moor_generator_test.dart b/drift_dev/test/backends/build/generators/moor_generator_test.dart similarity index 94% rename from moor_generator/test/backends/build/generators/moor_generator_test.dart rename to drift_dev/test/backends/build/generators/moor_generator_test.dart index 7e8a384c..485a98d2 100644 --- a/moor_generator/test/backends/build/generators/moor_generator_test.dart +++ b/drift_dev/test/backends/build/generators/moor_generator_test.dart @@ -4,7 +4,7 @@ import 'dart:async'; import 'package:build/build.dart'; import 'package:build_test/build_test.dart'; -import 'package:moor_generator/integrations/build.dart'; +import 'package:drift_dev/integrations/build.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/test/backends/build/preprocess_builder_tests.dart b/drift_dev/test/backends/build/preprocess_builder_tests.dart similarity index 97% rename from moor_generator/test/backends/build/preprocess_builder_tests.dart rename to drift_dev/test/backends/build/preprocess_builder_tests.dart index 2ae88f6e..08ab9fcc 100644 --- a/moor_generator/test/backends/build/preprocess_builder_tests.dart +++ b/drift_dev/test/backends/build/preprocess_builder_tests.dart @@ -4,7 +4,7 @@ import 'dart:convert'; import 'package:build/build.dart'; import 'package:build_test/build_test.dart'; -import 'package:moor_generator/src/backends/build/preprocess_builder.dart'; +import 'package:drift_dev/src/backends/build/preprocess_builder.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/test/cli/migrate_test.dart b/drift_dev/test/cli/migrate_test.dart similarity index 99% rename from moor_generator/test/cli/migrate_test.dart rename to drift_dev/test/cli/migrate_test.dart index e23e84cc..85b07e37 100644 --- a/moor_generator/test/cli/migrate_test.dart +++ b/drift_dev/test/cli/migrate_test.dart @@ -4,7 +4,7 @@ import 'dart:io'; import 'dart:isolate'; import 'package:meta/meta.dart'; -import 'package:moor_generator/src/cli/cli.dart'; +import 'package:drift_dev/src/cli/cli.dart'; import 'package:package_config/package_config_types.dart'; import 'package:path/path.dart' as p; import 'package:test/scaffolding.dart'; diff --git a/moor_generator/test/model/specified_table_test.dart b/drift_dev/test/model/specified_table_test.dart similarity index 80% rename from moor_generator/test/model/specified_table_test.dart rename to drift_dev/test/model/specified_table_test.dart index 0949e07c..83d3dc26 100644 --- a/moor_generator/test/model/specified_table_test.dart +++ b/drift_dev/test/model/specified_table_test.dart @@ -1,5 +1,5 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/test/services/find_stream_update_rules_test.dart b/drift_dev/test/services/find_stream_update_rules_test.dart similarity index 96% rename from moor_generator/test/services/find_stream_update_rules_test.dart rename to drift_dev/test/services/find_stream_update_rules_test.dart index dfbb11f0..aa7789f5 100644 --- a/moor_generator/test/services/find_stream_update_rules_test.dart +++ b/drift_dev/test/services/find_stream_update_rules_test.dart @@ -1,8 +1,8 @@ //@dart=2.9 @Tags(['analyzer']) import 'package:moor/moor.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/services/find_stream_update_rules.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/services/find_stream_update_rules.dart'; import 'package:test/test.dart'; import '../analyzer/utils.dart'; diff --git a/moor_generator/test/services/ide/assists/column_nullability_test.dart b/drift_dev/test/services/ide/assists/column_nullability_test.dart similarity index 100% rename from moor_generator/test/services/ide/assists/column_nullability_test.dart rename to drift_dev/test/services/ide/assists/column_nullability_test.dart diff --git a/moor_generator/test/services/ide/assists/utils.dart b/drift_dev/test/services/ide/assists/utils.dart similarity index 100% rename from moor_generator/test/services/ide/assists/utils.dart rename to drift_dev/test/services/ide/assists/utils.dart diff --git a/moor_generator/test/services/ide/highlights_test.dart b/drift_dev/test/services/ide/highlights_test.dart similarity index 95% rename from moor_generator/test/services/ide/highlights_test.dart rename to drift_dev/test/services/ide/highlights_test.dart index ba3920a1..edb10d7c 100644 --- a/moor_generator/test/services/ide/highlights_test.dart +++ b/drift_dev/test/services/ide/highlights_test.dart @@ -1,7 +1,7 @@ //@dart=2.9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:build/build.dart'; -import 'package:moor_generator/src/services/ide/moor_ide.dart'; +import 'package:drift_dev/src/services/ide/moor_ide.dart'; import 'package:test/test.dart'; import 'utils.dart'; diff --git a/moor_generator/test/services/ide/utils.dart b/drift_dev/test/services/ide/utils.dart similarity index 87% rename from moor_generator/test/services/ide/utils.dart rename to drift_dev/test/services/ide/utils.dart index aff143f2..5d0ea1e2 100644 --- a/moor_generator/test/services/ide/utils.dart +++ b/drift_dev/test/services/ide/utils.dart @@ -1,7 +1,7 @@ //@dart=2.9 import 'package:build/build.dart'; -import 'package:moor_generator/src/analyzer/session.dart'; -import 'package:moor_generator/src/services/ide/moor_ide.dart'; +import 'package:drift_dev/src/analyzer/session.dart'; +import 'package:drift_dev/src/services/ide/moor_ide.dart'; import 'package:path/path.dart'; diff --git a/moor_generator/test/services/schema/find_differences_test.dart b/drift_dev/test/services/schema/find_differences_test.dart similarity index 97% rename from moor_generator/test/services/schema/find_differences_test.dart rename to drift_dev/test/services/schema/find_differences_test.dart index 9515d146..dcf1327f 100644 --- a/moor_generator/test/services/schema/find_differences_test.dart +++ b/drift_dev/test/services/schema/find_differences_test.dart @@ -1,5 +1,5 @@ //@dart=2.9 -import 'package:moor_generator/src/services/schema/find_differences.dart'; +import 'package:drift_dev/src/services/schema/find_differences.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/test/services/schema/verifier_impl_test.dart b/drift_dev/test/services/schema/verifier_impl_test.dart similarity index 97% rename from moor_generator/test/services/schema/verifier_impl_test.dart rename to drift_dev/test/services/schema/verifier_impl_test.dart index c0cd21fd..587990c9 100644 --- a/moor_generator/test/services/schema/verifier_impl_test.dart +++ b/drift_dev/test/services/schema/verifier_impl_test.dart @@ -1,6 +1,6 @@ //@dart=2.9 import 'package:moor/moor.dart'; -import 'package:moor_generator/api/migrations.dart'; +import 'package:drift_dev/api/migrations.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/test/services/schema/writer_test.dart b/drift_dev/test/services/schema/writer_test.dart similarity index 95% rename from moor_generator/test/services/schema/writer_test.dart rename to drift_dev/test/services/schema/writer_test.dart index 44acb3af..9f774ac1 100644 --- a/moor_generator/test/services/schema/writer_test.dart +++ b/drift_dev/test/services/schema/writer_test.dart @@ -2,12 +2,12 @@ @Tags(['analyzer']) import 'dart:convert'; -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/src/services/schema/schema_files.dart'; -import 'package:moor_generator/src/writer/database_writer.dart'; -import 'package:moor_generator/src/writer/writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/src/services/schema/schema_files.dart'; +import 'package:drift_dev/src/writer/database_writer.dart'; +import 'package:drift_dev/src/writer/writer.dart'; import 'package:test/test.dart'; import '../../analyzer/utils.dart'; diff --git a/moor_generator/test/utils/entity_reference_sorter_test.dart b/drift_dev/test/utils/entity_reference_sorter_test.dart similarity index 94% rename from moor_generator/test/utils/entity_reference_sorter_test.dart rename to drift_dev/test/utils/entity_reference_sorter_test.dart index 8408cede..a9fba509 100644 --- a/moor_generator/test/utils/entity_reference_sorter_test.dart +++ b/drift_dev/test/utils/entity_reference_sorter_test.dart @@ -1,5 +1,5 @@ -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/utils/entity_reference_sorter.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/utils/entity_reference_sorter.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/test/utils/string_escaper_test.dart b/drift_dev/test/utils/string_escaper_test.dart similarity index 91% rename from moor_generator/test/utils/string_escaper_test.dart rename to drift_dev/test/utils/string_escaper_test.dart index 71b39c2d..ba3a2a58 100644 --- a/moor_generator/test/utils/string_escaper_test.dart +++ b/drift_dev/test/utils/string_escaper_test.dart @@ -1,4 +1,4 @@ -import 'package:moor_generator/src/utils/string_escaper.dart'; +import 'package:drift_dev/src/utils/string_escaper.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/test/utils/test_backend.dart b/drift_dev/test/utils/test_backend.dart similarity index 97% rename from moor_generator/test/utils/test_backend.dart rename to drift_dev/test/utils/test_backend.dart index de6adc0b..2911f28c 100644 --- a/moor_generator/test/utils/test_backend.dart +++ b/drift_dev/test/utils/test_backend.dart @@ -4,7 +4,7 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:build/build.dart'; import 'package:build_test/build_test.dart'; import 'package:logging/logging.dart'; -import 'package:moor_generator/src/backends/backend.dart'; +import 'package:drift_dev/src/backends/backend.dart'; class TestBackend extends Backend { final Map fakeContent; diff --git a/moor_generator/test/writer/mutable_classes_integration_test.dart b/drift_dev/test/writer/mutable_classes_integration_test.dart similarity index 98% rename from moor_generator/test/writer/mutable_classes_integration_test.dart rename to drift_dev/test/writer/mutable_classes_integration_test.dart index 1b1ed0ae..12ff6255 100644 --- a/moor_generator/test/writer/mutable_classes_integration_test.dart +++ b/drift_dev/test/writer/mutable_classes_integration_test.dart @@ -5,7 +5,7 @@ import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/file_system/memory_file_system.dart'; import 'package:build/build.dart'; import 'package:build_test/build_test.dart'; -import 'package:moor_generator/src/backends/build/moor_builder.dart'; +import 'package:drift_dev/src/backends/build/moor_builder.dart'; import 'package:pub_semver/pub_semver.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/writer/queries/query_writer_test.dart b/drift_dev/test/writer/queries/query_writer_test.dart similarity index 91% rename from moor_generator/test/writer/queries/query_writer_test.dart rename to drift_dev/test/writer/queries/query_writer_test.dart index 4db100fa..0af5a9e4 100644 --- a/moor_generator/test/writer/queries/query_writer_test.dart +++ b/drift_dev/test/writer/queries/query_writer_test.dart @@ -1,7 +1,7 @@ // @dart=2.9 -import 'package:moor_generator/src/analyzer/options.dart'; -import 'package:moor_generator/src/analyzer/runner/results.dart'; -import 'package:moor_generator/writer.dart'; +import 'package:drift_dev/src/analyzer/options.dart'; +import 'package:drift_dev/src/analyzer/runner/results.dart'; +import 'package:drift_dev/writer.dart'; import 'package:test/test.dart'; import '../../analyzer/utils.dart'; diff --git a/moor_generator/test/writer/queries/sql_writer_test.dart b/drift_dev/test/writer/queries/sql_writer_test.dart similarity index 85% rename from moor_generator/test/writer/queries/sql_writer_test.dart rename to drift_dev/test/writer/queries/sql_writer_test.dart index cf0a6160..13d3055d 100644 --- a/moor_generator/test/writer/queries/sql_writer_test.dart +++ b/drift_dev/test/writer/queries/sql_writer_test.dart @@ -1,6 +1,6 @@ //@dart=2.9 -import 'package:moor_generator/moor_generator.dart'; -import 'package:moor_generator/src/writer/queries/sql_writer.dart'; +import 'package:drift_dev/moor_generator.dart'; +import 'package:drift_dev/src/writer/queries/sql_writer.dart'; import 'package:sqlparser/sqlparser.dart'; import 'package:test/test.dart'; diff --git a/moor_generator/test/writer/utils/hash_code_test.dart b/drift_dev/test/writer/utils/hash_code_test.dart similarity index 91% rename from moor_generator/test/writer/utils/hash_code_test.dart rename to drift_dev/test/writer/utils/hash_code_test.dart index 637f8e45..5ec503f9 100644 --- a/moor_generator/test/writer/utils/hash_code_test.dart +++ b/drift_dev/test/writer/utils/hash_code_test.dart @@ -1,5 +1,5 @@ //@dart=2.9 -import 'package:moor_generator/src/writer/utils/hash_code.dart'; +import 'package:drift_dev/src/writer/utils/hash_code.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/test/writer/utils/override_equals_test.dart b/drift_dev/test/writer/utils/override_equals_test.dart similarity index 90% rename from moor_generator/test/writer/utils/override_equals_test.dart rename to drift_dev/test/writer/utils/override_equals_test.dart index 91bcda04..de30f7d5 100644 --- a/moor_generator/test/writer/utils/override_equals_test.dart +++ b/drift_dev/test/writer/utils/override_equals_test.dart @@ -1,4 +1,4 @@ -import 'package:moor_generator/src/writer/utils/override_equals.dart'; +import 'package:drift_dev/src/writer/utils/override_equals.dart'; import 'package:test/test.dart'; void main() { diff --git a/moor_generator/tool/debug_plugin.dart b/drift_dev/tool/debug_plugin.dart similarity index 97% rename from moor_generator/tool/debug_plugin.dart rename to drift_dev/tool/debug_plugin.dart index 79699572..f440d7e8 100644 --- a/moor_generator/tool/debug_plugin.dart +++ b/drift_dev/tool/debug_plugin.dart @@ -6,7 +6,7 @@ import 'dart:io'; import 'package:analyzer_plugin/channel/channel.dart'; import 'package:analyzer_plugin/protocol/protocol.dart'; import 'package:args/args.dart'; -import 'package:moor_generator/src/backends/plugin/plugin.dart'; +import 'package:drift_dev/src/backends/plugin/plugin.dart'; void main(List args) { final parser = ArgParser() diff --git a/extras/migrations_example/pubspec.yaml b/extras/migrations_example/pubspec.yaml index c866b29b..8a0fd1c6 100644 --- a/extras/migrations_example/pubspec.yaml +++ b/extras/migrations_example/pubspec.yaml @@ -16,6 +16,8 @@ dev_dependencies: dependency_overrides: drift: path: ../../drift + drift_dev: + path: ../../drift_dev moor: path: ../../moor moor_generator: diff --git a/moor_generator/bin/moor_generator.dart b/moor_generator/bin/moor_generator.dart index 0afffe4b..6ae44aae 100644 --- a/moor_generator/bin/moor_generator.dart +++ b/moor_generator/bin/moor_generator.dart @@ -1,5 +1,5 @@ //@dart=2.9 -import 'package:moor_generator/src/cli/cli.dart' as cli; +import 'package:drift_dev/src/cli/cli.dart' as cli; Future main(List args) { return cli.run(args); diff --git a/moor_generator/lib/api/migrations.dart b/moor_generator/lib/api/migrations.dart index af0f67ff..257678f0 100644 --- a/moor_generator/lib/api/migrations.dart +++ b/moor_generator/lib/api/migrations.dart @@ -1,167 +1 @@ -import 'package:meta/meta.dart'; -import 'package:moor/moor.dart'; - -import 'package:moor_generator/src/services/schema/verifier_impl.dart'; -import 'package:sqlite3/sqlite3.dart'; - -abstract class SchemaVerifier { - factory SchemaVerifier(SchemaInstantiationHelper helper) = - VerifierImplementation; - - /// Creates a [DatabaseConnection] that contains empty tables created for the - /// known schema [version]. - /// - /// This is useful as a starting point for a schema migration test. You can - /// use the [DatabaseConnection] returned to create an instance of your - /// application database, which can then be migrated through - /// [migrateAndValidate]. - /// - /// If you want to insert data in a migration test, use [schemaAt]. - Future startAt(int version); - - /// Creates a new database and instantiates the schema with the given - /// [version]. - /// - /// This can be used as a starting point for a complex schema migration test - /// to verify data integrity. You can roughly follow these steps to write such - /// tests: - /// - /// - call [schemaAt] with the starting version you want to test - /// - use the [InitializedSchema.rawDatabase] of the returned - /// [InitializedSchema] to insert data. - /// - connect your database class to the [InitializedSchema.connection] - /// - call [migrateAndValidate] with the database and your target schema - /// version to run a migration and verify that it yields the desired schema - /// when done. - /// - run select statements on your database to verify that the data from - /// step 2 hasn't been affected by the migration. - /// - /// If you only want to verify the schema without data, using [startAt] might - /// be easier. - Future schemaAt(int version); - - /// Runs a schema migration and verifies that it transforms the database into - /// a correct state. - /// - /// This involves opening the [db] and calling its - /// [GeneratedDatabase.migration] to migrate it to the latest version. - /// Finally, the method will read from `sqlite_schema` to verify that the - /// schema at runtime matches the expected schema version. - /// - /// The future completes normally if the schema migration succeeds and brings - /// the database into the expected schema. If the comparison fails, a - /// [SchemaMismatch] exception will be thrown. - /// - /// If [validateDropped] is enabled (defaults to `false`), the method also - /// validates that no further tables, triggers or views apart from those - /// expected exist. - Future migrateAndValidate(GeneratedDatabase db, int expectedVersion, - {bool validateDropped = false}); -} - -/// The implementation of this class is generated through the `moor_generator` -/// CLI tool. -abstract class SchemaInstantiationHelper { - GeneratedDatabase databaseForVersion(QueryExecutor db, int version); -} - -/// Thrown when trying to instantiate a schema that hasn't been saved. -class MissingSchemaException implements Exception { - /// The requested version that doesn't exist. - final int requested; - - /// All known schema versions. - final Iterable available; - - MissingSchemaException(this.requested, this.available); - - @override - String toString() { - return 'Unknown schema version $requested. ' - 'Known are ${available.join(', ')}.'; - } -} - -/// Thrown when the actual schema differs from the expected schema. -class SchemaMismatch implements Exception { - final String explanation; - - SchemaMismatch(this.explanation); - - @override - String toString() { - return 'Schema does not match\n$explanation'; - } -} - -/// Contains an initialized schema with all tables, views, triggers and indices. -/// -/// You can use the [connection] for your database class and the [rawDatabase] -/// to insert data before the migration. -class InitializedSchema { - /// The raw database from the `sqlite3` package. - /// - /// The database contains all tables, views, triggers and indices from the - /// requested schema. It can be used to insert data before a migration to - /// verify that it's still intact after the migration. - /// - /// This database backs the [connection], so it's not necessary to close it - /// if you're attaching a database later. - final Database rawDatabase; - - final DatabaseConnection Function() _createConnection; - - /// A database connection with a prepared schema. - /// - /// You can connect your database classes to this as a starting point for - /// migration tests. - @Deprecated('Use newConnection instead, and store the result') - late final DatabaseConnection connection = _createConnection(); - - @internal - InitializedSchema(this.rawDatabase, this._createConnection); - - /// Creates a new database connection. - /// - /// All connections returned by this method point to the [rawDatabase]. - /// However, each call to [newConnection] returns an independent connection - /// that is considered closed from moor's point of view. This means that the - /// [rawDatabase] can be used by multiple generated database classes that - /// can independently be opened and closed, albeit not simultaneously. - /// - /// ## Example - /// - /// When generating the schema helpers with the `--data-classes` and the - /// `--companions` command-line flags, this method can be used to create moor - /// databases inserting data at specific versions: - /// - /// ```dart - /// import 'generated/schema.dart'; - /// import 'generated/schema_v1.dart' as v1; - /// import 'generated/schema_v2.dart' as v2; - /// - /// test('data integrity from v1 to v2', () async { - /// final verifier = SchemaVerifier(GeneratedHelper()); - /// final schema = await verifier.schemaAt(1); - /// - /// // Insert some data from the view of the old database on an independent - /// // connection! - /// final oldDb = v1.DatabaseAtV1.connect(schema.newConnection()); - /// await oldDb.into(oldDb.users).insert(v1.UsersCompanion(id: Value(1))); - /// await oldDb.close(); - /// - /// // Run the migration on the real database class from your app - /// final dbForMigration = Database(schema.newConnection()); - /// await verifier.migrateAndValidate(dbForMigration, 2); - /// await dbForMigration.close(); - /// - /// // Make sure the user is still here with a new database at v2 - /// final checkDb = v2.DatabaseAtV2.connect(schema.newConnection()); - /// final user = await checkDb.select(checkDb.users).getSingle(); - /// expect(user.id, 1); - /// expect(user.name, 'default name from migration'); - /// await checkDb.close(); - /// }); - /// ``` - DatabaseConnection newConnection() => _createConnection(); -} +export 'package:drift_dev/api/migrations.dart'; diff --git a/moor_generator/lib/integrations/build.dart b/moor_generator/lib/integrations/build.dart index 19205d6c..863f53e4 100644 --- a/moor_generator/lib/integrations/build.dart +++ b/moor_generator/lib/integrations/build.dart @@ -1,14 +1 @@ -import 'package:build/build.dart'; -import 'package:moor_generator/src/backends/build/moor_builder.dart'; -import 'package:moor_generator/src/backends/build/preprocess_builder.dart'; - -Builder moorBuilder(BuilderOptions options) => MoorSharedPartBuilder(options); - -Builder moorBuilderNotShared(BuilderOptions options) => - MoorPartBuilder(options); - -Builder preparingBuilder(BuilderOptions options) => PreprocessBuilder(); - -PostProcessBuilder moorCleanup(BuilderOptions options) { - return const FileDeletingBuilder(['.temp.dart']); -} +export 'package:drift_dev/integrations/build.dart'; diff --git a/moor_generator/lib/integrations/plugin.dart b/moor_generator/lib/integrations/plugin.dart index d8596630..eda95c76 100644 --- a/moor_generator/lib/integrations/plugin.dart +++ b/moor_generator/lib/integrations/plugin.dart @@ -1,9 +1,2 @@ //@dart=2.9 -import 'dart:isolate'; - -import 'package:analyzer_plugin/starter.dart'; -import 'package:moor_generator/src/backends/plugin/plugin.dart'; - -void start(List args, SendPort sendPort) { - ServerPluginStarter(MoorPlugin.forProduction()).start(sendPort); -} +export 'package:drift_dev/integrations/plugin.dart'; diff --git a/moor_generator/lib/moor_generator.dart b/moor_generator/lib/moor_generator.dart index 1eecbc2d..55303abb 100644 --- a/moor_generator/lib/moor_generator.dart +++ b/moor_generator/lib/moor_generator.dart @@ -1 +1 @@ -export 'src/model/model.dart'; +export 'package:drift_dev/moor_generator.dart'; diff --git a/moor_generator/lib/plugin.dart b/moor_generator/lib/plugin.dart deleted file mode 100644 index 494940c9..00000000 --- a/moor_generator/lib/plugin.dart +++ /dev/null @@ -1,4 +0,0 @@ -//@dart=2.9 -// the plugin code used to live in this file, but it has moved. Kept for -// backwards compatibility, this file should be removed in moor 3.0.0 -export 'package:moor_generator/integrations/plugin.dart'; diff --git a/moor_generator/lib/writer.dart b/moor_generator/lib/writer.dart index 8765fd01..8d5de53c 100644 --- a/moor_generator/lib/writer.dart +++ b/moor_generator/lib/writer.dart @@ -1,16 +1 @@ -/// Provides access to the [Writer], which can generate Dart code for parsed -/// databases, daos, queries, tables and more. -library writer; - -import 'src/writer/writer.dart' show Writer; - -export 'src/writer/database_writer.dart'; -export 'src/writer/queries/query_writer.dart'; -export 'src/writer/queries/result_set_writer.dart'; -export 'src/writer/tables/data_class_writer.dart'; -export 'src/writer/tables/table_writer.dart'; -export 'src/writer/tables/update_companion_writer.dart'; -export 'src/writer/utils/hash_code.dart'; -export 'src/writer/utils/memoized_getter.dart'; -export 'src/writer/utils/override_equals.dart'; -export 'src/writer/writer.dart'; +export 'package:drift_dev/writer.dart'; diff --git a/moor_generator/pubspec.yaml b/moor_generator/pubspec.yaml index b0e22060..1aa91616 100644 --- a/moor_generator/pubspec.yaml +++ b/moor_generator/pubspec.yaml @@ -9,48 +9,7 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: - charcode: ^1.2.0 - collection: ^1.14.0 - recase: '>=2.0.1 <5.0.0' - meta: ^1.1.0 - path: ^1.6.0 - json_annotation: ^4.1.0 - stream_transform: '>=0.1.0 <3.0.0' - - # CLI - args: ">=1.5.0 <3.0.0" - logging: '>=0.11.0 <2.0.0' - cli_util: '>=0.2.0 <0.4.0' - yaml_edit: ^2.0.1 - yaml: ^3.1.0 - - # Moor-specific analysis and apis - moor: ^4.4.0 - drift: ^4.6.0 - sqlite3: '>=0.1.6 <2.0.0' - sqlparser: ^0.17.0 - - # Dart analysis - analyzer: "^2.1.0" - analyzer_plugin: ^0.7.0 - source_span: ^1.5.5 - package_config: ^2.0.0 - pub_semver: ^2.0.0 - - # Build system - build: ^2.0.0 - build_resolvers: ^2.0.0 - build_config: '>=0.3.1 <2.0.0' - dart_style: '>=1.3.3 <3.0.0' - source_gen: '>=0.9.4 <2.0.0' - -dev_dependencies: - checked_yaml: ^2.0.1 - test: ^1.16.0 - test_descriptor: ^2.0.0 - build_runner: ^2.0.0 - build_test: ^2.0.0 - json_serializable: ^5.0.0 + drift_dev: ^1.0.0 executables: moor_generator: @@ -58,6 +17,8 @@ executables: dependency_overrides: drift: path: ../drift + drift_dev: + path: ../drift_dev sqlparser: path: ../sqlparser moor: