Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/fennel/basic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fennel_library(

fennel_binary(
name = "main",
data = ["data.txt"],
tool = "main.fnl",
deps = [":example"],
)
Expand Down
1 change: 1 addition & 0 deletions examples/fennel/basic/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from data
4 changes: 4 additions & 0 deletions examples/fennel/basic/main.fnl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
(local example (require :fennel.basic.example))
(local runfiles (require :runfiles))

(print (example.add-2 2))

(with-open [f (assert (io.open (runfiles.rlocation :fennel/basic/data.txt)))]
(print (f:read :*l)))
4 changes: 2 additions & 2 deletions examples/fennel/basic/main_outside_runfiles_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ cd "$TEST_TMPDIR"

out=$("$bin")
echo "runfiles tree: $out"
[[ "$out" == 4 ]]
[[ "$out" == $'4\nfrom data' ]]

out=$(env -u RUNFILES_DIR RUNFILES_MANIFEST_FILE="$TEST_TMPDIR/MANIFEST" "$bin")
echo "manifest only: $out"
[[ "$out" == 4 ]]
[[ "$out" == $'4\nfrom data' ]]
6 changes: 3 additions & 3 deletions lua/private/binary_wrapper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ if os.getenv("RUNFILES_DIR") then
return load_resolved(mapping[2] .. "." .. module_name:gsub(real_module_toplevel_name, mapping[2]))
end)
elseif os.getenv("RUNFILES_MANIFEST_FILE") then
local manifest = {}

local function rlocation(workspace_relative)
error("not implemented")
return manifest["_main/" .. workspace_relative]
end

package.preload["runfiles"] = function()
Expand All @@ -198,8 +200,6 @@ elseif os.getenv("RUNFILES_MANIFEST_FILE") then
inverted[v[1]] = k
end

local manifest = {}

for line in io.lines(os.getenv("RUNFILES_MANIFEST_FILE")) do
local t = {}
-- // a manifest file that maps logical runfile paths to absolute paths paths for the real files in Bazel's cache.
Expand Down