# Class SwiftCompile

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.language.swift.tasks.SwiftCompile

All Implemented Interfaces:
  `Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Task, org.gradle.util.Configurable<Task>`

@Incubating @CacheableTask public class SwiftCompile extends DefaultTask
Compiles Swift source files into object files.

Since:
  4.1

## Nested Class Summary

### Nested classes/interfaces inherited from interface Task

`Task.Namer`

## Field Summary

### Fields inherited from interface Task

`TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

## Constructor Summary

Constructors
Constructor
Description
`SwiftCompile()`

## Method Summary

Modifier and Type
Method
Description
`ListProperty<String>`
`getCompilerArgs()`
Additional arguments to provide to the compiler.
`protected CompilerVersion`
`getCompilerVersion()`
The compiler used, including the type and the version.
`Map<String,String>`
`getMacros()`
Macros that should be defined for the compiler.
`RegularFileProperty`
`getModuleFile()`
The location to write the Swift module file to.
`Property<String>`
`getModuleName()`
The name of the module to produce.
`ConfigurableFileCollection`
`getModules()`
The modules required to compile the source.
`DirectoryProperty`
`getObjectFileDir()`
The directory where object files will be generated.
`ConfigurableFileCollection`
`getSource()`
Returns the source files to be compiled.
`NativePlatform`
`getTargetPlatform()`
The platform being compiled for.
`NativeToolChain`
`getToolChain()`
The tool chain used for compilation.
`boolean`
`isDebuggable()`
Should the compiler generate debuggable code?
`boolean`
`isOptimized()`
Should the compiler generate optimized code?
`void`
`setDebuggable(boolean debug)`
Should the compiler generate debuggable code?
`void`
`setMacros(Map<String,String> macros)`
Sets the macros that should be defined when compiling.
`void`
`setOptimized(boolean optimize)`
Should the compiler generate optimized code?
`void`
`setTargetPlatform(NativePlatform targetPlatform)`
Sets the platform being compiled for.
`void`
`setToolChain(NativeToolChain toolChain)`
Sets the tool chain to use for compilation.

### Methods inherited from class DefaultTask

`newInputDirectory, newInputFile, newOutputDirectory, newOutputFile`

### Methods inherited from class org.gradle.api.internal.AbstractTask

`addValidator, appendParallelSafeAction, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doFirst, doLast, doLast, doLast, execute, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getIdentityPath, getImpliesSubProjects, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, isHasCustomActions, leftShift, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, toString`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### SwiftCompile

public SwiftCompile()

## Method Details

### getToolChain

@Internal public NativeToolChain getToolChain()
The tool chain used for compilation.

Since:
  4.4

### setToolChain

public void setToolChain(NativeToolChain toolChain)
Sets the tool chain to use for compilation.

Since:
  4.4

### getTargetPlatform

public NativePlatform getTargetPlatform()
The platform being compiled for.

Since:
  4.4

### setTargetPlatform

public void setTargetPlatform(NativePlatform targetPlatform)
Sets the platform being compiled for.

Since:
  4.4

### getSource

@InputFiles @PathSensitive(RELATIVE) public ConfigurableFileCollection getSource()
Returns the source files to be compiled.

Since:
  4.4

### getMacros

@Input public Map<String,String> getMacros()
Macros that should be defined for the compiler.

Since:
  4.4

### setMacros

public void setMacros(Map<String,String> macros)
Sets the macros that should be defined when compiling.

Since:
  4.4

### isDebuggable

@Input public boolean isDebuggable()
Should the compiler generate debuggable code?

Since:
  4.4

### setDebuggable

public void setDebuggable(boolean debug)
Should the compiler generate debuggable code?

Since:
  4.4

### isOptimized

@Input public boolean isOptimized()
Should the compiler generate optimized code?

Since:
  4.4

### setOptimized

public void setOptimized(boolean optimize)
Should the compiler generate optimized code?

Since:
  4.4

### getCompilerArgs

@Input public ListProperty<String> getCompilerArgs()
Additional arguments to provide to the compiler.

Since:
  4.4

### getObjectFileDir

@OutputDirectory public DirectoryProperty getObjectFileDir()
The directory where object files will be generated.

Since:
  4.4

### getModuleFile

@OutputFile public RegularFileProperty getModuleFile()
The location to write the Swift module file to.

Since:
  4.4

### getModuleName

@Optional @Input public Property<String> getModuleName()
The name of the module to produce.

### getModules

@InputFiles @PathSensitive(NAME_ONLY) public ConfigurableFileCollection getModules()
The modules required to compile the source.

Since:
  4.4

### getCompilerVersion

protected CompilerVersion getCompilerVersion()
The compiler used, including the type and the version.

Since:
  4.4