@@ -346,18 +346,37 @@ hooks.repo(
346346 dummy = "@lowrisc_opentitan//:sw/device/tests/closed_source" ,
347347 env = "SECURE_MANUFACTURER_HOOKS_DIR" ,
348348)
349- hooks .repo (
350- name = "provisioning_exts" ,
351- dummy = "@lowrisc_opentitan//:sw/device/silicon_creator/manuf/extensions" ,
352- env = "PROV_EXTS_DIR" ,
353- )
354349use_repo (
355350 hooks ,
356351 "manufacturer_test_hooks" ,
357- "provisioning_exts" ,
358352 "secure_manufacturer_test_hooks" ,
359353)
360354
355+ # Provisioning extension module, use --override_module to point to the non-dummy implementation.
356+ # Note: downstream infrastructure searches for this bazel_dep by regex to determine if we're
357+ # using the legacy PROV_EXTS_DIR environment variable or the new override commandline flag.
358+ bazel_dep (name = "ot_provisioning_exts" , version = "1.0.1" )
359+
360+ # Dummy repository, can be overriden on the command-line to point to ot-sku
361+ local_path_override (
362+ module_name = "ot_provisioning_exts" ,
363+ path = "sw/device/silicon_creator/manuf/extensions" ,
364+ )
365+
366+ # We import an extension of the repository so that it can define extra repositories.
367+ provisioning_exts_extra = use_extension ("@ot_provisioning_exts//:extension.bzl" , "extra" )
368+
369+ # We always import the provisioning_exts_extra repository so that it can be refered to by
370+ # the provisioning_exts repo defined below.
371+ use_repo (provisioning_exts_extra , "provisioning_exts_extra" )
372+
373+ # We import the repo rule.
374+ provisioning_exts_hook = use_repo_rule ("@ot_provisioning_exts//:hook.bzl" , "hook" )
375+
376+ # Crucially, this repository is injected into the OT module so it can freely depend on everything the OT repo depends on.
377+ # At the same time, it can also depend on everything in @ot_provisioning_exts, which can contain arbitrary stuff.
378+ provisioning_exts_hook (name = "provisioning_exts" )
379+
361380register_toolchains ("//rules/opentitan:localtools" )
362381
363382register_toolchains ("//toolchain:cc_toolchain_opentitan" )
0 commit comments