|
1 | | -load( |
2 | | - "//tools:erlang_toolchain.bzl", |
3 | | - "erlang_dirs", |
4 | | - "maybe_install_erlang", |
5 | | -) |
6 | 1 | load( |
7 | 2 | "//:erlang_app_info.bzl", |
8 | 3 | "ErlangAppInfo", |
|
12 | 7 | "//:util.bzl", |
13 | 8 | "path_join", |
14 | 9 | ) |
| 10 | +load( |
| 11 | + "//tools:erlang_toolchain.bzl", |
| 12 | + "erlang_dirs", |
| 13 | + "maybe_install_erlang", |
| 14 | +) |
15 | 15 | load( |
16 | 16 | ":util.bzl", |
17 | 17 | "additional_file_dest_relative_path", |
@@ -40,34 +40,35 @@ def _impl(ctx): |
40 | 40 | archive_path = "" |
41 | 41 | else: |
42 | 42 | archive_path = path_join(lib_info.app_name, "ebin") |
43 | | - elif ctx.attr.flat: |
44 | | - archive_path = src.basename |
45 | 43 | else: |
46 | | - archive_path = path_join(lib_info.app_name, "ebin", src.basename) |
47 | | - if archive_path in entries: |
48 | | - fail("Duplicate entry for", archive_path) |
| 44 | + if ctx.attr.flat: |
| 45 | + archive_path = src.basename |
| 46 | + else: |
| 47 | + archive_path = path_join(lib_info.app_name, "ebin", src.basename) |
| 48 | + if archive_path in entries: |
| 49 | + fail("Duplicate entry for %s: '%s'" % (src, archive_path)) |
49 | 50 | entries[archive_path] = src |
50 | 51 | for src in ([] if ctx.attr.drop_hrl else lib_info.include) + lib_info.priv: |
51 | | - rp = additional_file_dest_relative_path(dep.label, src) |
52 | 52 | if ctx.attr.flat: |
53 | 53 | archive_path = src.basename |
54 | 54 | else: |
| 55 | + rp = additional_file_dest_relative_path(dep.label, src) |
55 | 56 | archive_path = path_join(lib_info.app_name, rp) |
56 | 57 | if archive_path in entries: |
57 | | - fail("Duplicate entry for", archive_path) |
| 58 | + fail("Duplicate entry for %s: '%s'" % (src, archive_path)) |
58 | 59 | entries[archive_path] = src |
59 | 60 |
|
60 | 61 | commands = ["set -euo pipefail"] |
61 | 62 | for dest, src in entries.items(): |
62 | 63 | full_dest = path_join(contents_dir.path, dest) |
63 | 64 | commands.append('mkdir -p $(dirname "{}")'.format(full_dest)) |
64 | 65 | if src.is_directory: |
65 | | - commands.append("cp -r {src}/ {dest}".format( |
| 66 | + commands.append('mkdir -p "{dest}" && cp -r "{src}"/* "{dest}"'.format( |
66 | 67 | src = src.path, |
67 | 68 | dest = full_dest, |
68 | 69 | )) |
69 | 70 | else: |
70 | | - commands.append("cp {src} {dest}".format( |
| 71 | + commands.append('cp "{src}" "{dest}"'.format( |
71 | 72 | src = src.path, |
72 | 73 | dest = full_dest, |
73 | 74 | )) |
|
0 commit comments