Skip to content

gonzojive/rules_go_local_repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rules_go_local_repo

An esoteric tool for making modifications to dependent libraries for bazel.

  • Addresses bazelbuild/rules_go#283
  • serves a zip file with the contents of a directory over HTTP
  • Whenever the directory contents are updated, updates a bazel WORKSPACE repository rule

Setup

Assume you have a WORKSPACE.bazel:

go_repository(
    name = "com_example_some_repo",
    sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz",
    ],
    type = "zip",
)

Running from a local installation of the tool

go install github.com/gonzojive/rules_go_local_repo@latest
rules_go_local_repo --alsologtostderr --input "/home/person/git/my_copy_of_dep" --rule_name "com_example_some_repo" --workspace "/home/person/git/my_repo/WORKSPACE"

The WORKSPACE.bazel file will be continuously updated to something like the following:

go_repository(
    name = "com_example_some_repo",
    sha256 = "a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447",
    urls = ["http://localhost:8673/by-sha256/a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447.zip"],
    type = "zip",
)

Running from bazel

bazel run @com_gonzojive_rules_go_local_repo//:rules_go_local_repo -- --alsologtostderr --input "/home/person/git/my_copy" --rule_name "com_example_some_repo" --workspace "/home/person/git/my_copy"

After installing the dependency in your WORKSPACE:

# TODO