Skip to content

Commit

Permalink
fix: tracked down problem
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Oct 9, 2023
1 parent 0a6f161 commit 9c8190b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .aspect/workflows/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ workspaces:
- e2e/copy_to_directory:
gazelle:
without: true

bazel:
flags:
- --remote_download_minimal
- --nobuild_runfile_links
tasks:
branch_freshness:
gazelle:
Expand Down
5 changes: 4 additions & 1 deletion lib/private/tar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def _runfile_path(ctx, file, runfiles_dir):

def _calculate_runfiles_dir(root, default_info):
manifest = default_info.files_to_run.runfiles_manifest
return "/".join([r for r in [root, manifest.short_path.replace(manifest.basename, "")[:-1]] if r])
if manifest.short_path.endswith("_manifest") or manifest.short_path.endswith("/MANIFEST"):
# Trim last 9 characters, as that's the length in both cases
return "/".join([r for r in [root, manifest.short_path[:-9]] if r])
fail("manifest path {} seems malformed".format(manifest.short_path))

def _tar_impl(ctx):
bsdtar = ctx.toolchains["@aspect_bazel_lib//lib:tar_toolchain_type"]
Expand Down
13 changes: 13 additions & 0 deletions lib/tests/tar/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ tar(
srcs = [":some_program"],
)

assert_tar_listing(
name = "test_runfiles_listing",
actual = "tar_runfiles",
expected = [
"-rwxr-xr-x 0 0 0 744 Jan 1 2023 lib/tests/tar/some_program.sh",
"-rwxr-xr-x 0 0 0 744 Jan 1 2023 lib/tests/tar/some_program",
"-rwxr-xr-x 0 0 0 744 Jan 1 2023 lib/tests/tar/some_program.runfiles/aspect_bazel_lib/lib/tests/tar/some_program.sh",
"-rwxr-xr-x 0 0 0 744 Jan 1 2023 lib/tests/tar/some_program.runfiles/aspect_bazel_lib/lib/tests/tar/some_program",
"-rwxr-xr-x 0 0 0 21 Jan 1 2023 lib/tests/tar/some_program.runfiles/aspect_bazel_lib/lib/tests/tar/src_file",
"-rwxr-xr-x 0 0 0 17312 Jan 1 2023 lib/tests/tar/some_program.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash",
],
)

genrule(
name = "run_program_with_runfiles",
srcs = [":tar_runfiles"],
Expand Down

0 comments on commit 9c8190b

Please sign in to comment.