Skip to content

Support git dependency for plugins #20

@johannessachse

Description

@johannessachse

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions