GithubHelp home page GithubHelp logo

Migrate to bazel modules about santa HOT 2 OPEN

russellhancox avatar russellhancox commented on August 24, 2024
Migrate to bazel modules

from santa.

Comments (2)

russellhancox avatar russellhancox commented on August 24, 2024

This is still not as easy as it should be.

I've gone through the current dependencies in the WORKSPACE and found this list:

  • com_google_absl
  • com_google_protobuf
  • rules_python
  • build_bazel_rules_apple
  • hedron_compile_commands
  • com_google_googletest
  • MOLAuthenticatingURLSession
  • MOLCertificate
  • MOLCodesignChecker
  • MOLXPCConnection
  • FMDB
  • OCMock
  • rules_go
  • bazel_gazelle
  • com_github_groob_moroz
  • Go toolchain 1.19.3
  • rules_python_fuzz
  • rules_fuzzing

The rules repositories have full module support and there are ways to add non-module repos like we currently do (OCMock, FMDB, MOL*).

The most problematic repository right now is com_google_protobuf, which is in the bazel central registry but not the current version that we're in the middle of upgrading to (26.1) and the old version that is in the registry (23.1) won't compile on macOS (error: unused function 'CodepointSkipBackwards')

While we wait for that to be fixed, I can get on with adding MODULE.bazel files to the MOL* repositories, which will make using those much easier.

For ref, here's the MODULE.bazel I have right now:

module(name = "santa")

bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "abseil-cpp", version = "20240116.1")

bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_apple", version = "3.5.0", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_swift", version = "1.18.0")

bazel_dep(name = "protobuf", version = "23.1", repo_name = "com_google_protobuf")

bazel_dep(name = "googletest", version = "1.14.0.bcr.1")

bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
git_override(
    module_name = "hedron_compile_commands",
    remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
    commit = "0e990032f3c5a866e72615cf67e5ce22186dcb97",
    # Replace the commit hash (above) with the latest (https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main).
    # Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README).
)

non_module_deps = use_extension("//:non_module_deps.bzl", "non_module_deps")
use_repo(non_module_deps, "MOLAuthenticatingURLSession")
use_repo(non_module_deps, "MOLCodesignChecker")
use_repo(non_module_deps, "MOLCertificate")
use_repo(non_module_deps, "MOLXPCConnection")
use_repo(non_module_deps, "FMDB")
use_repo(non_module_deps, "OCMock")

The non_module_deps.bzl is very simple:

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

def _non_module_deps_impl(ctx):
  # Macops Library dependencies haven't (yet) upgraded to Bazel modules.
  git_repository(
    name = "MOLAuthenticatingURLSession",
    remote = "https://github.com/google/macops-molauthenticatingurlsession.git",
    commit = "38b5ee46edb262481b16f950266a11d8cb77127c",
    shallow_since = "1671479898 -0500",
  )
  ...

  # FMDB is used to access SQLite from Objective-C(++) code.
  git_repository(
    name = "FMDB",
    remote = "https://github.com/ccgus/fmdb.git",
    commit = "61e51fde7f7aab6554f30ab061cc588b28a97d04",
    shallow_since = "1589301502 -0700",
    build_file_content = """
objc_library(
    name = "FMDB",
    srcs = glob(["src/fmdb/*.m"], exclude=["src/fmdb.m"]),
    hdrs = glob(["src/fmdb/*.h"]),
    includes = ["src"],
    sdk_dylibs = ["sqlite3"],
    visibility = ["//visibility:public"],
)
""",
  )

non_module_deps = module_extension(implementation = _non_module_deps_impl)

from santa.

russellhancox avatar russellhancox commented on August 24, 2024

All that's left now is the Go dependencies to run Moroz for the integration test.

  • com_google_absl
  • com_google_protobuf
  • rules_python
  • build_bazel_rules_apple
  • hedron_compile_commands
  • com_google_googletest
  • MOLAuthenticatingURLSession
  • MOLCertificate
  • MOLCodesignChecker
  • MOLXPCConnection
  • FMDB
  • OCMock
  • rules_go
  • rules_python_fuzz
  • rules_fuzzing
  • io_bazel_rules_go
  • bazel_gazelle
  • com_github_groob_moroz
  • Go toolchain 1.19.3

from santa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.