generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: bzlmod * Update WORKSPACE.bzlmod * fix e2e
- Loading branch information
Showing
17 changed files
with
144 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fixedReleaser: | ||
login: gregmagolan | ||
email: [email protected] |
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,13 @@ | ||
{ | ||
"homepage": "https://docs.aspect.build/rules/aspect_rules_rollup", | ||
"maintainers": [ | ||
{ | ||
"email": "[email protected]", | ||
"github": "aspect-build", | ||
"name": "Aspect team" | ||
} | ||
], | ||
"repository": ["github:aspect-build/rules_rollup"], | ||
"versions": [], | ||
"yanked_versions": {} | ||
} |
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,10 @@ | ||
bcr_test_module: | ||
module_path: 'e2e/smoke' | ||
matrix: | ||
platform: ['debian10', 'macos', 'ubuntu2004', 'windows'] | ||
tasks: | ||
run_tests: | ||
name: 'Run test module' | ||
platform: ${{ platform }} | ||
test_targets: | ||
- '//...' |
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,5 @@ | ||
{ | ||
"integrity": "**leave this alone**", | ||
"strip_prefix": "{REPO}-{VERSION}", | ||
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_rollup-{TAG}.tar.gz" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"aspect-build/rules_rollup" | ||
|
||
module( | ||
name = "aspect_rules_rollup", | ||
compatibility_level = 1, | ||
version = "0.0.0", | ||
) | ||
|
||
# Lower-bound (minimum) versions of direct dependencies | ||
bazel_dep(name = "bazel_skylib", version = "1.3.0") | ||
# Need #397 to skip stardoc targets | ||
bazel_dep(name = "aspect_bazel_lib", version = "1.30.2") | ||
# Need attribute 'dev' in 'npm_package_store_internal' rule | ||
bazel_dep(name = "aspect_rules_js", version = "1.19.0") | ||
bazel_dep(name = "rules_nodejs", version = "5.5.3") | ||
bazel_dep(name = "platforms", version = "0.0.5") | ||
|
||
rollup = use_extension("@aspect_rules_rollup//rollup:extensions.bzl", "rollup") | ||
rollup.toolchain(name = "rollup", rollup_version = "v2.70.2") | ||
use_repo(rollup, "rollup") |
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
File renamed without changes.
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,16 @@ | ||
load("@aspect_rules_rollup//rollup:defs.bzl", "rollup") | ||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
rollup( | ||
name = "bundle", | ||
entry_point = "main.js", | ||
node_modules = "//:node_modules", | ||
) | ||
|
||
build_test( | ||
name = "test", | ||
targets = [":bundle"], | ||
) |
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,18 @@ | ||
"Bazel dependencies" | ||
bazel_dep(name = "aspect_rules_rollup", dev_dependency = True, version = "0.0.0") | ||
bazel_dep(name = "bazel_skylib", dev_dependency = True, version = "1.3.0") | ||
bazel_dep(name = "aspect_rules_js", dev_dependency = True, version = "1.24.1") | ||
|
||
local_path_override( | ||
module_name = "aspect_rules_rollup", | ||
path = "../..", | ||
) | ||
|
||
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm") | ||
|
||
npm.npm_translate_lock( | ||
name = "npm", | ||
pnpm_lock = "@aspect_rules_rollup//:pnpm-lock.yaml", | ||
) | ||
|
||
use_repo(npm, "npm") |
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,4 @@ | ||
# smoke test | ||
|
||
This e2e exercises the repo from an end-users perpective. | ||
It catches mistakes in our install instructions, or usages that fail when called from an "external" repository to rules_rollup. |
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,2 @@ | ||
# Marker file that this is the root of a Bazel workspace | ||
# This file shadows WORKSPACE.bazel when --enable_bzlmod is true |
File renamed without changes.
File renamed without changes.
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,37 @@ | ||
"extensions for bzlmod" | ||
|
||
load(":repositories.bzl", "rollup_repositories") | ||
|
||
rollup_toolchain = tag_class(attrs = { | ||
"name": attr.string(doc = "Base name for generated repositories"), | ||
"rollup_version": attr.string(doc = "Explicit version of rollup."), | ||
# TODO: support this variant | ||
# "rollup_version_from": attr.string(doc = "Location of package.json which may have a version for @rollup/core."), | ||
}) | ||
|
||
def _toolchain_extension(module_ctx): | ||
registrations = {} | ||
for mod in module_ctx.modules: | ||
for toolchain in mod.tags.toolchain: | ||
if toolchain.name in registrations.keys(): | ||
if toolchain.rollup_version == registrations[toolchain.name]: | ||
# No problem to register a matching toolchain twice | ||
continue | ||
fail("Multiple conflicting toolchains declared for name {} ({} and {}".format( | ||
toolchain.name, | ||
toolchain.rollup_version, | ||
registrations[toolchain.name], | ||
)) | ||
else: | ||
registrations[toolchain.name] = toolchain.rollup_version | ||
for name, rollup_version in registrations.items(): | ||
rollup_repositories( | ||
name = name, | ||
rollup_version = rollup_version, | ||
register = False, | ||
) | ||
|
||
rollup = module_extension( | ||
implementation = _toolchain_extension, | ||
tag_classes = {"toolchain": rollup_toolchain}, | ||
) |