# NativeBinarySpec

API Documentation: | `NativeBinarySpec`

Known Subtypes: |
`NativeExecutableBinarySpec`
`NativeLibraryBinarySpec`
`NativeTestSuiteBinarySpec`

Note: This class is incubating and may change in a future version of Gradle.

Represents a binary artifact that is the result of building a native component.

### Properties

Property | Description
`buildDependencies` | Returns a dependency which contains the tasks which build this artifact. All `Buildable` implementations must ensure that the returned dependency object is live, so that it tracks changes to the dependencies of this buildable.
`buildTask` | Incubating The 'lifecycle' task associated with the construction of this element.
`buildable` | Incubating Can this binary be built in the current environment?
`component` | Incubating The component that this binary was built from.
`libs` | Incubating The libraries that should be linked into this binary.
`linker` | Incubating The settings used for linking this binary.
`source` | Deprecated Incubating The source sets used to compile this binary.
`staticLibArchiver` | Incubating The static archiver settings used for creating this binary.
`tasks` | Incubating The set of tasks associated with this binary.
`toolChain` | Incubating The `NativeToolChain` that will be used to build this binary.

### Methods

Method | Description
`builtBy(tasks)` | Incubating Adds a task that is required for the construction of this element. A task added this way is then added as a dependency of the associated lifecycle task.
`lib(library)` | Incubating Adds a library as input to this binary.
`sources(action)` | Incubating Configures the source sets used to build this binary.

### Script blocks

No script blocks

### Property details

#### `TaskDependency` `buildDependencies` (read-only)

Returns a dependency which contains the tasks which build this artifact. All `Buildable` implementations must ensure that the returned dependency object is live, so that it tracks changes to the dependencies of this buildable.

#### `Task` `buildTask`

Note: This property is incubating and may change in a future version of Gradle.

The 'lifecycle' task associated with the construction of this element.

#### `boolean` `buildable` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

Can this binary be built in the current environment?

#### `NativeComponentSpec` `component` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The component that this binary was built from.

#### ``Collection`<`NativeDependencySet`>` `libs` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The libraries that should be linked into this binary.

#### `Tool` `linker` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The settings used for linking this binary.

#### ``DomainObjectSet`<`LanguageSourceSet`>` `source` (read-only)

Note: This property is deprecated and will be removed in the next major version of Gradle.

Note: This property is incubating and may change in a future version of Gradle.

The source sets used to compile this binary.

#### `Tool` `staticLibArchiver` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The static archiver settings used for creating this binary.

#### `BinaryTasksCollection` `tasks` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The set of tasks associated with this binary.

#### `NativeToolChain` `toolChain` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The `NativeToolChain` that will be used to build this binary.

### Method details

#### `void` `builtBy`(``Object`...` tasks)

Note: This method is incubating and may change in a future version of Gradle.

Adds a task that is required for the construction of this element. A task added this way is then added as a dependency of the associated lifecycle task.

#### `void` `lib`(`Object` library)

Note: This method is incubating and may change in a future version of Gradle.

Adds a library as input to this binary.

This method accepts the following types:

- A `NativeLibrarySpec`
- A `NativeDependencySet`
- A `Map` containing the library selector.

The Map notation supports the following String attributes:

- project: the path to the project containing the library (optional, defaults to current project)
- library: the name of the library (required)
- linkage: the library linkage required ['shared'/'static'] (optional, defaults to 'shared')

#### `void` `sources`(``Action`<? super `ModelMap`<`LanguageSourceSet`>>` action)

Note: This method is incubating and may change in a future version of Gradle.

Configures the source sets used to build this binary.