Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance issue caused by injectable_generator running on dependencies and not only on app folder when running build_runner #467

Open
pedrosantosdd opened this issue May 17, 2024 · 0 comments

Comments

@pedrosantosdd
Copy link

pedrosantosdd commented May 17, 2024

Running build_runner in debug mode, i have found a strange behavior in injectable_generator that seems to be the cause of the exponential time raises in this step.

Problem

I have a monorepo and recenty looking for the causes that takes my pipeline to take too much time 9 minutes (avg). When build_runner generate starts using melos, the shared code (Modules) run first and than the apps code sequentially. The output of build_runner accuses something very strange injectable_generate is running on dependecies path and not only in package path (lib, test).

[FINE] injectable_generator:injectable_builder on package:apps_catalog/interactor/cubit/product_page_cubit.dart:Running Instance of 'InjectableGenerator'

I have tried to limit the folder that injectable_generator and injectable_builder should look at using build.yaml but doesnt takes any effect on this problem.

Output console from build_runner generate on apps after modules

[FINE] injectable_generator:injectable_builder on package:apps_catalog/interactor/type_converters/product_child_order_converter.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on package:apps_catalog/interactor/events/product_page_event.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on package:apps_catalog/interactor/cubit/catalog_page_cubit.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on package:apps_catalog/interactor/cubit/catalog_listing_cubit.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on package:apps_catalog/interactor/events/shopping_cart_event.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on package:apps_catalog/interactor/cubit/shopping_cart_cubit.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on package:apps_catalog/interactor/cubit/product_page_cubit.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on lib/src/data/datasources/remotes/screensaver/get/screensaver_get_datasource.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on lib/src/data/datasources/remotes/screensaver/get/screensaver_get_v1_datasource_mock_impl.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on lib/src/data/datasources/remotes/screensaver/get/parser/get_data_parser.dart:Running Instance of 'InjectableGenerator'
[FINE] injectable_generator:injectable_builder on lib/src/data/datasources/remotes/screensaver/get/screensaver_get_v1_datasource_impl.dart:Running Instance of 'InjectableGenerator'

Minimal reproducible example

Struct Folder

  • Apps (Similars apps that share some modules and design system widgets)
  • Modules (Business Rules, Data Sources)
  • Shared (Tools, Design System)

build_runner command using melos

generate:debug:
    run: dart run build_runner build --delete-conflicting-outputs --verbose
    exec:
      orderDependents: true
      failFast: true
    packageFilters:
      dependsOn:
        - build_runner
    description: Run code generation using build_runner in a specific package
@pedrosantosdd pedrosantosdd changed the title build_runner slows caused by injectable_generator running on dependencies and not only on app folder. performance issue caused by injectable_generator running on dependencies and not only on app folder when running build_runner Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant