Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete Deprecation of standalone pub command(pub global activate does not work) #3066

Closed
raveesh-me opened this issue Aug 4, 2021 · 8 comments

Comments

@raveesh-me
Copy link

Environment

➜  highsupply git:(main) ✗ flutter doctor                              
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on Linux, locale en_GB.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.58.2)
[✓] Connected device (1 available)

• No issues found!
➜  highsupply git:(main) ✗ dart --version                          
Dart SDK version: 2.13.4 (stable) (Wed Jun 23 13:08:41 2021 +0200) on "linux_x64"
➜  highsupply git:(main) ✗ flutter pub version                        
Pub 2.13.4
Ubuntu 20.04 LTS

Problem

as we know that standalone pub command is deprecated
image

and that snap install on Ubuntu does not expose the pub command at all, we have to access the command via either

  • flutter pub
  • dart pub

still when we do a

dart pub global activate --source path .

on a dart tool, we can not run the tool from commandline and we get error as:

➜  highlevel-flutter git:(codemagic_newdeploy) highsupply create .
/home/raveesh/snap/flutter/common/flutter/.pub-cache/bin/highsupply: 7: pub: not found

The content of /home/raveesh/snap/flutter/common/flutter/.pub-cache/bin/highsupply is:

➜  highsupply git:(main) ✗ cat $(which highsupply)
#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
pub global run high_supply:high_supply "$@"

The generated sh file is trying to use the deprecated pub command instead of the respective dart or flutter pub command.
Going in the file and manually changing the line to:

dart pub global run high_supply:high_supply "$@"

solves the issue.

(changing it to flutter pub global run... does not, because the global activate was called using dart pub global activate and it will result in error saying no active package for ...)

Expected behavior

1.

dart pub global activate --source path . should generate:

#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
dart pub global run high_supply:high_supply "$@"

2

flutter pub global activate --source path . should generate:

#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
flutter pub global run high_supply:high_supply "$@"

in $pub_cache

Actual behavior

1.

dart pub global activate --source path . generates:

#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
pub global run high_supply:high_supply "$@"

2.

dart pub global activate --source path . generates:

#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
pub global run high_supply:high_supply "$@"
@raveesh-me
Copy link
Author

For now going in and changing the sh files likewise fixes things for me

@mit-mit
Copy link
Member

mit-mit commented Aug 4, 2021

Would it not be sufficient to use dart pub global run in both cases? That seems to work from a bit of local testing... ?

@mit-mit
Copy link
Member

mit-mit commented Aug 4, 2021

cc @jonasfj

@raveesh-me
Copy link
Author

@mit-mit I don't have context on why standalone pub was deprecated.

IF
the general way to run binaries without flutter dependencies is dart pub run and the way to run binaries with flutter dependencies is flutter pub run(for some use case I can't seem to fathom but let's suppose someone added an android interface plugin and wants to only use the dart bits)

THEN
it makes sense to have some way to keep track of what parent command ran the pub activate.

ALSO
When I activated my app with flutter pub global activate then dart pub global run said that there was no activated package.
I installed just the flutter snap on Ubuntu 20.04

All said, I have much less context/qualification to provide an answer to what would work. I can just test the scenarios and let you know what works.

@raveesh-me
Copy link
Author

raveesh-me commented Aug 4, 2021

For me as long as dart pub global activate and dart pub global run work, I am in a happy place.
(actually I do not even need to be aware about the dart pub global run part...)

@mit-mit
Copy link
Member

mit-mit commented Aug 5, 2021

There is background in dart-lang/sdk#46100.

@mit-mit
Copy link
Member

mit-mit commented Aug 5, 2021

@sigurdm it looks like this might already have been fixed (at least I'm not able to repro with 2.14)?

@sigurdm
Copy link
Contributor

sigurdm commented Aug 5, 2021

Yeah - seems it was fixed by: #3002 !

@sigurdm sigurdm closed this as completed Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants