bazelbuild / rules_appengine

AppEngine rules for Bazel
Apache License 2.0
30 stars 51 forks source link

For Java rules, files from multiple Labels of data attribute are flattened in war file #112

Open jiaqi opened 4 years ago

jiaqi commented 4 years ago

In https://github.com/bazelbuild/rules_appengine/blob/master/appengine/java_appengine.bzl#L82

    if path and in_file.short_path.startswith(path):
        output_path += in_file.short_path[len(path):]

when in_file.short_path does not start with path, what happens is output_path will remain output, the root directory of war file. And eventually ln -s $(pwd)/%s %s creates in_file symlink at the root directory, and ignores the directory structure of in_file.

If multiple files from different directories have the same name, one will overwrite the other.

I believe the desired behavior is to preserve the original directory structure of in_file and create symlink at output_path/in_file.path instead of output_path. I've got it working in a fork, it looks roughly like this

https://github.com/jiaqi/rules_appengine/pull/1/files#diff-3b8b4a89deffca2ab1dabfb178ff7012

If it make sense I can create a PR.