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

Register MODULE.bazel.lock as JSON and generated #6783

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

dtolnay
Copy link
Contributor

@dtolnay dtolnay commented Apr 4, 2024

Description

This PR makes Linguist recognize files named "MODULE.bazel.lock" as generated and also as JSON syntax.

Real-world examples:

Bazel (https://bazel.build) outputs these lockfile since version 6.2.0. Announcement: https://blog.bazel.build/2023/07/24/whats-new-with-bzlmod.html. More details about Bazel lockfiles: https://bazel.build/external/lockfile.

Checklist:

  • I am fixing a misclassified language

    • I have included a new sample for the misclassified language:
      • Sample source(s):
        • obtained by running mkdir bzlmod && cd bzlmod && touch MODULE.bazel && touch BUILD.bazel && bazel build ...
      • Sample license(s):
    • I have included a change to the heuristics to distinguish my language from others using the same extension.
  • I am adding new or changing current functionality

    • I have added or updated the tests for the new or changed functionality.

@dtolnay dtolnay requested a review from a team as a code owner April 4, 2024 02:57
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sample file is waaay too big so is suppressed by the diff by default as would be the case when this PR is merged. Is it possible to generate a smaller file?

@dtolnay
Copy link
Contributor Author

dtolnay commented Apr 4, 2024

The original MODULE.bazel.lock (1037 lines) is what Bazel generates for an empty repo, so I don't know a way to generate a smaller one. It tracks the transitive dependencies of the @bazel_tools repo, which is embedded in Bazel and included as a mandatory dependency of every project. Among other things, it exposes foundational concepts like the constraint definitions that determine Bazel's understanding of things like "os:linux" and "cpu:x86_64".

For now I have edited it manually to delete some verbose fields.

@lildude lildude changed the title Recognize Bazel's bzlmod lockfiles (MODULE.bazel.lock) Register MODULE.bazel.lock as JSON and generated Apr 4, 2024
@lildude lildude changed the title Register MODULE.bazel.lock as JSON and generated Register MODULE.bazel.lock as JSON and generated Apr 4, 2024
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

Note: this PR will not be merged until close to when the next release is made. See here for more details.

@lildude lildude added this pull request to the merge queue Jun 7, 2024
Merged via the queue into github-linguist:master with commit 9d2fd70 Jun 7, 2024
5 checks passed
@dtolnay dtolnay deleted the bzlmod branch June 7, 2024 12:13
@lildude lildude mentioned this pull request Jun 14, 2024
2 tasks
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants