Skip to content

dart pub deps --json should output git hash for git source #4511

Closed
@dcharkes

Description

@dcharkes

For dart-lang/native#1962 (comment), I'd need dart pub deps --json to additionally output a git hash/ref:

{
  "packages": [
    {
      "name": "webcrypto",
      "version": "0.5.7",
      "kind": "direct",
      "source": "git",
      "ref": "...",
      "dependencies": [
        "ffi",
        "meta",
        "flutter_web_plugins",
        "flutter"
      ],
      "directDependencies": [
        "ffi",
        "meta",
        "flutter_web_plugins",
        "flutter"
      ]
    },
  ]
}

Alternatively, we could reverse engineer it from the path in the .package_config.json, but that means relying on pub internals, which sounds like a bad idea.

Activity

jonasfj

jonasfj commented on Feb 20, 2025

@jonasfj
Member

Why don't you just hardcode the git ref in the pubspec.yaml or even in the dependencies_override section.

sigurdm

sigurdm commented on Feb 20, 2025

@sigurdm
Contributor

Also this information is already available in pubspec.lock.

dcharkes

dcharkes commented on Feb 20, 2025

@dcharkes
ContributorAuthor

Why don't you just hardcode the git ref in the pubspec.yaml or even in the dependencies_override section.

It's not me defining the git dependency, it is our users.

However, @jonasfj and I had a long discussion 2 weeks where the conclusion was that we probably want something more declarative for prebuilt binaries, rather than a general system-shared directory to be used arbitrarily in hooks (dart-lang/native#1962 (comment)). And then we wouldn't need the git hash.

We could use the git hash to shortcut hashing all files, but @sigurdm mentioned he'd rather provide an immutable bool than exposing whether something is published, git, or root.

So, I believe I have no current use cases. Let me close this issue, and reopen it if I come up with one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @jonasfj@dcharkes@sigurdm

        Issue actions

          `dart pub deps --json` should output git hash for git source · Issue #4511 · dart-lang/pub