I tried to create directories and copy the files from one directory to the created ones :
genrule(
name = "copyoffiles",
srcs = ["files/conf/version1-conf.xml", "files/src/version1.sh"],
cmd = """
mkdir share
mkdir share/conf
mkdir bin
cp $(SRCS) $(@D)
""",
outs = ["share/conf", "bin"],
)
Where the requirement is to get the file(which ends with .xml) under share/conf and file(ends with .sh) under bin folder
But when i am trying to run with bazel , i am facing below issue
LD:85:1: declared output 'share/conf' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely).
And also i tried with different ways where i am getting the files under bazel-genfiles without any folder structure if i keep OUTS = ["version1-conf.xml", "version1.sh"]
output structure : bazel-genfiles/version1-conf.xml , bazel-genfiles/version1.sh
Required output structure : bazel-genfiles/share/conf/version1-conf.xml , bazel-genfiles/bin/version1.sh