แสดงถึงการเปลี่ยนผ่านการกำหนดค่าตามขอบของการขึ้นต่อกัน ตัวอย่างเช่น หาก //package:foo ขึ้นอยู่กับ //package:bar ที่มีการเปลี่ยนผ่านการกำหนดค่า การกำหนดค่าของ //package:bar (และทรัพยากร Dependency) จะเป็นการกำหนดค่าของ //package:foo บวกกับการเปลี่ยนแปลงที่ระบุโดยฟังก์ชันการเปลี่ยนผ่าน
สมาชิก
transition
transition transition(*, implementation, inputs, outputs)
ตัวอย่าง
def _transition_impl(settings, attr):
# This transition just reads the current CPU value as a demonstration.
# A real transition could incorporate this into its followup logic.
current_cpu = settings["//command_line_option:cpu"]
return {"//command_line_option:compilation_mode": "dbg"}
build_in_debug_mode = transition(
implementation = _transition_impl,
inputs = ["//command_line_option:cpu"],
outputs = ["//command_line_option:compilation_mode"],
)ดูรายละเอียดเพิ่มเติมที่ นี่
พารามิเตอร์
| พารามิเตอร์ | คำอธิบาย |
|---|---|
implementation
|
callable;
required The function implementing this transition. ฟังก์ชันนี้มีพารามิเตอร์ 2 รายการเสมอ ได้แก่ settings และ attr พารามิเตอร์ settings เป็นพจนานุกรมที่มีชุดคีย์กำหนดโดยพารามิเตอร์อินพุต ดังนั้น สำหรับการตั้งค่าการสร้าง --//foo=bar หาก inputs มี //foo settings จะมีรายการ settings['//foo']='bar'พารามิเตอร์ ฟังก์ชันนี้ต้องแสดงผล |
inputs
|
sequence of strings;
required List of build settings that can be read by this transition. รายการนี้จะกลายเป็นชุดคีย์ของพารามิเตอร์การตั้งค่าของพารามิเตอร์ฟังก์ชันการใช้งาน |
outputs
|
sequence of strings;
required List of build settings that can be written by this transition. รายการนี้ต้องเป็นซูเปอร์เซตของชุดคีย์ของพจนานุกรมที่แสดงผลโดยการเปลี่ยนผ่านนี้ |