diff --git a/tests/mappings/symlink/BUILD.bazel b/tests/mappings/symlink/BUILD.bazel new file mode 100644 index 00000000..db349b36 --- /dev/null +++ b/tests/mappings/symlink/BUILD.bazel @@ -0,0 +1,19 @@ +load(":node_modules_tree.bzl", "node_modules_tree") +load("//pkg/private/tar:tar.bzl", "pkg_tar") +load("@bazel_skylib//rules:build_test.bzl", "build_test") + +node_modules_tree( + name = "tree" +) + +pkg_tar( + name = "tar", + srcs = [ + ":tree" + ] +) + +build_test( + name = "test", + targets = [":tar"], +) \ No newline at end of file diff --git a/tests/mappings/symlink/node_modules_tree.bzl b/tests/mappings/symlink/node_modules_tree.bzl new file mode 100644 index 00000000..ae2723dd --- /dev/null +++ b/tests/mappings/symlink/node_modules_tree.bzl @@ -0,0 +1,26 @@ + + +def impl(ctx): + # packages + # - a + # - b depends on a + store_a = ctx.actions.declare_directory("node_modules/.pnpm/a@0.0.0/node_modules/a") + store_b = ctx.actions.declare_directory("node_modules/.pnpm/b@0.0.0/node_modules/b") + + ctx.actions.run_shell( + outputs = [store_a, store_b], + command = "echo 'test' > %s/package.json" % store_a.path + ) + + dep_symlink_b_to_a = ctx.actions.declare_file("node_modules/.pnpm/b@0.0.0/node_modules/a") + + ctx.actions.symlink( + output = dep_symlink_b_to_a, + target_file = store_a + ) + + return DefaultInfo(files = depset([store_a, store_b, dep_symlink_b_to_a])) + +node_modules_tree = rule( + implementation = impl, +) \ No newline at end of file