Skip to content

Commit

Permalink
Merge pull request #1 from thiago-farias/fs-non-src-files
Browse files Browse the repository at this point in the history
Add support to non source files in fs rule.
  • Loading branch information
thiago-farias authored May 19, 2020
2 parents 544bb76 + 9c1931d commit d42861e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/utility/fs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,23 @@ def _impl(ctx):
file_basename = aspect.basename
fsinfo_file.append(aspect)
runfiles.append(aspect)
dirname = aspect.dirname
if not aspect.is_source:
path_list = aspect.short_path.split("/")
dirname = "/".join(path_list[:-1])
if ctx.attr.stamp:
file_basename = "${STAMP}-" + aspect.basename

dbfs_filepath = paths.join(aspects.dbfs_files_dirname + paths.join(aspect.dirname, file_basename))
dbfs_filepath = paths.join(aspects.dbfs_files_dirname + paths.join(dirname, file_basename))
fsinfo_filespath.append(dbfs_filepath)

OPTIONS=""
ARGS=""

local_path = aspect.short_path
if aspect.is_source:
local_path = aspect.path

if api_cmd == "ls":
OPTIONS = "-l --absolute"
ARGS = "%s" % (dbfs_filepath)
Expand All @@ -97,7 +105,7 @@ def _impl(ctx):

if api_cmd == "cp":
OPTIONS = "--overwrite"
ARGS = "%s %s" % (aspect.path,dbfs_filepath)
ARGS = "%s %s" % (local_path,dbfs_filepath)

cmd.append(cmd_template.format(OPTIONS = OPTIONS, ARGS = ARGS))

Expand Down

0 comments on commit d42861e

Please sign in to comment.