"Fossies" - the Fresh Open Source Software Archive

Member "selenium-selenium-4.8.1/java/private/dist_zip.bzl" (17 Feb 2023, 2100 Bytes) of package /linux/www/selenium-selenium-4.8.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "dist_zip.bzl": 4.4.0_vs_4.5.0.

    1 load("//java/private:common.bzl", "has_maven_deps")
    2 load("//java/private:dist_info.bzl", "DistZipInfo", "dist_aspect", "separate_first_and_third_party")
    3 
    4 def _java_dist_zip_impl(ctx):
    5     files = []
    6     for file in ctx.files.files:
    7         files.append("%s=%s" % (file.basename, file.path))
    8 
    9     infos = [d[DistZipInfo] for d in ctx.attr.deps]
   10     combined = depset(transitive = [i.dist_infos for i in infos]).to_list()
   11 
   12     inputs = depset(
   13         ctx.files.files,
   14         transitive = [i.binary_jars for i in combined] + [i.source_jars for i in combined],
   15     )
   16 
   17     (first, third) = separate_first_and_third_party(ctx.attr.third_party_prefixes, infos)
   18 
   19     first_party = []
   20     third_party = []
   21 
   22     for info in first:
   23         [first_party.append("%s.jar=%s" % (info.name, fp.path)) for fp in info.binary_jars.to_list()]
   24         [first_party.append("%s-sources.jar=%s" % (info.name, fp.path)) for fp in info.source_jars.to_list()]
   25 
   26     for info in third:
   27         [third_party.append("lib/%s.jar=%s" % (info.name, tp.path)) for tp in info.binary_jars.to_list()]
   28 
   29     out = ctx.actions.declare_file("%s.zip" % ctx.attr.name)
   30     args = ctx.actions.args()
   31     args.add_all(["c", out])
   32     args.add_all(sorted(files))
   33     args.add_all(sorted(first_party))
   34     args.add_all(sorted(third_party))
   35 
   36     ctx.actions.run(
   37         executable = ctx.executable._zip,
   38         arguments = [args],
   39         outputs = [out],
   40         inputs = inputs,
   41     )
   42 
   43     return [
   44         DefaultInfo(files = depset([out])),
   45     ]
   46 
   47 java_dist_zip = rule(
   48     _java_dist_zip_impl,
   49     attrs = {
   50         "files": attr.label_list(
   51             default = [],
   52             allow_files = True,
   53         ),
   54         "deps": attr.label_list(
   55             providers = [
   56                 [DistZipInfo],
   57             ],
   58             aspects = [
   59                 dist_aspect,
   60                 has_maven_deps,
   61             ],
   62         ),
   63         "third_party_prefixes": attr.string_list(),
   64         "_zip": attr.label(
   65             default = "@bazel_tools//tools/zip:zipper",
   66             executable = True,
   67             cfg = "exec",
   68         ),
   69     },
   70 )