Skip to content

Pub can't use transformers from dev dependencies. #23805

Closed
@dglinyanov

Description

@dglinyanov

According to FAQ:
$ uname -a
Linux glinyanov-PC 3.14.14-031414-generic #201407281153 SMP Mon Jul 28 15:54:19 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ pub version
Pub 1.9.3
$ pub --verbose update > pub.log 2>&1
pub.log is here: https://goo.gl/PL1cUU

My team was working on refactoring and extracting libraries to separate repositories in particular, and we found a bug, that we could reproduce: if in package:A we use package:test as dev_dependency and use test/pub_serve transfomer, then if in package:B we use package:A as 'git' dependency (and NOT 'path' dependency), then pub get/update for package:B fails with exception:

Loading source assets... 
The null object does not have a getter 'pubspec'.

NoSuchMethodError: method not found: 'pubspec'
Receiver: null
Arguments: []
dart:core
... # more in pub.log

I created the example packages to show it, it's here: https://goo.gl/2k8Kea.

Nevertheless, my real project builds successfully even after bad pub update, meaning pub build does not fail, and package:A itself can successfully use that transformer.

For those, who experience same issue: move your transformer's dependency from dev_dependencies to dependencies (e.g. test for test/pub_serve), it solves the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions