Skip to content

Bazel and bazel central registry support #136

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

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

zaucy
Copy link
Contributor

@zaucy zaucy commented Jul 12, 2022

I mainly use bazel as my build system and I was wondering if pcre2 would be willing to accept these files upstream to add pcre2 to the bazel central registry. I can write patches for the repository and submit it that way, but it is preferred to have them in the repository.

At the moment this is a minimal configuration that successfully runs the pcre2demo. e.g.

bazel run //:pcre2demo -- -g "\\w+" "hello world"
Match succeeded at offset 0
 0: hello
No named substrings

Match succeeded again at offset 6
 0: world
No named substrings

If this was accepted and submited to the bazel central registry then bazel users would only have to add the following to their MODULE.bazel.

bazel_dep(name = "pcre2", version = "10.40")

And then any target that uses pcre2 would simply be added to their deps list.

cc_library(
    name = "my_cool_library_that_uses_pcre2",
    # ...
    deps = [
        # ...
        "@pcre2",
    ],
)

I'm happy to add tests that cover bazel and make any other modifications you require.

@PhilipHazel
Copy link
Collaborator

Am I right in thinking this just involves adding some files to the GitHub repo (and a minor tweak to .gitignore)? Or would it be necessary also to include these files in the release tarballs?

@zaucy
Copy link
Contributor Author

zaucy commented Jul 13, 2022

Just the GitHub repo is fine. Unless you'd prefer one of the tarball over the repository archive to be in the bazel central registry. e.g. https://github.com/bazelbuild/bazel-central-registry/blob/main/modules/zlib/1.2.11/source.json#L8

@PhilipHazel PhilipHazel marked this pull request as ready for review July 15, 2022 16:17
@PhilipHazel PhilipHazel merged commit e47fc51 into PCRE2Project:master Jul 15, 2022
@PhilipHazel
Copy link
Collaborator

OK, I have merged this pull request but it's up to you or any other Bazel user to do any necessary maintenance. I note that MODULE.bazel contains the PCRE2 version number. Will that have to be updated for each release?

@zaucy
Copy link
Contributor Author

zaucy commented Jul 15, 2022

Yeah the version will have to be updated each release. Is there a script I can modify to make that happen? PrepareRelease?

@PhilipHazel
Copy link
Collaborator

PrepareRelease is probably the right place to do something like that. Unfortunately, it does not at the moment make any use of the release number, so you would have to write code to pick that out of configure.ac. PrepareRelease already makes use of Perl, so adding a short in-line Perl script would be fine.

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.

2 participants