1*bcb5dc79SHONG Yifan<!-- Generated with Stardoc: http://skydoc.bazel.build --> 2*bcb5dc79SHONG Yifan 3*bcb5dc79SHONG Yifannative_binary() and native_test() rule implementations. 4*bcb5dc79SHONG Yifan 5*bcb5dc79SHONG YifanThese rules let you wrap a pre-built binary or script in a conventional binary 6*bcb5dc79SHONG Yifanand test rule respectively. They fulfill the same goal as sh_binary and sh_test 7*bcb5dc79SHONG Yifando, but they run the wrapped binary directly, instead of through Bash, so they 8*bcb5dc79SHONG Yifandon't depend on Bash and work with --shell_executable="". 9*bcb5dc79SHONG Yifan 10*bcb5dc79SHONG Yifan<a id="native_binary"></a> 11*bcb5dc79SHONG Yifan 12*bcb5dc79SHONG Yifan## native_binary 13*bcb5dc79SHONG Yifan 14*bcb5dc79SHONG Yifan<pre> 15*bcb5dc79SHONG Yifannative_binary(<a href="#native_binary-name">name</a>, <a href="#native_binary-src">src</a>, <a href="#native_binary-data">data</a>, <a href="#native_binary-out">out</a>) 16*bcb5dc79SHONG Yifan</pre> 17*bcb5dc79SHONG Yifan 18*bcb5dc79SHONG YifanWraps a pre-built binary or script with a binary rule. 19*bcb5dc79SHONG Yifan 20*bcb5dc79SHONG YifanYou can "bazel run" this rule like any other binary rule, and use it as a tool 21*bcb5dc79SHONG Yifanin genrule.tools for example. You can also augment the binary with runfiles. 22*bcb5dc79SHONG Yifan 23*bcb5dc79SHONG Yifan**ATTRIBUTES** 24*bcb5dc79SHONG Yifan 25*bcb5dc79SHONG Yifan 26*bcb5dc79SHONG Yifan| Name | Description | Type | Mandatory | Default | 27*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- | :------------- | :------------- | 28*bcb5dc79SHONG Yifan| <a id="native_binary-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | | 29*bcb5dc79SHONG Yifan| <a id="native_binary-src"></a>src | path of the pre-built executable | <a href="https://bazel.build/concepts/labels">Label</a> | required | | 30*bcb5dc79SHONG Yifan| <a id="native_binary-data"></a>data | data dependencies. See https://bazel.build/reference/be/common-definitions#typical.data | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` | 31*bcb5dc79SHONG Yifan| <a id="native_binary-out"></a>out | An output name for the copy of the binary. Defaults to name.exe. (We add .exe to the name by default because it's required on Windows and tolerated on other platforms.) | String | optional | `""` | 32*bcb5dc79SHONG Yifan 33*bcb5dc79SHONG Yifan 34*bcb5dc79SHONG Yifan<a id="native_test"></a> 35*bcb5dc79SHONG Yifan 36*bcb5dc79SHONG Yifan## native_test 37*bcb5dc79SHONG Yifan 38*bcb5dc79SHONG Yifan<pre> 39*bcb5dc79SHONG Yifannative_test(<a href="#native_test-name">name</a>, <a href="#native_test-src">src</a>, <a href="#native_test-data">data</a>, <a href="#native_test-out">out</a>) 40*bcb5dc79SHONG Yifan</pre> 41*bcb5dc79SHONG Yifan 42*bcb5dc79SHONG YifanWraps a pre-built binary or script with a test rule. 43*bcb5dc79SHONG Yifan 44*bcb5dc79SHONG YifanYou can "bazel test" this rule like any other test rule. You can also augment 45*bcb5dc79SHONG Yifanthe binary with runfiles. 46*bcb5dc79SHONG Yifan 47*bcb5dc79SHONG Yifan**ATTRIBUTES** 48*bcb5dc79SHONG Yifan 49*bcb5dc79SHONG Yifan 50*bcb5dc79SHONG Yifan| Name | Description | Type | Mandatory | Default | 51*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- | :------------- | :------------- | 52*bcb5dc79SHONG Yifan| <a id="native_test-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | | 53*bcb5dc79SHONG Yifan| <a id="native_test-src"></a>src | path of the pre-built executable | <a href="https://bazel.build/concepts/labels">Label</a> | required | | 54*bcb5dc79SHONG Yifan| <a id="native_test-data"></a>data | data dependencies. See https://bazel.build/reference/be/common-definitions#typical.data | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` | 55*bcb5dc79SHONG Yifan| <a id="native_test-out"></a>out | An output name for the copy of the binary. Defaults to name.exe. (We add .exe to the name by default because it's required on Windows and tolerated on other platforms.) | String | optional | `""` | 56*bcb5dc79SHONG Yifan 57*bcb5dc79SHONG Yifan 58