我想将一些文件复制到特定目录。
示例:
我有一些这样的文件
/scripts
build.js
test.js
start.js
/config
env.js
path.js
如何将scripts文件夹下的文件复制到一个名为scripts的文件夹中,并将config文件夹下的文件复制到另一个名为config的文件夹中。
#BUILD.bazel
filegroup(
name="react-test",
srcs=glob([
"scripts/**/*.js",
"config/**/*"
])
)
#Macro
def copy_gen(name):
native.genrule(
name = name,
srcs = ["//:react-test"],
outs = ["scripts", "config"],
cmd = "cp $SRCS @D", # What exactly do I do? Tried all sort
output_to_bindir = 1,
)
答案 0 :(得分:0)
现在我可以解决这个问题。
#BUILD.bazel
filegroup(
name="react-test",
srcs=[
"react-test" #folder to copy
]
)
genrule(
name = "copy",
srcs = [":react-test"],
outs = ["react-test"],
cmd = "cp -r $(SRCS) $(OUTS)"
)