rules_go_local_repo

command module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

README

rules_go_local_repo

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

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/?sha256=a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447"],
    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

Documentation

Overview

Program local_repo_http_server is used to quickly serve a .zip file with the contents of a directory.

This works around an issue with go_repository not supporting local paths. The solution as implemented here is to bring up a local http server. In addition, the hash of the zip file is updated in the WORKSPACE file rule so that bazel knows to refresh the repository.

Directories

Path Synopsis
util

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL