Skip to content

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

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

Closed
dcharkes opened this issue Feb 4, 2025 · 3 comments
Closed

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

dcharkes opened this issue Feb 4, 2025 · 3 comments

Comments

@dcharkes
Copy link
Contributor

dcharkes commented Feb 4, 2025

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.

@jonasfj
Copy link
Member

jonasfj commented Feb 20, 2025

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

@sigurdm
Copy link
Contributor

sigurdm commented Feb 20, 2025

Also this information is already available in pubspec.lock.

@dcharkes
Copy link
Contributor Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants