@@ -429,6 +429,8 @@ def codeql_pack(
429429 arch_overrides = None ,
430430 pack_prefix = None ,
431431 install_dest = "extractor-pack" ,
432+ installer_alias = "install" ,
433+ experimental = False ,
432434 ** kwargs ):
433435 """
434436 Define a codeql pack.
@@ -448,22 +450,64 @@ def codeql_pack(
448450 contain the `{CODEQL_PLATFORM}` marker.
449451 All files in the pack will be prefixed with `name`, unless `pack_prefix` is set, then is used instead.
450452
451- This rule also provides a convenient installer target named `<name>-installer`, with a path governed by `install_dest`.
452- This installer is used for installing this pack into the source-tree, relative to the directory where the rule is used.
453- See `codeql_pack_install` for more details. The first `codeql_pack` defined in a bazel package also aliases this
454- installer target with the `install` name as a shortcut.
453+ This rule also provides a convenient installer target named `<name>-installer`, with a path governed by `install_dest`,
454+ unless `install_dest == None`. This installer is used for installing this pack into the source-tree, relative to the
455+ directory where the rule is used. See `codeql_pack_install` for more details. If present, `installer_alias` is used
456+ to define a shorthand alias for `<name>-installer`. Be sure to change `installer_alias` or set it to `None` if a
457+ bazel package defines multiple `codeql_pack`s.
458+
459+ If `experimental = True`, a second `codeql_pack` named `<name>-experimental` is defined alongside the primary one with
460+ an `experimental` pack prefix and no installer, intended to be used when packaging the full distribution.
455461
456462 This function does not accept `visibility`, as packs are always public to make it easy to define pack groups.
457463 """
458- internal = _make_internal (name )
459- zips = zips or {}
460464 if pack_prefix == None :
461465 pack_prefix = name
466+ _codeql_pack_impl (
467+ name ,
468+ srcs ,
469+ zips ,
470+ arch_overrides ,
471+ pack_prefix ,
472+ install_dest ,
473+ installer_alias ,
474+ pkg_filegroup_kwargs = kwargs ,
475+ )
476+ if experimental :
477+ _codeql_pack_impl (
478+ "%s-experimental" % name ,
479+ srcs ,
480+ zips ,
481+ arch_overrides ,
482+ pack_prefix = "experimental/%s" % pack_prefix ,
483+ install_dest = None ,
484+ installer_alias = None ,
485+ pkg_filegroup_kwargs = kwargs ,
486+ )
487+
488+ # TODO: remove this after internal repo update
489+ native .alias (
490+ name = "experimental-%s" % name ,
491+ actual = "%s-experimental" % name ,
492+ visibility = ["//visibility:public" ],
493+ )
494+
495+ def _codeql_pack_impl (
496+ name ,
497+ srcs ,
498+ zips ,
499+ arch_overrides ,
500+ pack_prefix ,
501+ install_dest ,
502+ installer_alias ,
503+ pkg_filegroup_kwargs ):
504+ internal = _make_internal (name )
505+ zips = zips or {}
462506 pkg_filegroup (
463507 name = internal ("all" ),
464508 srcs = srcs ,
465509 visibility = ["//visibility:private" ],
466- ** kwargs
510+ ** pkg_filegroup_kwargs
467511 )
468512 _codeql_pack_info (
469513 name = name ,
@@ -474,9 +518,12 @@ def codeql_pack(
474518 # packs are always public, so that we can easily bundle them into groups
475519 visibility = ["//visibility:public" ],
476520 )
477- _codeql_pack_install (internal ("installer" ), [name ], install_dest = install_dest , apply_pack_prefix = False )
478- if not native .existing_rule ("install" ):
479- native .alias (name = "install" , actual = internal ("installer" ))
521+ if install_dest :
522+ _codeql_pack_install (internal ("installer" ), [name ], install_dest = install_dest , apply_pack_prefix = False )
523+
524+ # TODO: remove deprecated `native.existing_rule(installer_alias)` after internal repo update
525+ if installer_alias and not native .existing_rule (installer_alias ):
526+ native .alias (name = installer_alias , actual = internal ("installer" ))
480527
481528strip_prefix = _strip_prefix
482529
0 commit comments