Skip to content

Commit

Permalink
Passing tests locally
Browse files Browse the repository at this point in the history
  • Loading branch information
sputt committed Sep 9, 2024
1 parent b57d19c commit 3f9cd42
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 44 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
private/examples
.ijwb
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ coverage --combined_report=lcov
common:bes --bes_results_url=https://req-compile.buildbuddy.io/invocation/
common:bes --bes_backend=grpcs://req-compile.buildbuddy.io

# BuildBuddy suggested flags.
common --noslim_profile --experimental_profile_include_target_label --experimental_profile_include_primary_output
common --nolegacy_important_outputs
common --experimental_remote_cache_compression

# Attempt to import any CI flags
try-import %workspace%/.github/ci.bazelrc

Expand Down
6 changes: 1 addition & 5 deletions .github/release_notes.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

## Using bzlmod
```python
bazel_dep(name = "rules_req_compile", version = "0.0.0")
bazel_dep(name = "rules_req_compile")
archive_override(
module_name = "rules_req_compile",
integrity = "{integrity}",
urls = ["https://github.com/sputt/req-compile/releases/download/{version}/rules_req_compile-v{version}.tar.gz"],
)
```

Add to your bazelrc:
```text
common --experimental_isolated_extension_usages
```

Isolated extensions allow you to have multiple separate Python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: ["ubuntu-latest", windows-latest"]
platform: ["ubuntu-latest", "macos-14", "windows-latest"]
runs-on: ${{ matrix.platform }}
name: bazel test multiplatform_py_test --build ${{ matrix.platform }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ exports_files([

alias(
name = "buildifier",
actual = "//private:buildifier",
actual = "//private/tools:buildifier",
)

alias(
name = "buildifier.check",
actual = "//private:buildifier.check",
actual = "//private/tools:buildifier.check",
)
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module(
name = "rules_req_compile",
version = "1.0.0rc24",
version = "1.0.0rc25",
)

bazel_dep(name = "platforms", version = "0.0.9")
Expand Down
8 changes: 4 additions & 4 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions private/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("@rules_python//python:defs.bzl", "py_binary")

exports_files(
Expand Down Expand Up @@ -28,24 +27,3 @@ py_binary(
"@rules_python//python/runfiles",
],
)

buildifier(
name = "buildifier",
diff_command = "diff -u",
exclude_patterns = [
"./.git/*",
],
lint_mode = "fix",
visibility = ["//:__pkg__"],
)

buildifier(
name = "buildifier.check",
diff_command = "diff -u",
exclude_patterns = [
"./.git/*",
],
lint_mode = "warn",
mode = "diff",
visibility = ["//:__pkg__"],
)
16 changes: 8 additions & 8 deletions private/reqs_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def create_spoke_repos(spoke_prefix, constraints, interpreter):
if has_sdist:
print("WARNING: {} contains sdist dependencies and is not guaranteed to provide deterministic external repositories. Using a binary-only (all wheels) solution is recommended.".format(spoke_prefix)) # buildifier: disable=print

RULES_PYTHON_COMPAT = """\
_RULES_PYTHON_COMPAT = """\
\"\"\"A compatibility file with rules_python\"\"\"
load("@rules_req_compile//private:utils.bzl", "sanitize_package_name")
Expand All @@ -145,10 +145,10 @@ install_deps = repositories
def requirement(name):
\"\"\"rules_python compatibility macro\"\"\"
return "@{repository_name}" + "//:" + sanitize_package_name(name)
return Label("@{repository_name}" + "//:" + sanitize_package_name(name))
"""

BUILD_FILE_TEMPLATE = """\
_BUILD_FILE_TEMPLATE = """\
load(":defs.bzl", "requirement", "requirement_wheel")
package(default_visibility = ["//visibility:public"])
Expand Down Expand Up @@ -395,12 +395,12 @@ def _process_lockfile(ctx, hub_name, requirements_lock, annotations = None, cons

return packages

def _requirements_repository_common(repository_ctx):
def _requirements_repository_common(repository_ctx, hub_name):
repository_ctx.file("WORKSPACE.bazel", """workspace(name = "{}")""".format(
repository_ctx.name,
))
repository_ctx.file("requirements.bzl", RULES_PYTHON_COMPAT.format(
repository_name = repository_ctx.attr.hub_name,
repository_ctx.file("requirements.bzl", _RULES_PYTHON_COMPAT.format(
repository_name = hub_name,
))

_LOAD_TEMPLATE = """\
Expand Down Expand Up @@ -601,10 +601,10 @@ def _py_requirements_repository_impl(repository_ctx):
if len(defs) > 1:
repository_ctx.file("defs.bzl", generate_interface_bzl_content(defs, repository_ctx.name))

repository_ctx.file("BUILD.bazel", BUILD_FILE_TEMPLATE.format(
repository_ctx.file("BUILD.bazel", _BUILD_FILE_TEMPLATE.format(
packages = json.encode_indent(sorted(depset(all_packages).to_list()), indent = " " * 4),
))
_requirements_repository_common(repository_ctx)
_requirements_repository_common(repository_ctx, hub_name)

py_requirements_repository = repository_rule(
doc = """\
Expand Down
22 changes: 22 additions & 0 deletions private/tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

buildifier(
name = "buildifier",
diff_command = "diff -u",
exclude_patterns = [
"./.git/*",
],
lint_mode = "fix",
visibility = ["//:__pkg__"],
)

buildifier(
name = "buildifier.check",
diff_command = "diff -u",
exclude_patterns = [
"./.git/*",
],
lint_mode = "warn",
mode = "diff",
visibility = ["//:__pkg__"],
)
2 changes: 1 addition & 1 deletion version.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""req-compile version"""

VERSION = "1.0.0rc24"
VERSION = "1.0.0rc25"

0 comments on commit 3f9cd42

Please sign in to comment.