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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dtolnay
Copy link

@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
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
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

Successfully merging this pull request may close these issues.

None yet

2 participants