config

Ini adalah modul tingkat atas untuk membuat transisi konfigurasi dan deskriptor setelan build yang menjelaskan jenis setelan build (jika ada) yang merupakan aturan.

Contoh: aturan berikut ditandai sebagai setelan build dengan menetapkan parameter build_setting dari fungsi rule(). Secara khusus, ini adalah setelan build berjenis int dan merupakan flag yang berarti setelan build ini dapat dipanggil di command line.

  my_rule = rule(
    implementation = _impl,
    build_setting = config.int(flag = True),
    ...
  )

Anggota

bool

BuildSetting config.bool(*, flag=False)

Setelan build berjenis bool

Parameter

Parameter Deskripsi
flag bool; default is False
Whether or not this build setting is callable on the command line.

exec

ExecTransitionFactory config.exec(exec_group=None)

Membuat transisi eksekusi.

Parameter

Parameter Deskripsi
exec_group string; or None; default is None
The name of the exec group whose execution platform this transition will use. If not provided, this exec transition will use the target's default execution platform.

int

BuildSetting config.int(*, flag=False)

Setelan build berjenis bilangan bulat

Parameter

Parameter Deskripsi
flag bool; default is False
Whether or not this build setting is callable on the command line.

none

transition config.none()

Membuat transisi yang menghapus semua konfigurasi, membatalkan setelan semua flag. Ditujukan untuk kasus ketika dependensi hanya berupa data dan tidak berisi kode yang perlu dibuat, tetapi hanya perlu dianalisis sekali.

string

BuildSetting config.string(*, flag=False, allow_multiple=False)

Setelan build berjenis string

Parameter

Parameter Deskripsi
flag bool; default is False
Whether or not this build setting is callable on the command line.
allow_multiple bool; default is False
Deprecated, use a string_list setting with repeatable = True instead. If set, this flag is allowed to be set multiple times on the command line. The Value of the flag as accessed in transitions and build setting implementation function will be a list of strings. Insertion order and repeated values are both maintained. This list can be post-processed in the build setting implementation function if different behavior is desired.

string_list

BuildSetting config.string_list(*, flag=False, repeatable=False)

Setelan build berjenis daftar string. Di command line, teruskan daftar menggunakan nilai yang dipisahkan koma seperti --//my/setting=foo,bar.

Parameter

Parameter Deskripsi
flag bool; default is False
Whether or not this build setting is callable on the command line.
repeatable bool; default is False
If set, instead of expecting a comma-separated value, this flag is allowed to be set multiple times on the command line with each individual value treated as a single string to add to the list value. Insertion order and repeated values are both maintained. This list can be post-processed in the build setting implementation function if different behavior is desired.

string_set

BuildSetting config.string_set(*, flag=False, repeatable=False)

Setelan build berjenis set string. Nilai setelan ini akan berupa kumpulan string di Starlark. Di command line, teruskan set menggunakan nilai yang dipisahkan koma seperti --//my/setting=foo,bar.

Tidak seperti string_list, urutan elemen tidak menjadi masalah dan hanya satu instance dari setiap elemen yang dipertahankan. Hal ini direkomendasikan daripada string_list untuk flag yang tidak memerlukan properti ini karena dapat meningkatkan performa build dengan menghindari konfigurasi yang tidak perlu.

Parameter

Parameter Deskripsi
flag bool; default is False
Whether or not this build setting is callable on the command line.
repeatable bool; default is False
If set, instead of expecting a comma-separated value, this flag is allowed to be set multiple times on the command line with each individual value treated as a single string to add to the set value. Only a single instance of repeated values is maintained and the insertion order does not matter.

target

transition config.target()

Membuat transisi target. Ini adalah transisi no-op yang ditujukan untuk kasus ketika objek transisi diperlukan, tetapi tidak ingin mengubah apa pun. Setara dengan cfg = "target" di attr.label().