You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run the injectable_generator builders from my pub workspace's root package against the packages included within the workspace. With the following in my root package's pubspec.yaml:
name: workspace_exampleenvironment:
sdk: ^3.6.0workspace:
- packages/a
- packages/bdependencies: # I don't notice much difference in behavior if a,b are included as dependencies of the root or nota:
b:
dev_dependencies:
build_runner:
injectable_generator:
I'm noticing a couple issues trying to build micro packages for a,b:
The generateForDir paths supplied to @InjectableInit.microPackage don't seem to allow for any value that will cause the builder to recognize dependencies I have marked within a given package (I tried the default config, '.', and 'packages/a/lib' for package a)
The builder does produces a .module.dart file for micro packages in packages a and b, but the produced MicroPackageModule is given a name based on the resolution of the root packages package-name, i.e.,
//@GeneratedMicroModule;WorkspaceExamplePackageModule;asset:workspace_example/packages/a/lib/package.module.dart// GENERATED CODE - DO NOT MODIFY BY HAND// ignore_for_file: type=lint// coverage:ignore-file// ignore_for_file: no_leading_underscores_for_library_prefixesimport'dart:async'as _i687;
import'package:injectable/injectable.dart'as _i526;
classWorkspaceExamplePackageModuleextends _i526.MicroPackageModule {
// initializes the registration of main-scope dependencies inside of GetIt@override
_i687.FutureOr<void> init(_i526.GetItHelper gh) {}
}
I've configured some of my other builders to run from here and it's convenient, but also started noticing some curious behavior when running injectable_generator from packages I've now included into a workspace. I don't have the particular warnings I was seeing on-hand, as I haven't found a way to reliably reproduce this, but in scenarios where I'm generating for a package with no other dependencies inside of their defined workspace (i.e., only dependent on 'external' packages from outside the workspace), the builder seemed to be doing a lot of "inspection" of assets from other packages within the workspace that I would normally assume it to have no interest in being concerned with.
Is there a way to run the injectable_generator builders from a pub workspace package root? Or if not, have you given any thought to supporting this use case?
Looking forward to trying to get this working, lmk if you've any thoughts, ideas, or solutions I'm missing.
Thanks
The text was updated successfully, but these errors were encountered:
Hey @Milad-Akarie,
I'm trying to run the injectable_generator builders from my pub workspace's root package against the packages included within the workspace. With the following in my root package's pubspec.yaml:
and a build.yaml as follows:
I'm noticing a couple issues trying to build micro packages for a,b:
generateForDir
paths supplied to@InjectableInit.microPackage
don't seem to allow for any value that will cause the builder to recognize dependencies I have marked within a given package (I tried the default config, '.', and 'packages/a/lib' for package a)a
andb
, but the producedMicroPackageModule
is given a name based on the resolution of the root packages package-name, i.e.,I've configured some of my other builders to run from here and it's convenient, but also started noticing some curious behavior when running injectable_generator from packages I've now included into a workspace. I don't have the particular warnings I was seeing on-hand, as I haven't found a way to reliably reproduce this, but in scenarios where I'm generating for a package with no other dependencies inside of their defined workspace (i.e., only dependent on 'external' packages from outside the workspace), the builder seemed to be doing a lot of "inspection" of assets from other packages within the workspace that I would normally assume it to have no interest in being concerned with.
Is there a way to run the injectable_generator builders from a pub workspace package root? Or if not, have you given any thought to supporting this use case?
Looking forward to trying to get this working, lmk if you've any thoughts, ideas, or solutions I'm missing.
Thanks
The text was updated successfully, but these errors were encountered: