I would like to copy some files to specific directories.
Example:
I have some files structured like this
/scripts
build.js
test.js
start.js
/config
env.js
path.js
How do you copy files under the scripts folder into a folder called scripts and files under the config folder into another folder called 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,
)
Now I can solve this.
#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)"
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.