| 
									
										
										
										
											2023-05-12 15:26:13 +08:00
										 |  |  | load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files") | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  | load("@rules_pkg//:pkg.bzl", "pkg_tar") | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  | load("@rules_erlang//:erlang_app_info.bzl", "ErlangAppInfo", "flat_deps") | 
					
						
							|  |  |  | load("@rules_erlang//:util.bzl", "path_join") | 
					
						
							|  |  |  | load("@rules_erlang//:ct.bzl", "additional_file_dest_relative_path") | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  | load( | 
					
						
							|  |  |  |     "@rules_erlang//tools:erlang_toolchain.bzl", | 
					
						
							|  |  |  |     "erlang_dirs", | 
					
						
							| 
									
										
										
										
											2022-06-08 16:07:16 +08:00
										 |  |  |     "maybe_install_erlang", | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2022-06-09 16:52:09 +08:00
										 |  |  | load("@rules_erlang//:source_tree.bzl", "source_tree") | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  | load( | 
					
						
							|  |  |  |     ":rabbitmq_home.bzl", | 
					
						
							|  |  |  |     "RABBITMQ_HOME_ATTRS", | 
					
						
							| 
									
										
										
										
											2022-12-07 22:47:43 +08:00
										 |  |  |     "copy_escript", | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |     "flatten", | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | load( | 
					
						
							|  |  |  |     ":rabbitmq.bzl", | 
					
						
							|  |  |  |     "APP_VERSION", | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def _collect_licenses_impl(ctx): | 
					
						
							|  |  |  |     srcs = ctx.files.srcs + flatten([ | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |         d[ErlangAppInfo].license_files | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |         for d in flat_deps(ctx.attr.deps) | 
					
						
							|  |  |  |     ]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     outs = {} | 
					
						
							|  |  |  |     for src in srcs: | 
					
						
							|  |  |  |         name = src.basename | 
					
						
							|  |  |  |         if name not in outs: | 
					
						
							|  |  |  |             dest = ctx.actions.declare_file(name) | 
					
						
							|  |  |  |             ctx.actions.run( | 
					
						
							|  |  |  |                 inputs = [src], | 
					
						
							|  |  |  |                 outputs = [dest], | 
					
						
							|  |  |  |                 executable = "cp", | 
					
						
							|  |  |  |                 arguments = [ | 
					
						
							|  |  |  |                     src.path, | 
					
						
							|  |  |  |                     dest.path, | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |             outs[name] = dest | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return [ | 
					
						
							|  |  |  |         DefaultInfo( | 
					
						
							|  |  |  |             files = depset(sorted(outs.values())), | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | collect_licenses = rule( | 
					
						
							|  |  |  |     implementation = _collect_licenses_impl, | 
					
						
							|  |  |  |     attrs = { | 
					
						
							|  |  |  |         "srcs": attr.label_list(allow_files = True), | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |         "deps": attr.label_list(providers = [ErlangAppInfo]), | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def _copy_script(ctx, script): | 
					
						
							|  |  |  |     dest = ctx.actions.declare_file(path_join(ctx.label.name, "sbin", script.basename)) | 
					
						
							|  |  |  |     ctx.actions.expand_template( | 
					
						
							|  |  |  |         template = script, | 
					
						
							|  |  |  |         output = dest, | 
					
						
							|  |  |  |         substitutions = { | 
					
						
							|  |  |  |             "SYS_PREFIX=": "SYS_PREFIX=${RABBITMQ_HOME}", | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     return dest | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  | def _sbin_dir_private_impl(ctx): | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  |     scripts = [_copy_script(ctx, script) for script in ctx.files._scripts] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  |     return [ | 
					
						
							|  |  |  |         DefaultInfo( | 
					
						
							|  |  |  |             files = depset(scripts), | 
					
						
							|  |  |  |         ), | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  | def _escript_dir_private_impl(ctx): | 
					
						
							| 
									
										
										
										
											2023-05-01 16:32:59 +08:00
										 |  |  |     escripts = [copy_escript(ctx, escript) for escript in ctx.files._escripts] | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return [ | 
					
						
							|  |  |  |         DefaultInfo( | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  |             files = depset(escripts), | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  |         ), | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  | sbin_dir_private = rule( | 
					
						
							|  |  |  |     implementation = _sbin_dir_private_impl, | 
					
						
							|  |  |  |     attrs = RABBITMQ_HOME_ATTRS, | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | escript_dir_private = rule( | 
					
						
							|  |  |  |     implementation = _escript_dir_private_impl, | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  |     attrs = RABBITMQ_HOME_ATTRS, | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  | def sbin_dir(**kwargs): | 
					
						
							|  |  |  |     sbin_dir_private( | 
					
						
							|  |  |  |         is_windows = select({ | 
					
						
							|  |  |  |             "@bazel_tools//src/conditions:host_windows": True, | 
					
						
							|  |  |  |             "//conditions:default": False, | 
					
						
							|  |  |  |         }), | 
					
						
							|  |  |  |         **kwargs | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def escript_dir(**kwargs): | 
					
						
							|  |  |  |     escript_dir_private( | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  |         is_windows = select({ | 
					
						
							|  |  |  |             "@bazel_tools//src/conditions:host_windows": True, | 
					
						
							|  |  |  |             "//conditions:default": False, | 
					
						
							|  |  |  |         }), | 
					
						
							|  |  |  |         **kwargs | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-23 21:47:41 +08:00
										 |  |  | def _extract_version(lib_info): | 
					
						
							|  |  |  |     for f in lib_info.beam: | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |         if f.basename.endswith(".app"): | 
					
						
							| 
									
										
										
										
											2023-02-23 21:47:41 +08:00
										 |  |  |             return "erl -eval '{ok, [{application, _, AppInfo}]} = file:consult(\"" + f.path + "\"), Version = proplists:get_value(vsn, AppInfo), io:fwrite(Version), halt().' -noshell" | 
					
						
							|  |  |  |     if len(lib_info.beam) == 1 and lib_info.beam[0].is_directory: | 
					
						
							|  |  |  |         return "erl -eval '{ok, [{application, _, AppInfo}]} = file:consult(\"" + lib_info.beam[0].path + "/" + lib_info.app_name + ".app\"), Version = proplists:get_value(vsn, AppInfo), io:fwrite(Version), halt().' -noshell" | 
					
						
							|  |  |  |     fail("could not find .app file in", lib_info.beam) | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  | def _versioned_plugins_dir_impl(ctx): | 
					
						
							|  |  |  |     plugins = flat_deps(ctx.attr.plugins) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |     plugins_dir = ctx.actions.declare_directory(path_join(ctx.label.name, "plugins")) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |     (erlang_home, _, runfiles) = erlang_dirs(ctx) | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |     inputs = runfiles.files.to_list() | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |     commands = [ | 
					
						
							|  |  |  |         "set -euo pipefail", | 
					
						
							|  |  |  |         "", | 
					
						
							| 
									
										
										
										
											2022-06-08 16:07:16 +08:00
										 |  |  |         maybe_install_erlang(ctx), | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |     ] | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-01 16:32:59 +08:00
										 |  |  |     commands.append( | 
					
						
							|  |  |  |         "echo 'Put your EZs here and use rabbitmq-plugins to enable them.' > {plugins_dir}/README".format( | 
					
						
							|  |  |  |             plugins_dir = plugins_dir.path, | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |     for plugin in plugins: | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |         lib_info = plugin[ErlangAppInfo] | 
					
						
							| 
									
										
										
										
											2023-02-23 21:47:41 +08:00
										 |  |  |         version = _extract_version(lib_info) | 
					
						
							|  |  |  |         commands.append("PLUGIN_VERSION=$({erlang_home}/bin/{version})".format( | 
					
						
							|  |  |  |             erlang_home = erlang_home, | 
					
						
							|  |  |  |             version = version, | 
					
						
							|  |  |  |         )) | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         commands.append( | 
					
						
							|  |  |  |             "mkdir -p {plugins_dir}/{lib_name}-$PLUGIN_VERSION/include".format( | 
					
						
							|  |  |  |                 plugins_dir = plugins_dir.path, | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |                 lib_name = lib_info.app_name, | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |             ), | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         for f in lib_info.include: | 
					
						
							|  |  |  |             commands.append( | 
					
						
							|  |  |  |                 "cp {src} {plugins_dir}/{lib_name}-$PLUGIN_VERSION/include/{dest}".format( | 
					
						
							|  |  |  |                     src = f.path, | 
					
						
							|  |  |  |                     plugins_dir = plugins_dir.path, | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |                     lib_name = lib_info.app_name, | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |                     dest = f.basename, | 
					
						
							|  |  |  |                 ), | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |         inputs.extend(lib_info.include) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         commands.append( | 
					
						
							|  |  |  |             "mkdir -p {plugins_dir}/{lib_name}-$PLUGIN_VERSION/ebin".format( | 
					
						
							|  |  |  |                 plugins_dir = plugins_dir.path, | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |                 lib_name = lib_info.app_name, | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |             ), | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         for f in lib_info.beam: | 
					
						
							|  |  |  |             if f.is_directory: | 
					
						
							|  |  |  |                 if f.basename != "ebin": | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |                     fail("{} contains a directory in 'beam' that is not an ebin dir".format(lib_info.app_name)) | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |                 commands.append( | 
					
						
							|  |  |  |                     "cp -R {src} {plugins_dir}/{lib_name}-$PLUGIN_VERSION".format( | 
					
						
							|  |  |  |                         src = f.path, | 
					
						
							|  |  |  |                         plugins_dir = plugins_dir.path, | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |                         lib_name = lib_info.app_name, | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |                     ), | 
					
						
							|  |  |  |                 ) | 
					
						
							|  |  |  |             else: | 
					
						
							|  |  |  |                 commands.append( | 
					
						
							|  |  |  |                     "cp {src} {plugins_dir}/{lib_name}-$PLUGIN_VERSION/ebin/{dest}".format( | 
					
						
							|  |  |  |                         src = f.path, | 
					
						
							|  |  |  |                         plugins_dir = plugins_dir.path, | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |                         lib_name = lib_info.app_name, | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |                         dest = f.basename, | 
					
						
							|  |  |  |                     ), | 
					
						
							|  |  |  |                 ) | 
					
						
							|  |  |  |         inputs.extend(lib_info.beam) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for f in lib_info.priv: | 
					
						
							|  |  |  |             p = additional_file_dest_relative_path(plugin.label, f) | 
					
						
							|  |  |  |             commands.append( | 
					
						
							|  |  |  |                 "mkdir -p $(dirname {plugins_dir}/{lib_name}-$PLUGIN_VERSION/{dest}) && cp {src} {plugins_dir}/{lib_name}-$PLUGIN_VERSION/{dest}".format( | 
					
						
							|  |  |  |                     src = f.path, | 
					
						
							|  |  |  |                     plugins_dir = plugins_dir.path, | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |                     lib_name = lib_info.app_name, | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |                     dest = p, | 
					
						
							|  |  |  |                 ), | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |         inputs.extend(lib_info.priv) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         commands.append("") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ctx.actions.run_shell( | 
					
						
							|  |  |  |         inputs = inputs, | 
					
						
							|  |  |  |         outputs = [plugins_dir], | 
					
						
							|  |  |  |         command = "\n".join(commands), | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return [ | 
					
						
							|  |  |  |         DefaultInfo( | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  |             files = depset([plugins_dir]), | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  |         ), | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  | versioned_plugins_dir_private = rule( | 
					
						
							|  |  |  |     implementation = _versioned_plugins_dir_impl, | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |     attrs = RABBITMQ_HOME_ATTRS, | 
					
						
							|  |  |  |     toolchains = ["@rules_erlang//tools:toolchain_type"], | 
					
						
							| 
									
										
										
										
											2021-09-30 21:49:08 +08:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  | def versioned_plugins_dir(**kwargs): | 
					
						
							|  |  |  |     versioned_plugins_dir_private( | 
					
						
							| 
									
										
										
										
											2022-01-06 03:57:48 +08:00
										 |  |  |         is_windows = select({ | 
					
						
							|  |  |  |             "@bazel_tools//src/conditions:host_windows": True, | 
					
						
							|  |  |  |             "//conditions:default": False, | 
					
						
							|  |  |  |         }), | 
					
						
							|  |  |  |         **kwargs | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-11 23:52:34 +08:00
										 |  |  | def package_generic_unix( | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |         name = "package-generic-unix", | 
					
						
							| 
									
										
										
										
											2023-06-20 16:14:31 +08:00
										 |  |  |         extension = "tar.xz", | 
					
						
							| 
									
										
										
										
											2022-07-12 00:16:25 +08:00
										 |  |  |         plugins = None, | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  |         extra_licenses = [], | 
					
						
							| 
									
										
										
										
											2022-07-11 23:52:34 +08:00
										 |  |  |         package_dir = "rabbitmq_server-{}".format(APP_VERSION)): | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |     collect_licenses( | 
					
						
							|  |  |  |         name = "licenses", | 
					
						
							|  |  |  |         srcs = [ | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |             Label("@rabbitmq-server//:root-licenses"), | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  |         ] + extra_licenses, | 
					
						
							| 
									
										
										
										
											2022-07-11 23:52:34 +08:00
										 |  |  |         deps = plugins, | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |     pkg_files( | 
					
						
							|  |  |  |         name = "license-files", | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |         srcs = [ | 
					
						
							| 
									
										
										
										
											2022-07-11 23:52:34 +08:00
										 |  |  |             ":licenses", | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |             Label("@rabbitmq-server//deps/rabbit:INSTALL"), | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |         ], | 
					
						
							|  |  |  |         visibility = ["//visibility:public"], | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  |     sbin_dir( | 
					
						
							|  |  |  |         name = "sbin-dir", | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |     pkg_files( | 
					
						
							|  |  |  |         name = "sbin-files", | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  |         srcs = [ | 
					
						
							|  |  |  |             ":sbin-dir", | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |         attributes = pkg_attributes(mode = "0755"), | 
					
						
							|  |  |  |         prefix = "sbin", | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     escript_dir( | 
					
						
							|  |  |  |         name = "escript-dir", | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |     pkg_files( | 
					
						
							|  |  |  |         name = "escript-files", | 
					
						
							| 
									
										
										
										
											2022-10-27 17:36:50 +08:00
										 |  |  |         srcs = [ | 
					
						
							|  |  |  |             ":escript-dir", | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |         attributes = pkg_attributes(mode = "0755"), | 
					
						
							|  |  |  |         prefix = "escript", | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     versioned_plugins_dir( | 
					
						
							|  |  |  |         name = "plugins-dir", | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |         plugins = plugins, | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |     pkg_files( | 
					
						
							|  |  |  |         name = "plugins-files", | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |         srcs = [ | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  |             ":plugins-dir", | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |         ], | 
					
						
							| 
									
										
										
										
											2022-06-18 20:09:06 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pkg_tar( | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |         name = name, | 
					
						
							| 
									
										
										
										
											2023-06-20 16:14:31 +08:00
										 |  |  |         extension = extension, | 
					
						
							| 
									
										
										
										
											2022-07-11 23:52:34 +08:00
										 |  |  |         package_dir = package_dir, | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |         visibility = ["//visibility:public"], | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |         srcs = [ | 
					
						
							|  |  |  |             ":escript-files", | 
					
						
							|  |  |  |             ":sbin-files", | 
					
						
							|  |  |  |             ":plugins-files", | 
					
						
							|  |  |  |             ":license-files", | 
					
						
							|  |  |  |             Label("@rabbitmq-server//:release-notes-files"), | 
					
						
							|  |  |  |             Label("@rabbitmq-server//:scripts-files"), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |         deps = [ | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |             Label("@rabbitmq-server//deps/rabbit:manpages-dir"), | 
					
						
							| 
									
										
										
										
											2022-05-17 20:07:16 +08:00
										 |  |  |         ], | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2022-06-09 16:52:09 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-11 23:52:34 +08:00
										 |  |  | def source_archive( | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |         name = "source_archive", | 
					
						
							| 
									
										
										
										
											2023-06-20 16:14:31 +08:00
										 |  |  |         extension = "tar.xz", | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |         plugins = None): | 
					
						
							| 
									
										
										
										
											2022-06-09 16:52:09 +08:00
										 |  |  |     source_tree( | 
					
						
							|  |  |  |         name = "source-tree", | 
					
						
							| 
									
										
										
										
											2022-07-14 22:15:11 +08:00
										 |  |  |         deps = plugins + [ | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |             Label("@rabbitmq-server//deps/rabbitmq_cli:erlang_app"), | 
					
						
							| 
									
										
										
										
											2022-07-14 22:15:11 +08:00
										 |  |  |         ], | 
					
						
							| 
									
										
										
										
											2022-06-09 16:52:09 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |     pkg_files( | 
					
						
							|  |  |  |         name = "deps-files", | 
					
						
							| 
									
										
										
										
											2022-06-09 16:52:09 +08:00
										 |  |  |         srcs = [ | 
					
						
							|  |  |  |             ":source-tree", | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         strip_prefix = "source-tree", | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |         prefix = "deps", | 
					
						
							| 
									
										
										
										
											2022-06-09 16:52:09 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-17 20:08:26 +08:00
										 |  |  |     pkg_files( | 
					
						
							|  |  |  |         name = "json-files", | 
					
						
							|  |  |  |         srcs = [ | 
					
						
							|  |  |  |             "@json//:sources", | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         strip_prefix = "", | 
					
						
							|  |  |  |         prefix = "deps/json", | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-15 05:51:42 +08:00
										 |  |  |     pkg_files( | 
					
						
							|  |  |  |         name = "csv-files", | 
					
						
							|  |  |  |         srcs = [ | 
					
						
							|  |  |  |             "@csv//:sources", | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         strip_prefix = "", | 
					
						
							|  |  |  |         prefix = "deps/csv", | 
					
						
							| 
									
										
										
										
											2022-06-09 16:52:09 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pkg_tar( | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |         name = name, | 
					
						
							| 
									
										
										
										
											2023-06-20 16:14:31 +08:00
										 |  |  |         extension = extension, | 
					
						
							| 
									
										
										
										
											2022-06-09 16:52:09 +08:00
										 |  |  |         srcs = [ | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |             ":deps-files", | 
					
						
							| 
									
										
										
										
											2023-11-17 20:08:26 +08:00
										 |  |  |             ":json-files", | 
					
						
							| 
									
										
										
										
											2023-03-15 05:51:42 +08:00
										 |  |  |             ":csv-files", | 
					
						
							| 
									
										
										
										
											2023-03-03 19:02:02 +08:00
										 |  |  |             Label("@rabbitmq-server//:root-licenses"), | 
					
						
							| 
									
										
										
										
											2022-06-09 16:52:09 +08:00
										 |  |  |         ], | 
					
						
							|  |  |  |         visibility = ["//visibility:public"], | 
					
						
							|  |  |  |     ) |