-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
67 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit -o nounset -o pipefail | ||
|
||
# Set by GH actions, see | ||
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables | ||
TAG=${GITHUB_REF_NAME} | ||
PREFIX="rules_swc-${TAG:1}" | ||
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}') | ||
|
||
cat << EOF | ||
WORKSPACE snippet: | ||
\`\`\`starlark | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "aspect_rules_swc", | ||
sha256 = "${SHA}", | ||
strip_prefix = "${PREFIX}", | ||
url = "https://github.com/aspect-build/rules_swc/archive/${TAG}.tar.gz", | ||
) | ||
# Fetches the rules_swc dependencies. | ||
# If you want to have a different version of some dependency, | ||
# you should fetch it *before* calling this. | ||
# Alternatively, you can skip calling this function, so long as you've | ||
# already fetched all the dependencies. | ||
load("@aspect_rules_swc//swc:dependencies.bzl", "rules_swc_dependencies") | ||
rules_swc_dependencies() | ||
# Fetches a pre-built Rust-node binding from | ||
# https://github.com/swc-project/swc/releases. | ||
# If you'd rather compile it from source, you can use rules_rust, fetch the project, | ||
# then register the toolchain yourself. (Note, this is not yet documented) | ||
load("@aspect_rules_swc//swc:repositories.bzl", "swc_register_toolchains") | ||
swc_register_toolchains( | ||
name = "swc", | ||
swc_version = "v1.2.118", | ||
) | ||
# Fetches a NodeJS interpreter, needed to run the swc CLI. | ||
# You can skip this if you already register a nodejs toolchain. | ||
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") | ||
nodejs_register_toolchains( | ||
name = "node16", | ||
node_version = "16.9.0", | ||
) | ||
# Fetches the npm packages needed to run @swc/cli | ||
load("@swc_cli//:repositories.bzl", _swc_cli_deps = "npm_repositories") | ||
_swc_cli_deps() | ||
\`\`\` | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters