# 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, Named, ExtensionAware, Task, Configurable<Task>`

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

Since:
  4.1

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface Named

  `Named.Namer`

- ## Field Summary

  ### Fields inherited from interface Task

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SwiftCompile(org.gradle.nativeplatform.internal.CompilerOutputFileNamingSchemeFactory compilerOutputFileNamingSchemeFactory, org.gradle.internal.file.Deleter deleter)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `compile(InputChanges inputs)`
  Compile.
  `abstract ListProperty<String>`
  `getCompilerArgs()`
  Additional arguments to provide to the compiler.
  `protected CompilerVersion`
  `getCompilerVersion()`
  The compiler used, including the type and the version.
  `Property<Boolean>`
  `getDebuggable()`
  Should the compiler generate debuggable code?
  `abstract ListProperty<String>`
  `getMacros()`
  Macros that should be defined for the compiler.
  `abstract RegularFileProperty`
  `getModuleFile()`
  The location to write the Swift module file to.
  `abstract Property<String>`
  `getModuleName()`
  The name of the module to produce.
  `abstract ConfigurableFileCollection`
  `getModules()`
  The modules required to compile the source.
  `abstract DirectoryProperty`
  `getObjectFileDir()`
  The directory where object files will be generated.
  `Property<Boolean>`
  `getOptimized()`
  Should the compiler generate optimized code?
  `abstract ConfigurableFileCollection`
  `getSource()`
  Returns the source files to be compiled.
  `abstract Property<SwiftVersion>`
  `getSourceCompatibility()`
  Returns the Swift language level to use to compile the source files.
  `abstract Property<NativePlatform>`
  `getTargetPlatform()`
  The platform being compiled for.
  `abstract Property<NativeToolChain>`
  `getToolChain()`
  The tool chain used for compilation.
  `boolean`
  `isDebuggable()`
  Should the compiler generate debuggable code?
  `boolean`
  `isOptimized()`
  Should the compiler generate debuggable code?

  ### Methods inherited from class DefaultTask

  `compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService`

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

  `acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getLoggingManager, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, service, setImpliesSubProjects`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface Task

  `doNotTrackState, notCompatibleWithConfigurationCache, service`

- ## Constructor Details

  - ### SwiftCompile

    @Inject public SwiftCompile(org.gradle.nativeplatform.internal.CompilerOutputFileNamingSchemeFactory compilerOutputFileNamingSchemeFactory, org.gradle.internal.file.Deleter deleter)

- ## Method Details

  - ### getToolChain

    @Internal public abstract Property<NativeToolChain> getToolChain()
    The tool chain used for compilation.
    Since:
      4.7

  - ### getTargetPlatform

    public abstract Property<NativePlatform> getTargetPlatform()
    The platform being compiled for.
    Since:
      4.7

  - ### getSource

    @InputFiles @SkipWhenEmpty @IgnoreEmptyDirectories @PathSensitive(RELATIVE) public abstract ConfigurableFileCollection getSource()
    Returns the source files to be compiled.
    Since:
      4.4

  - ### getMacros

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

    Macros do not have values in Swift; they are either present or absent.

    Since:
      4.7

  - ### isDebuggable

    @Internal public boolean isDebuggable()
    Should the compiler generate debuggable code?
    Since:
      4.4

  - ### getDebuggable

    @Input public Property<Boolean> getDebuggable()
    Should the compiler generate debuggable code?
    Since:
      4.7

  - ### isOptimized

    @Internal public boolean isOptimized()
    Should the compiler generate debuggable code?
    Since:
      4.4

  - ### getOptimized

    @Input public Property<Boolean> getOptimized()
    Should the compiler generate optimized code?
    Since:
      4.7

  - ### getCompilerArgs

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

  - ### getObjectFileDir

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

  - ### getModuleFile

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

  - ### getModuleName

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

  - ### getModules

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

  - ### getSourceCompatibility

    @Input public abstract Property<SwiftVersion> getSourceCompatibility()
    Returns the Swift language level to use to compile the source files.
    Since:
      4.6

  - ### getCompilerVersion

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

  - ### compile

    protected void compile(InputChanges inputs)
    Compile.
    Since:
      6.0