Skip to content

Commit

Permalink
Try this
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger committed Mar 31, 2024
1 parent 8083fc9 commit d46b4af
Show file tree
Hide file tree
Showing 8 changed files with 250 additions and 164 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(
name = "rules_wpiformat",
version = "2023.34",
version = "2024.33",
compatibility_level = 1,
)

Expand Down
8 changes: 8 additions & 0 deletions generate/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from bazelrio_gentool.generate_module_project_files import (
create_default_mandatory_settings,
)
import subprocess


def main():
Expand Down Expand Up @@ -36,6 +37,13 @@ def main():
with open(os.path.join(REPO_DIR, "requirements.txt"), "w") as f:
f.write(f"wpiformat=={group.version}\n")

os.chdir(SCRIPT_DIR)
subprocess.check_call(
["buildifier.exe", "--lint=fix", "-warnings", "all", "-r", ".."]
)
os.chdir(REPO_DIR)
subprocess.check_call(["bazel", "run", "//:requirements.update"])


if __name__ == "__main__":
"""
Expand Down
2 changes: 1 addition & 1 deletion generate/get_wpiformat_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def get_wpiformat_group():
is_python=True,
include_wpiformat=False,
repo_name="rules_wpiformat",
version="2023.34",
version="2024.33",
year=1,
maven_url="",
)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
wpiformat==2023.34
wpiformat==2024.33
357 changes: 214 additions & 143 deletions requirements_lock.txt

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions wpiformat/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
load("@rules_python//python:defs.bzl", "py_binary")
load("@rules_wpiformat_pip//:requirements.bzl", "requirement")
load("@rules_wpiformat_pip//:requirements.bzl", "entry_point")

exports_files(["format.py"])
alias(
name = "wpiformat_wrapper", # <-- now I can use hatch as a label in this package
actual = entry_point("wpiformat"),
)

py_binary(
sh_binary(
name = "wpiformat",
srcs = ["format.py"],
main = "format.py",
tags = ["no-sandbox"],
visibility = ["//visibility:public"],
deps = [
requirement("wpiformat"),
],
srcs = ["wpiformat.sh"],
data = ["wpiformat_wrapper"],
deps = ["@bazel_tools//tools/bash/runfiles"],
)

exports_files(["format.py"])

sh_binary(
name = "format_registered_targets",
srcs = ["format_registered_targets.sh"],
Expand Down
7 changes: 0 additions & 7 deletions wpiformat/format.py

This file was deleted.

14 changes: 14 additions & 0 deletions wpiformat/wpiformat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# --- begin runfiles.bash initialization v2 ---
# Copy-pasted from the Bazel Bash runfiles library v2.
set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v2 ---

cd $BUILD_WORKSPACE_DIRECTORY
"$(rlocation rules_wpiformat/external/rules_wpiformat_pip_wpiformat/rules_python_wheel_entry_point_wpiformat.py)" $@

0 comments on commit d46b4af

Please sign in to comment.