From 031ccded0337e061e4ef31c935b130263e4c0e76 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Fri, 6 Jan 2023 18:36:41 -0800 Subject: [PATCH] chore: add MODULE.bazel file rules_swc 0.3.0 is published on bazel-central-registry, but we haven't kept it current. Part of #134 --- .github/workflows/ci.yaml | 5 +++++ MODULE.bazel | 19 +++++++++++++++++++ e2e/bzlmod/.bazelrc | 1 + e2e/bzlmod/.bazelversion | 1 + e2e/bzlmod/.swcrc | 1 + e2e/bzlmod/BUILD.bazel | 9 +++++++++ e2e/bzlmod/MODULE.bazel | 10 ++++++++++ e2e/bzlmod/WORKSPACE.bazel | 1 + e2e/bzlmod/foo.ts | 3 +++ 9 files changed, 50 insertions(+) create mode 100644 MODULE.bazel create mode 100644 e2e/bzlmod/.bazelrc create mode 120000 e2e/bzlmod/.bazelversion create mode 100644 e2e/bzlmod/.swcrc create mode 100644 e2e/bzlmod/BUILD.bazel create mode 100644 e2e/bzlmod/MODULE.bazel create mode 100644 e2e/bzlmod/WORKSPACE.bazel create mode 100644 e2e/bzlmod/foo.ts diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a961907..82ec5bc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,7 +44,12 @@ jobs: bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions) }} folder: - "." + - "e2e/bzlmod" - "e2e/workspace" + exclude: + # Don't test bzlmod with Bazel 5 (not supported) + - bazelversion: 5.3.2 + folder: e2e/bzlmod # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..1a45a48 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,19 @@ +"aspect-build/rules_swc" + +module( + name = "aspect_rules_swc", + compatibility_level = 1, + version = "0.0.0", +) + +bazel_dep(name = "aspect_bazel_lib", version = "1.19.0") +# Note: only used for provider symbols, we don't spawn nodejs actions +bazel_dep(name = "aspect_rules_js", version = "1.13.0") +bazel_dep(name = "bazel_skylib", version = "1.3.0") +bazel_dep(name = "platforms", version = "0.0.4") + +swc = use_extension("@aspect_rules_swc//swc:extensions.bzl", "swc") +swc.toolchain(name = "swc", swc_version = "v1.3.25") +use_repo(swc, "swc_toolchains") + +register_toolchains("@swc_toolchains//:all") diff --git a/e2e/bzlmod/.bazelrc b/e2e/bzlmod/.bazelrc new file mode 100644 index 0000000..3ce91d2 --- /dev/null +++ b/e2e/bzlmod/.bazelrc @@ -0,0 +1 @@ +common --enable_bzlmod diff --git a/e2e/bzlmod/.bazelversion b/e2e/bzlmod/.bazelversion new file mode 120000 index 0000000..96cf949 --- /dev/null +++ b/e2e/bzlmod/.bazelversion @@ -0,0 +1 @@ +../../.bazelversion \ No newline at end of file diff --git a/e2e/bzlmod/.swcrc b/e2e/bzlmod/.swcrc new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/e2e/bzlmod/.swcrc @@ -0,0 +1 @@ +{} diff --git a/e2e/bzlmod/BUILD.bazel b/e2e/bzlmod/BUILD.bazel new file mode 100644 index 0000000..786f099 --- /dev/null +++ b/e2e/bzlmod/BUILD.bazel @@ -0,0 +1,9 @@ +load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@aspect_rules_swc//swc:defs.bzl", "swc") + +swc(name = "compile") + +build_test( + name = "test", + targets = [":compile"], +) diff --git a/e2e/bzlmod/MODULE.bazel b/e2e/bzlmod/MODULE.bazel new file mode 100644 index 0000000..bb65389 --- /dev/null +++ b/e2e/bzlmod/MODULE.bazel @@ -0,0 +1,10 @@ +"Bazel dependencies" +module(name = "e2e_bzlmod") + +bazel_dep(name = "aspect_rules_swc", dev_dependency = True, version = "0.0.0") +bazel_dep(name = "bazel_skylib", dev_dependency = True, version = "1.3.0") + +local_path_override( + module_name = "aspect_rules_swc", + path = "../..", +) diff --git a/e2e/bzlmod/WORKSPACE.bazel b/e2e/bzlmod/WORKSPACE.bazel new file mode 100644 index 0000000..821590c --- /dev/null +++ b/e2e/bzlmod/WORKSPACE.bazel @@ -0,0 +1 @@ +# Empty marker that this folder is the root of a Bazel workspace diff --git a/e2e/bzlmod/foo.ts b/e2e/bzlmod/foo.ts new file mode 100644 index 0000000..6f11e25 --- /dev/null +++ b/e2e/bzlmod/foo.ts @@ -0,0 +1,3 @@ +export const hello = () => { + console.log("hello world"); +};