dart_custom_lint icon indicating copy to clipboard operation
dart_custom_lint copied to clipboard

Support git dependency for plugins

Open johannessachse opened this issue 3 years ago • 3 comments
trafficstars

I created a lint_package and tried to use this package within my application:

1. Project structure

lint_package structure pubspec.yaml

dependencies:
  analyzer: ^4.2.0
  analyzer_plugin: ^0.10.0
  custom_lint_builder: ^0.0.9+1

In my custom_lint file (bin/custom_lint.dart) I have several imports:

import 'dart:isolate';

import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/source/source_range.dart';
import 'package:analyzer_plugin/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:custom_lint_builder/custom_lint_builder.dart';

application structure pubspec.yaml

dependencies:
  custom_lint:
  lint_package:
     git:
        url: [...]
        ref: [...]

analysis_options.yaml

analyzer:
  plugins:
    - custom_lint

2. Problem

When running flutter pub get or dart run custom_lint within my application I get the following error:

IsolateSpawnException: Unable to spawn isolate: Error: Error when reading '**/.pub_cache/**/lint_package/.dart_tool/package_config.json': No such file or directory
Error: Couldn't resolve the package 'analyzer' in 'package:analyzer/dart/analysis/results.dart'.
Error: Couldn't resolve the package 'analyzer' in 'package:analyzer/dart/ast/ast.dart'.
Error: Couldn't resolve the package 'analyzer' in 'package:analyzer/dart/element/type.dart'.
Error: Couldn't resolve the package 'analyzer' in 'package:analyzer/source/source_range.dart'.
Error: Couldn't resolve the package 'analyzer_plugin' in 'package:analyzer_plugin/protocol/protocol_generated.dart'.
Error: Couldn't resolve the package 'analyzer_plugin' in 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'.
Error: Couldn't resolve the package 'custom_lint_builder' in 'package:custom_lint_builder/custom_lint_builder.dart'.

The .dart_tool directory is not included in my lint_package repository.

If I manually execute flutter pub get in my local copy of this package (.pub-cache/**/lint_package) everything works as expected.

johannessachse avatar Jul 25 '22 13:07 johannessachse

It happens for packages hosted at the pub.dev too. We've deployed our custom lints package and it throws the same exception regarding missing package_config.json.

vs-krasnov avatar Aug 02 '22 22:08 vs-krasnov

That's very problematic. Sadly I'm quite busy for August, as I have a lot of things to do for the 1st of September.

I'm not sure I'll be able to fix the problem before

rrousselGit avatar Aug 03 '22 01:08 rrousselGit

I'll look into it tomorrow to see if there's a quick fix (like running pub get in the project). But if not, it'll probably have to wait a bit

rrousselGit avatar Aug 03 '22 01:08 rrousselGit

I got same issue

irufano avatar Sep 05 '22 14:09 irufano

I'm done with the Flutter Vikings. So I'll look into this issue asap

Le lun. 5 sept. 2022 à 16:37, irufano @.***> a écrit :

I got same issue

— Reply to this email directly, view it on GitHub https://github.com/invertase/dart_custom_lint/issues/20#issuecomment-1237137419, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZ3I3JLEHIAQ7Q75B6F3TLV4YASDANCNFSM54SHYYYA . You are receiving this because you commented.Message ID: @.***>

rrousselGit avatar Sep 06 '22 11:09 rrousselGit