From c363f5619bd80d375cb17a4de178d73727eae5f9 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 16 Oct 2023 16:33:02 -0700 Subject: [PATCH 1/3] feat: support WORKSPACE --- .github/workflows/ci.yaml | 4 +- .github/workflows/release_prep.sh | 15 ++++ README.md | 5 -- example/.bazelrc | 1 - example/BUILD.bazel | 14 +++- example/WORKSPACE.bazel | 122 +++++++++++++++++++++++++++++- example/WORKSPACE.bzlmod | 26 +++++++ example/tools/BUILD | 14 +++- 8 files changed, 186 insertions(+), 15 deletions(-) create mode 100644 example/WORKSPACE.bzlmod diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7a55e0ba..ed5bc714 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,5 +20,5 @@ jobs: uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v5 with: folders: '[".", "example"]' - # Only test with Bazel 6 and bzlmod enabled. And we don't try for Windows support yet. - exclude: '[{"bazelversion": "5.4.0"}, {"bzlmodEnabled": false}, {"os": "windows-latest"}]' + # Only test with Bazel 6. And we don't try for Windows support yet. + exclude: '[{"bazelversion": "5.4.0"}, {"os": "windows-latest"}]' diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh index cb4e3bb3..0e6c2f75 100755 --- a/.github/workflows/release_prep.sh +++ b/.github/workflows/release_prep.sh @@ -24,5 +24,20 @@ bazel_dep(name = "aspect_rules_lint", version = "${TAG:1}") # - linting: https://github.com/aspect-build/rules_lint/blob/${TAG}/docs/linting.md # - formatting: https://github.com/aspect-build/rules_lint/blob/${TAG}/docs/formatting.md \`\`\` + +## Using WORKSPACE + +Paste this snippet into your `WORKSPACE.bazel` file: + +\`\`\`starlark +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_archive( + name = "aspect_rules_lint", + sha256 = "${SHA}", + strip_prefix = "${PREFIX}", + url = "https://github.com/aspect-build/rules_lint/releases/download/${TAG}/${ARCHIVE}", +) EOF +awk 'f;/--SNIP--/{f=1}' example/WORKSPACE.bazel +echo "\`\`\`" \ No newline at end of file diff --git a/README.md b/README.md index d61737e1..97e7230e 100644 --- a/README.md +++ b/README.md @@ -89,11 +89,6 @@ Thanks!! ## Installation -rules_lint currently only works with bzlmod under Bazel 6+. -This is because we accumulate dependencies which are difficult to express -in a WORKSPACE file. -We might add support for WORKSPACE in the future. - Follow instructions from the release you wish to use: diff --git a/example/.bazelrc b/example/.bazelrc index 3ce91d27..e69de29b 100644 --- a/example/.bazelrc +++ b/example/.bazelrc @@ -1 +0,0 @@ -common --enable_bzlmod diff --git a/example/BUILD.bazel b/example/BUILD.bazel index c818a940..c2844cdf 100644 --- a/example/BUILD.bazel +++ b/example/BUILD.bazel @@ -22,11 +22,21 @@ exports_files( visibility = ["//visibility:public"], ) +# Need different target for bzlmod: https://github.com/bazelbuild/rules_python/issues/1493 +py_console_script_binary( + name = "flake8_w_bzlmod", + pkg = "@pip//flake8:pkg", + script = "flake8", +) + # We can test that it works with: # bazel run :flake8 -- --help -py_console_script_binary( +alias( name = "flake8", - pkg = "@pip//flake8:pkg", + actual = select({ + "@aspect_bazel_lib//lib:bzlmod": ":flake8_w_bzlmod", + "//conditions:default": "@pip_flake8//:rules_python_wheel_entry_point_flake8", + }), ) eslint_bin.eslint_binary(name = "eslint") diff --git a/example/WORKSPACE.bazel b/example/WORKSPACE.bazel index 37e39e55..c82c1799 100644 --- a/example/WORKSPACE.bazel +++ b/example/WORKSPACE.bazel @@ -1,7 +1,123 @@ -# Marker that this is the root of a Bazel workspace +# Override http_archive for local testing +local_repository( + name = "aspect_rules_lint", + path = "..", +) + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "rules_python", + sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b", + strip_prefix = "rules_python-0.26.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz", +) + +load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") + +py_repositories() + +python_register_toolchains( + name = "python39", + python_version = "3.9", +) + +load("@python39//:defs.bzl", "interpreter") +load("@rules_python//python:pip.bzl", "pip_parse") + +pip_parse( + name = "pip", + python_interpreter_target = interpreter, + requirements_lock = "//:requirements.txt", +) + +load("@pip//:requirements.bzl", "install_deps") + +install_deps() + +http_archive( + name = "aspect_rules_js", + sha256 = "7ab9776bcca823af361577a1a2ebb9a30d2eb5b94ecc964b8be360f443f714b2", + strip_prefix = "rules_js-1.32.6", + url = "https://github.com/aspect-build/rules_js/releases/download/v1.32.6/rules_js-v1.32.6.tar.gz", +) + +load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") + +rules_js_dependencies() + +load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains") + +nodejs_register_toolchains( + name = "nodejs", + node_version = DEFAULT_NODE_VERSION, +) + +load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock") + +npm_translate_lock( + name = "npm", + npmrc = "//:.npmrc", + pnpm_lock = "//:pnpm-lock.yaml", + verify_node_modules_ignored = "//:.bazelignore", +) + +load("@npm//:repositories.bzl", "npm_repositories") + +npm_repositories() + +http_archive( + name = "aspect_rules_ts", + sha256 = "8aabb2055629a7becae2e77ae828950d3581d7fc3602fe0276e6e039b65092cb", + strip_prefix = "rules_ts-2.0.0", + url = "https://github.com/aspect-build/rules_ts/releases/download/v2.0.0/rules_ts-v2.0.0.tar.gz", +) + +load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies") + +rules_ts_dependencies( + ts_version_from = "//:package.json", +) + +http_archive( + name = "buildifier_prebuilt", + sha256 = "72b5bb0853aac597cce6482ee6c62513318e7f2c0050bc7c319d75d03d8a3875", + strip_prefix = "buildifier-prebuilt-6.3.3", + urls = [ + "http://github.com/keith/buildifier-prebuilt/archive/6.3.3.tar.gz", + ], +) + +load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps") + +buildifier_prebuilt_deps() + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + +load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains") + +buildifier_prebuilt_register_toolchains() + +http_archive( + name = "io_bazel_rules_go", + sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") + +go_rules_dependencies() + +go_register_toolchains(version = "1.20.3") + +#---SNIP--- Below here is re-used in the workspace snippet published on releases -# Support repos that aren't on bazel central registry -# Needed until Bazel 7 allows MODULE.bazel to directly call repository rules +# Use whichever formatter binaries you need: load( "@aspect_rules_lint//format:repositories.bzl", "fetch_java_format", diff --git a/example/WORKSPACE.bzlmod b/example/WORKSPACE.bzlmod new file mode 100644 index 00000000..471e1172 --- /dev/null +++ b/example/WORKSPACE.bzlmod @@ -0,0 +1,26 @@ +# Marker that this is the root of a Bazel workspace +# This file shadows WORKSPACE.bazel under --enable_bzlmod. + +# Support repos that aren't on bazel central registry +# Needed until Bazel 7 allows MODULE.bazel to directly call repository rules +load( + "@aspect_rules_lint//format:repositories.bzl", + "fetch_java_format", + "fetch_jsonnet", + "fetch_ktfmt", + "fetch_pmd", + "fetch_swiftformat", + "fetch_terraform", +) + +fetch_pmd() + +fetch_jsonnet() + +fetch_terraform() + +fetch_java_format() + +fetch_ktfmt() + +fetch_swiftformat() diff --git a/example/tools/BUILD b/example/tools/BUILD index 4e111661..f6946343 100644 --- a/example/tools/BUILD +++ b/example/tools/BUILD @@ -29,10 +29,20 @@ alias( }), ) -# bazel run :black -- --help +# Need different target for bzlmod: https://github.com/bazelbuild/rules_python/issues/1493 py_console_script_binary( - name = "black", + name = "black_w_bzlmod", pkg = "@pip//black:pkg", + script = "black", +) + +# bazel run :black -- --help +alias( + name = "black", + actual = select({ + "@aspect_bazel_lib//lib:bzlmod": ":black_w_bzlmod", + "//conditions:default": "@pip_black//:rules_python_wheel_entry_point_black", + }), ) prettier.prettier_binary( From cf4aed9c7683e646a2b153df8b2b749ca9bcb324 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 16 Oct 2023 16:56:19 -0700 Subject: [PATCH 2/3] fix: typescript real version --- example/BUILD.bazel | 2 ++ example/package.json | 2 +- example/pnpm-lock.yaml | 58 ++++++++++++++++++++---------------------- example/tools/BUILD | 2 ++ 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/example/BUILD.bazel b/example/BUILD.bazel index c2844cdf..a6c7c34a 100644 --- a/example/BUILD.bazel +++ b/example/BUILD.bazel @@ -27,6 +27,8 @@ py_console_script_binary( name = "flake8_w_bzlmod", pkg = "@pip//flake8:pkg", script = "flake8", + # Doesn't build without --enable_bzlmod + tags = ["manual"], ) # We can test that it works with: diff --git a/example/package.json b/example/package.json index eb6980a5..5ae3a1f2 100644 --- a/example/package.json +++ b/example/package.json @@ -3,7 +3,7 @@ "eslint": "*", "@typescript-eslint/parser": "*", "@typescript-eslint/eslint-plugin": "*", - "typescript": "5.0", + "typescript": "5.1.6", "prettier": "^2.8.7", "prettier-plugin-sh": "^0.12.8", "prettier-plugin-sql": "^0.14.0" diff --git a/example/pnpm-lock.yaml b/example/pnpm-lock.yaml index 6d41462a..9c8a6995 100644 --- a/example/pnpm-lock.yaml +++ b/example/pnpm-lock.yaml @@ -9,16 +9,16 @@ specifiers: prettier: ^2.8.7 prettier-plugin-sh: ^0.12.8 prettier-plugin-sql: ^0.14.0 - typescript: "5.0" + typescript: 5.1.6 devDependencies: - "@typescript-eslint/eslint-plugin": 5.59.1_2utyh6gct5glvuz6qwradubqqa - "@typescript-eslint/parser": 5.59.1_iacogk7kkaymxepzhgcbytyi7q + "@typescript-eslint/eslint-plugin": 5.59.1_oc5llfnnp4vv2f5u7pdjhfr7im + "@typescript-eslint/parser": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi eslint: 8.39.0 prettier: 2.8.8_whkmnyg4gs3djzcukwmxxipg5m prettier-plugin-sh: 0.12.8_prettier@2.8.8 prettier-plugin-sql: 0.14.0_prettier@2.8.8 - typescript: 5.0.4 + typescript: 5.1.6 packages: /@eslint-community/eslint-utils/4.4.0_eslint@8.39.0: @@ -182,7 +182,7 @@ packages: } dev: true - /@typescript-eslint/eslint-plugin/5.59.1_2utyh6gct5glvuz6qwradubqqa: + /@typescript-eslint/eslint-plugin/5.59.1_oc5llfnnp4vv2f5u7pdjhfr7im: resolution: { integrity: sha512-AVi0uazY5quFB9hlp2Xv+ogpfpk77xzsgsIEWyVS7uK/c7MZ5tw7ZPbapa0SbfkqE0fsAMkz5UwtgMLVk2BQAg==, @@ -199,23 +199,23 @@ packages: optional: true dependencies: "@eslint-community/regexpp": 4.5.0 - "@typescript-eslint/parser": 5.59.1_iacogk7kkaymxepzhgcbytyi7q + "@typescript-eslint/parser": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi "@typescript-eslint/scope-manager": 5.59.1 - "@typescript-eslint/type-utils": 5.59.1_iacogk7kkaymxepzhgcbytyi7q - "@typescript-eslint/utils": 5.59.1_iacogk7kkaymxepzhgcbytyi7q + "@typescript-eslint/type-utils": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi + "@typescript-eslint/utils": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi debug: 4.3.4 eslint: 8.39.0 grapheme-splitter: 1.0.4 ignore: 5.2.4 natural-compare-lite: 1.4.0 semver: 7.5.0 - tsutils: 3.21.0_typescript@5.0.4 - typescript: 5.0.4 + tsutils: 3.21.0_typescript@5.1.6 + typescript: 5.1.6 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.59.1_iacogk7kkaymxepzhgcbytyi7q: + /@typescript-eslint/parser/5.59.1_r3724j5iuqp55tatnrcjg2wbdi: resolution: { integrity: sha512-nzjFAN8WEu6yPRDizIFyzAfgK7nybPodMNFGNH0M9tei2gYnYszRDqVA0xlnRjkl7Hkx2vYrEdb6fP2a21cG1g==, @@ -232,10 +232,10 @@ packages: dependencies: "@typescript-eslint/scope-manager": 5.59.1 "@typescript-eslint/types": 5.59.1 - "@typescript-eslint/typescript-estree": 5.59.1_typescript@5.0.4 + "@typescript-eslint/typescript-estree": 5.59.1_typescript@5.1.6 debug: 4.3.4 eslint: 8.39.0 - typescript: 5.0.4 + typescript: 5.1.6 transitivePeerDependencies: - supports-color dev: true @@ -253,7 +253,7 @@ packages: "@typescript-eslint/visitor-keys": 5.59.1 dev: true - /@typescript-eslint/type-utils/5.59.1_iacogk7kkaymxepzhgcbytyi7q: + /@typescript-eslint/type-utils/5.59.1_r3724j5iuqp55tatnrcjg2wbdi: resolution: { integrity: sha512-ZMWQ+Oh82jWqWzvM3xU+9y5U7MEMVv6GLioM3R5NJk6uvP47kZ7YvlgSHJ7ERD6bOY7Q4uxWm25c76HKEwIjZw==, @@ -268,12 +268,12 @@ packages: typescript: optional: true dependencies: - "@typescript-eslint/typescript-estree": 5.59.1_typescript@5.0.4 - "@typescript-eslint/utils": 5.59.1_iacogk7kkaymxepzhgcbytyi7q + "@typescript-eslint/typescript-estree": 5.59.1_typescript@5.1.6 + "@typescript-eslint/utils": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi debug: 4.3.4 eslint: 8.39.0 - tsutils: 3.21.0_typescript@5.0.4 - typescript: 5.0.4 + tsutils: 3.21.0_typescript@5.1.6 + typescript: 5.1.6 transitivePeerDependencies: - supports-color dev: true @@ -288,7 +288,7 @@ packages: engines: { node: ^12.22.0 || ^14.17.0 || >=16.0.0 } dev: true - /@typescript-eslint/typescript-estree/5.59.1_typescript@5.0.4: + /@typescript-eslint/typescript-estree/5.59.1_typescript@5.1.6: resolution: { integrity: sha512-lYLBBOCsFltFy7XVqzX0Ju+Lh3WPIAWxYpmH/Q7ZoqzbscLiCW00LeYCdsUnnfnj29/s1WovXKh2gwCoinHNGA==, @@ -308,13 +308,13 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.0 - tsutils: 3.21.0_typescript@5.0.4 - typescript: 5.0.4 + tsutils: 3.21.0_typescript@5.1.6 + typescript: 5.1.6 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.59.1_iacogk7kkaymxepzhgcbytyi7q: + /@typescript-eslint/utils/5.59.1_r3724j5iuqp55tatnrcjg2wbdi: resolution: { integrity: sha512-MkTe7FE+K1/GxZkP5gRj3rCztg45bEhsd8HYjczBuYm+qFHP5vtZmjx3B0yUCDotceQ4sHgTyz60Ycl225njmA==, @@ -330,7 +330,7 @@ packages: "@types/semver": 7.3.13 "@typescript-eslint/scope-manager": 5.59.1 "@typescript-eslint/types": 5.59.1 - "@typescript-eslint/typescript-estree": 5.59.1_typescript@5.0.4 + "@typescript-eslint/typescript-estree": 5.59.1_typescript@5.1.6 eslint: 8.39.0 eslint-scope: 5.1.1 semver: 7.5.0 @@ -1996,7 +1996,7 @@ packages: } dev: true - /tsutils/3.21.0_typescript@5.0.4: + /tsutils/3.21.0_typescript@5.1.6: resolution: { integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==, @@ -2008,7 +2008,7 @@ packages: typescript: ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" dependencies: tslib: 1.14.1 - typescript: 5.0.4 + typescript: 5.1.6 dev: true /type-check/0.4.0: @@ -2033,14 +2033,12 @@ packages: engines: { node: ">=10" } dev: true - /typescript/5.0.4: + /typescript/5.1.6: resolution: { - integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==, - registry: https://registry.npmjs.com/, - tarball: https://registry.npmjs.com/typescript/-/typescript-5.0.4.tgz, + integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==, } - engines: { node: ">=12.20" } + engines: { node: ">=14.17" } hasBin: true dev: true diff --git a/example/tools/BUILD b/example/tools/BUILD index f6946343..b1a4af25 100644 --- a/example/tools/BUILD +++ b/example/tools/BUILD @@ -34,6 +34,8 @@ py_console_script_binary( name = "black_w_bzlmod", pkg = "@pip//black:pkg", script = "black", + # Doesn't build without --enable_bzlmod + tags = ["manual"], ) # bazel run :black -- --help From ce038157a89b2f90f923d6ccbb87b12c5305dc71 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 16 Oct 2023 17:55:43 -0700 Subject: [PATCH 3/3] fix: python thanks to @aignas --- example/.bazelversion | 2 +- example/BUILD.bazel | 16 ++---------- example/WORKSPACE.bazel | 24 +++++++++++++----- example/package.json | 2 +- example/pnpm-lock.yaml | 56 ++++++++++++++++++++--------------------- example/tools/BUILD | 16 ++---------- 6 files changed, 52 insertions(+), 64 deletions(-) diff --git a/example/.bazelversion b/example/.bazelversion index 96cf9496..b3326049 120000 --- a/example/.bazelversion +++ b/example/.bazelversion @@ -1 +1 @@ -../../.bazelversion \ No newline at end of file +../.bazelversion \ No newline at end of file diff --git a/example/BUILD.bazel b/example/BUILD.bazel index a6c7c34a..c818a940 100644 --- a/example/BUILD.bazel +++ b/example/BUILD.bazel @@ -22,23 +22,11 @@ exports_files( visibility = ["//visibility:public"], ) -# Need different target for bzlmod: https://github.com/bazelbuild/rules_python/issues/1493 -py_console_script_binary( - name = "flake8_w_bzlmod", - pkg = "@pip//flake8:pkg", - script = "flake8", - # Doesn't build without --enable_bzlmod - tags = ["manual"], -) - # We can test that it works with: # bazel run :flake8 -- --help -alias( +py_console_script_binary( name = "flake8", - actual = select({ - "@aspect_bazel_lib//lib:bzlmod": ":flake8_w_bzlmod", - "//conditions:default": "@pip_flake8//:rules_python_wheel_entry_point_flake8", - }), + pkg = "@pip//flake8:pkg", ) eslint_bin.eslint_binary(name = "eslint") diff --git a/example/WORKSPACE.bazel b/example/WORKSPACE.bazel index c82c1799..ee20a2ec 100644 --- a/example/WORKSPACE.bazel +++ b/example/WORKSPACE.bazel @@ -27,6 +27,7 @@ load("@rules_python//python:pip.bzl", "pip_parse") pip_parse( name = "pip", + incompatible_generate_aliases = True, python_interpreter_target = interpreter, requirements_lock = "//:requirements.txt", ) @@ -68,9 +69,9 @@ npm_repositories() http_archive( name = "aspect_rules_ts", - sha256 = "8aabb2055629a7becae2e77ae828950d3581d7fc3602fe0276e6e039b65092cb", - strip_prefix = "rules_ts-2.0.0", - url = "https://github.com/aspect-build/rules_ts/releases/download/v2.0.0/rules_ts-v2.0.0.tar.gz", + sha256 = "8eb25d1fdafc0836f5778d33fb8eaac37c64176481d67872b54b0a05de5be5c0", + strip_prefix = "rules_ts-1.3.3", + url = "https://github.com/aspect-build/rules_ts/releases/download/v1.3.3/rules_ts-v1.3.3.tar.gz", ) load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies") @@ -102,10 +103,10 @@ buildifier_prebuilt_register_toolchains() http_archive( name = "io_bazel_rules_go", - sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023", + sha256 = "51dc53293afe317d2696d4d6433a4c33feedb7748a9e352072e2ec3c0dafd2c6", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip", ], ) @@ -115,6 +116,17 @@ go_rules_dependencies() go_register_toolchains(version = "1.20.3") +http_archive( + name = "com_google_protobuf", + sha256 = "d7d204a59fd0d2d2387bd362c2155289d5060f32122c4d1d922041b61191d522", + strip_prefix = "protobuf-3.21.5", + urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.5.tar.gz"], +) + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + #---SNIP--- Below here is re-used in the workspace snippet published on releases # Use whichever formatter binaries you need: diff --git a/example/package.json b/example/package.json index 5ae3a1f2..afab9fe0 100644 --- a/example/package.json +++ b/example/package.json @@ -3,7 +3,7 @@ "eslint": "*", "@typescript-eslint/parser": "*", "@typescript-eslint/eslint-plugin": "*", - "typescript": "5.1.6", + "typescript": "4.9.5", "prettier": "^2.8.7", "prettier-plugin-sh": "^0.12.8", "prettier-plugin-sql": "^0.14.0" diff --git a/example/pnpm-lock.yaml b/example/pnpm-lock.yaml index 9c8a6995..f31f1922 100644 --- a/example/pnpm-lock.yaml +++ b/example/pnpm-lock.yaml @@ -9,16 +9,16 @@ specifiers: prettier: ^2.8.7 prettier-plugin-sh: ^0.12.8 prettier-plugin-sql: ^0.14.0 - typescript: 5.1.6 + typescript: 4.9.5 devDependencies: - "@typescript-eslint/eslint-plugin": 5.59.1_oc5llfnnp4vv2f5u7pdjhfr7im - "@typescript-eslint/parser": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi + "@typescript-eslint/eslint-plugin": 5.59.1_jsr5owskg7irefkzbmq6cipclm + "@typescript-eslint/parser": 5.59.1_tbtvr3a5zwdiktqy4vlmx63mqq eslint: 8.39.0 prettier: 2.8.8_whkmnyg4gs3djzcukwmxxipg5m prettier-plugin-sh: 0.12.8_prettier@2.8.8 prettier-plugin-sql: 0.14.0_prettier@2.8.8 - typescript: 5.1.6 + typescript: 4.9.5 packages: /@eslint-community/eslint-utils/4.4.0_eslint@8.39.0: @@ -182,7 +182,7 @@ packages: } dev: true - /@typescript-eslint/eslint-plugin/5.59.1_oc5llfnnp4vv2f5u7pdjhfr7im: + /@typescript-eslint/eslint-plugin/5.59.1_jsr5owskg7irefkzbmq6cipclm: resolution: { integrity: sha512-AVi0uazY5quFB9hlp2Xv+ogpfpk77xzsgsIEWyVS7uK/c7MZ5tw7ZPbapa0SbfkqE0fsAMkz5UwtgMLVk2BQAg==, @@ -199,23 +199,23 @@ packages: optional: true dependencies: "@eslint-community/regexpp": 4.5.0 - "@typescript-eslint/parser": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi + "@typescript-eslint/parser": 5.59.1_tbtvr3a5zwdiktqy4vlmx63mqq "@typescript-eslint/scope-manager": 5.59.1 - "@typescript-eslint/type-utils": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi - "@typescript-eslint/utils": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi + "@typescript-eslint/type-utils": 5.59.1_tbtvr3a5zwdiktqy4vlmx63mqq + "@typescript-eslint/utils": 5.59.1_tbtvr3a5zwdiktqy4vlmx63mqq debug: 4.3.4 eslint: 8.39.0 grapheme-splitter: 1.0.4 ignore: 5.2.4 natural-compare-lite: 1.4.0 semver: 7.5.0 - tsutils: 3.21.0_typescript@5.1.6 - typescript: 5.1.6 + tsutils: 3.21.0_typescript@4.9.5 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.59.1_r3724j5iuqp55tatnrcjg2wbdi: + /@typescript-eslint/parser/5.59.1_tbtvr3a5zwdiktqy4vlmx63mqq: resolution: { integrity: sha512-nzjFAN8WEu6yPRDizIFyzAfgK7nybPodMNFGNH0M9tei2gYnYszRDqVA0xlnRjkl7Hkx2vYrEdb6fP2a21cG1g==, @@ -232,10 +232,10 @@ packages: dependencies: "@typescript-eslint/scope-manager": 5.59.1 "@typescript-eslint/types": 5.59.1 - "@typescript-eslint/typescript-estree": 5.59.1_typescript@5.1.6 + "@typescript-eslint/typescript-estree": 5.59.1_typescript@4.9.5 debug: 4.3.4 eslint: 8.39.0 - typescript: 5.1.6 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true @@ -253,7 +253,7 @@ packages: "@typescript-eslint/visitor-keys": 5.59.1 dev: true - /@typescript-eslint/type-utils/5.59.1_r3724j5iuqp55tatnrcjg2wbdi: + /@typescript-eslint/type-utils/5.59.1_tbtvr3a5zwdiktqy4vlmx63mqq: resolution: { integrity: sha512-ZMWQ+Oh82jWqWzvM3xU+9y5U7MEMVv6GLioM3R5NJk6uvP47kZ7YvlgSHJ7ERD6bOY7Q4uxWm25c76HKEwIjZw==, @@ -268,12 +268,12 @@ packages: typescript: optional: true dependencies: - "@typescript-eslint/typescript-estree": 5.59.1_typescript@5.1.6 - "@typescript-eslint/utils": 5.59.1_r3724j5iuqp55tatnrcjg2wbdi + "@typescript-eslint/typescript-estree": 5.59.1_typescript@4.9.5 + "@typescript-eslint/utils": 5.59.1_tbtvr3a5zwdiktqy4vlmx63mqq debug: 4.3.4 eslint: 8.39.0 - tsutils: 3.21.0_typescript@5.1.6 - typescript: 5.1.6 + tsutils: 3.21.0_typescript@4.9.5 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true @@ -288,7 +288,7 @@ packages: engines: { node: ^12.22.0 || ^14.17.0 || >=16.0.0 } dev: true - /@typescript-eslint/typescript-estree/5.59.1_typescript@5.1.6: + /@typescript-eslint/typescript-estree/5.59.1_typescript@4.9.5: resolution: { integrity: sha512-lYLBBOCsFltFy7XVqzX0Ju+Lh3WPIAWxYpmH/Q7ZoqzbscLiCW00LeYCdsUnnfnj29/s1WovXKh2gwCoinHNGA==, @@ -308,13 +308,13 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.0 - tsutils: 3.21.0_typescript@5.1.6 - typescript: 5.1.6 + tsutils: 3.21.0_typescript@4.9.5 + typescript: 4.9.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.59.1_r3724j5iuqp55tatnrcjg2wbdi: + /@typescript-eslint/utils/5.59.1_tbtvr3a5zwdiktqy4vlmx63mqq: resolution: { integrity: sha512-MkTe7FE+K1/GxZkP5gRj3rCztg45bEhsd8HYjczBuYm+qFHP5vtZmjx3B0yUCDotceQ4sHgTyz60Ycl225njmA==, @@ -330,7 +330,7 @@ packages: "@types/semver": 7.3.13 "@typescript-eslint/scope-manager": 5.59.1 "@typescript-eslint/types": 5.59.1 - "@typescript-eslint/typescript-estree": 5.59.1_typescript@5.1.6 + "@typescript-eslint/typescript-estree": 5.59.1_typescript@4.9.5 eslint: 8.39.0 eslint-scope: 5.1.1 semver: 7.5.0 @@ -1996,7 +1996,7 @@ packages: } dev: true - /tsutils/3.21.0_typescript@5.1.6: + /tsutils/3.21.0_typescript@4.9.5: resolution: { integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==, @@ -2008,7 +2008,7 @@ packages: typescript: ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" dependencies: tslib: 1.14.1 - typescript: 5.1.6 + typescript: 4.9.5 dev: true /type-check/0.4.0: @@ -2033,12 +2033,12 @@ packages: engines: { node: ">=10" } dev: true - /typescript/5.1.6: + /typescript/4.9.5: resolution: { - integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==, + integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==, } - engines: { node: ">=14.17" } + engines: { node: ">=4.2.0" } hasBin: true dev: true diff --git a/example/tools/BUILD b/example/tools/BUILD index b1a4af25..4e111661 100644 --- a/example/tools/BUILD +++ b/example/tools/BUILD @@ -29,22 +29,10 @@ alias( }), ) -# Need different target for bzlmod: https://github.com/bazelbuild/rules_python/issues/1493 -py_console_script_binary( - name = "black_w_bzlmod", - pkg = "@pip//black:pkg", - script = "black", - # Doesn't build without --enable_bzlmod - tags = ["manual"], -) - # bazel run :black -- --help -alias( +py_console_script_binary( name = "black", - actual = select({ - "@aspect_bazel_lib//lib:bzlmod": ":black_w_bzlmod", - "//conditions:default": "@pip_black//:rules_python_wheel_entry_point_black", - }), + pkg = "@pip//black:pkg", ) prettier.prettier_binary(