Skip to content

pub global activate -spath . doesn't work with relative paths in pubspec.yaml #30955

@jcollins-g

Description

@jcollins-g

This breaks the flutter bot for dartdoc as we're trying to activate a non-released package. The symptom seems to be dependent on the CWD when running the command; it works if the CWD is the package root but not otherwise. I introduced the workaround as part of dart-lang/dartdoc#1506, the attempt to remove it is in dart-lang/dartdoc#1508 (which is a good place to get a repro case). My guess is the original hack became necessary with some new check that pub is doing.

Example reproduction (full home path obfuscated to ~)

~/tmp
$ pub global deactivate dartdoc
No active package dartdoc.
~/tmp
$ which dartdoc
~/dart/all_sdks/current/bin/dartdoc
~/tmp
$ dart --version
Dart VM version: 2.0.0-dev.2.0 (Wed Sep 27 15:14:18 2017) on "linux_x64"
~/tmp
$ git clone https://github.com/dart-lang/dartdoc.git
Cloning into 'dartdoc'...
remote: Counting objects: 26250, done.
remote: Compressing objects: 100% (142/142), done.
remote: Total 26250 (delta 198), reused 139 (delta 111), pack-reused 25997
Receiving objects: 100% (26250/26250), 7.89 MiB | 14.92 MiB/s, done.
Resolving deltas: 100% (22073/22073), done.
~/tmp
$ cd dartdoc
~/tmp/dartdoc
$ git checkout undo-appveyor-hack
Branch 'undo-appveyor-hack' set up to track remote branch 'undo-appveyor-hack' from 'origin'.
Switched to a new branch 'undo-appveyor-hack'

$ pub get
Resolving dependencies...
Overriding the upper bound Dart SDK constraint to <=2.0.0-dev.2.0 for the following packages:

analyzer, ansicolor, args, async, barback, boolean_selector, charcode, cli_util, collection, convert, crypto, csslib, dartdoc, front_end, glob, grinder, html, http, http_multi_server, http_parser, isolate, js, kernel, logging, markdown, matcher, meta, mime, mockable_filesystem, mustache4dart, node_preamble, package_config, package_resolver, path, plugin, pool, pub_semver, quiver_hashcode, resource, shelf, shelf_packages_handler, shelf_static, shelf_web_socket, source_map_stack_trace, source_maps, source_span, stack_trace, stream_channel, string_scanner, supports_color, term_glyph, test_package_imported, tuple, typed_data, unscripted, utf, watcher, web_socket_channel, when, which, yaml

To disable this you can set the PUB_ALLOW_PRERELEASE_SDK system environment variable to `false`, or you can silence this message by setting it to `quiet`.
Got dependencies!
Precompiling executables...
Precompiled markdown:markdown.
Precompiled grinder:grinder.
Precompiled grinder:init.
Precompiled test:test.
~/tmp/dartdoc
$ pub global activate -spath .
Resolving dependencies...
Overriding the upper bound Dart SDK constraint to <=2.0.0-dev.2.0 for the following packages:

analyzer, ansicolor, args, async, barback, boolean_selector, charcode, cli_util, collection, convert, crypto, csslib, dartdoc, front_end, glob, grinder, html, http, http_multi_server, http_parser, isolate, js, kernel, logging, markdown, matcher, meta, mime, mockable_filesystem, mustache4dart, node_preamble, package_config, package_resolver, path, plugin, pool, pub_semver, quiver_hashcode, resource, shelf, shelf_packages_handler, shelf_static, shelf_web_socket, source_map_stack_trace, source_maps, source_span, stack_trace, stream_channel, string_scanner, supports_color, term_glyph, test_package_imported, tuple, typed_data, unscripted, utf, watcher, web_socket_channel, when, which, yaml

To disable this you can set the PUB_ALLOW_PRERELEASE_SDK system environment variable to `false`, or you can silence this message by setting it to `quiet`.
Got dependencies!
Installed executable dartdoc.
Activated dartdoc 0.14.0 at path "~/tmp/dartdoc".
~/tmp/dartdoc
$ which dartdoc
~/.pub-cache/bin/dartdoc
~/tmp/dartdoc
$ dartdoc --help | head
Generate HTML documentation for Dart libraries.

Usage: dartdoc [OPTIONS]

-h, --help                         Show command help.
    --version                      Display the version for dartdoc.
    --add-crossdart                Add Crossdart links to the source code pieces.
    --sdk-docs                     Generate ONLY the docs for the Dart SDK.
    --show-warnings                Display warnings.
    --show-progress                Display progress indications to console stdout
~/tmp/dartdoc
$ cd ..
~/tmp
$ dartdoc --help | head
The pubspec.yaml file has changed since the pubspec.lock file was generated, please run "pub get" again.
~/tmp
$ cd dartdoc/lib
~/tmp/dartdoc/lib
$ dartdoc --help | head
The pubspec.yaml file has changed since the pubspec.lock file was generated, please run "pub get" again.
~/tmp/dartdoc/lib
$ cd ..
~/tmp/dartdoc
$ dartdoc --help | head
Generate HTML documentation for Dart libraries.

Usage: dartdoc [OPTIONS]

-h, --help                         Show command help.
    --version                      Display the version for dartdoc.
    --add-crossdart                Add Crossdart links to the source code pieces.
    --sdk-docs                     Generate ONLY the docs for the Dart SDK.
    --show-warnings                Display warnings.
    --show-progress                Display progress indications to console stdout
~/tmp/dartdoc
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions