api / org.gradle.language.swift / SwiftComponent

SwiftComponent

@Incubating interface SwiftComponent : ComponentWithBinaries, ComponentWithDependencies

Configuration for a Swift component, such as a library or executable, defining the source files that make up the component plus other settings.

Swift component is composed of some Swift source files that are compiled and then linked into some binary.

An instance of this type is added as a project extension by the Swift plugins.

Since
4.2

Functions

getBinaries

abstract fun getBinaries(): BinaryCollection<out SwiftBinary>

Returns the binaries for this library.

getImplementationDependencies

abstract fun getImplementationDependencies(): Configuration

Returns the implementation dependencies of this component.

getModule

abstract fun getModule(): Property<String>

Defines the Swift module for this component. The default value is calculated from the project name.

getOperatingSystems

abstract fun getOperatingSystems(): SetProperty<OperatingSystemFamily>

Specifies the operating systems for the target machine.

getSource

abstract fun getSource(): ConfigurableFileCollection

Defines the source files or directories of this component. You can add files or directories to this collection. When a directory is added, all source files are included for compilation.

When this collection is empty, the directory src/main/swift is used by default.

getSourceCompatibility

abstract fun getSourceCompatibility(): Property<SwiftVersion>

Returns the Swift language level to use to compile the source files.

getSwiftSource

abstract fun getSwiftSource(): FileCollection

Returns the Swift source files of this component, as defined in #getSource().

source

abstract fun source(action: Action<in ConfigurableFileCollection>): Unit

Configures the source files or directories for this component.

Inherited Functions

getDependencies

abstract fun getDependencies(): ComponentDependencies

Returns the dependencies of this component.

Inheritors

ProductionSwiftComponent

interface ProductionSwiftComponent : SwiftComponent, ProductionComponent

Represents a Swift component that is the main product of a project.

SwiftXCTestSuite

interface SwiftXCTestSuite : SwiftComponent, TestSuiteComponent

A XCTest suite, implemented in Swift.