Skip to content

Commit

Permalink
Add bazel type for Bazel modules
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Nov 22, 2024
1 parent 2997e87 commit 67f2dbb
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
23 changes: 23 additions & 0 deletions PURL-TYPES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,29 @@ apk
pkg:apk/alpine/[email protected]?arch=x86
pkg:apk/alpine/[email protected]?arch=x86

bazel
-----
``bazel`` for Bazel modules:

- The default repository ("registry") is ``https://bcr.bazel.build``, the
Bazel Central Registry (BCR).
- The ``name`` is the module name. It must be lowercased.
- The ``version`` is the module version in `Bazel's relaxed semver format
<https://bazel.build/external/module#version_format>`_.
- The optional ``repository_url`` can be used to specify the URL of an
alternative registry, with any trailing forward slashes removed.
- The optional ``subpath`` can name a particular Bazel target in the module via
a label with the leading double slash (``//``) removed and canonicalized by
omitting the target name if it is equal to the name of the containing package.
- Examples::

pkg:bazel/[email protected]
pkg:bazel/[email protected]
pkg:bazel/[email protected]?repository_url=https://example.org/bazel-registry
pkg:bazel/[email protected]
pkg:bazel/[email protected]#toolchains:singlejar
pkg:bazel/[email protected]#go

bitbucket
---------
``bitbucket`` for Bitbucket-based packages:
Expand Down
84 changes: 84 additions & 0 deletions test-suite-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -622,5 +622,89 @@
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "bazel module with default registry",
"purl": "pkg:bazel/[email protected]?registry_url=https://bcr.bazel.build/",
"canonical_purl": "pkg:bazel/[email protected]",
"type": "bazel",
"namespace": null,
"name": "rules_java",
"version": "7.8.0",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "bazel module with custom registry",
"purl": "pkg:bazel/[email protected]?registry_url=https://example.org/bazel-registry/",
"canonical_purl": "pkg:bazel/[email protected]?registry_url=https://example.org/bazel-registry",
"type": "bazel",
"namespace": null,
"name": "rules_java",
"version": "7.8.0",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "bazel module with relaxed semver version",
"purl": "pkg:bazel/[email protected]",
"canonical_purl": "pkg:bazel/[email protected]",
"type": "bazel",
"namespace": null,
"name": "curl",
"version": "8.8.0.bcr.1",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "bazel module names are lowercased",
"purl": "pkg:bazel/[email protected]",
"canonical_purl": "pkg:bazel/[email protected]",
"type": "bazel",
"namespace": null,
"name": "curl",
"version": "8.8.0.bcr.1",
"qualifiers": null,
"subpath": null,
"is_invalid": true
},
{
"description": "bazel module with target",
"purl": "pkg:bazel/[email protected]#//toolchains:singlejar",
"canonical_purl": "pkg:bazel/[email protected]#toolchains:singlejar",
"type": "bazel",
"namespace": null,
"name": "rules_java",
"version": "7.8.0",
"qualifiers": null,
"subpath": "toolchains:singlejar",
"is_invalid": false
},
{
"description": "bazel module with target in short-hand form",
"purl": "pkg:bazel/[email protected]#//go:go",
"canonical_purl": "pkg:bazel/[email protected]#go",
"type": "bazel",
"namespace": null,
"name": "rules_go",
"version": "0.48.0",
"qualifiers": null,
"subpath": "go",
"is_invalid": false
},
{
"description": "bazel module with top-level target",
"purl": "pkg:bazel/[email protected]#//:stdlib",
"canonical_purl": "pkg:bazel/[email protected]#:stdlib",
"type": "bazel",
"namespace": null,
"name": "rules_go",
"version": "0.48.0",
"qualifiers": null,
"subpath": ":stdlib",
"is_invalid": false
}
]

0 comments on commit 67f2dbb

Please sign in to comment.