# Class AbstractNativeCompileTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.language.nativeplatform.tasks.AbstractNativeCompileTask

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

Direct Known Subclasses:
  `AbstractNativePCHCompileTask, AbstractNativeSourceCompileTask`

@DisableCachingByDefault(because="Abstract super-class, not to be instantiated directly") public abstract class AbstractNativeCompileTask extends DefaultTask
Compiles native source files into object files.

Since:
  2.2

- ## 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
  `AbstractNativeCompileTask()`
  Creates a new `AbstractNativeCompileTask`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `compile(InputChanges inputs)`
  Compile.
  `protected void`
  `configureSpec(org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec spec)`
  Configure spec.
  `protected abstract org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec`
  `createCompileSpec()`
  Create compile spec.
  `abstract ListProperty<String>`
  `getCompilerArgs()`
  Additional arguments to provide to the compiler.
  `protected abstract org.gradle.api.internal.file.FileCollectionFactory`
  `getFileCollectionFactory()`
  `protected FileCollection`
  `getHeaderDependencies()`
  The set of dependent headers.
  `abstract ConfigurableFileCollection`
  `getIncludes()`
  Returns the header directories to be used for compilation.
  `protected abstract org.gradle.language.nativeplatform.internal.incremental.IncrementalCompilerBuilder`
  `getIncrementalCompilerBuilder()`
  `Map<String,String>`
  `getMacros()`
  Macros that should be defined for the compiler.
  `abstract DirectoryProperty`
  `getObjectFileDir()`
  The directory where object files will be generated.
  `protected abstract org.gradle.internal.operations.logging.BuildOperationLoggerFactory`
  `getOperationLoggerFactory()`
  `ConfigurableFileCollection`
  `getSource()`
  Returns the source files to be compiled.
  `abstract ConfigurableFileCollection`
  `getSystemIncludes()`
  Returns the system include directories to be used for compilation.
  `abstract Property<NativePlatform>`
  `getTargetPlatform()`
  The platform being compiled for.
  `protected abstract org.gradle.api.internal.file.TaskFileVarFactory`
  `getTaskFileVarFactory()`
  `abstract Property<NativeToolChain>`
  `getToolChain()`
  The tool chain used for compilation.
  `void`
  `includes(Object includeRoots)`
  Add directories where the compiler should search for header files.
  `boolean`
  `isDebuggable()`
  Should the compiler generate debuggable code?
  `boolean`
  `isOptimized()`
  Should the compiler generate optimized code?
  `boolean`
  `isPositionIndependentCode()`
  Should the compiler generate position independent code?
  `void`
  `setDebuggable(boolean debug)`
  Should the compiler generate debuggable code?
  `void`
  `setMacros(Map<String,String> macros)`
  Sets the macros.
  `void`
  `setOptimized(boolean optimize)`
  Should the compiler generate optimized code?
  `void`
  `setPositionIndependentCode(boolean positionIndependentCode)`
  Sets the position independent code.
  `void`
  `source(Object sourceFiles)`
  Adds a set of source files to be compiled.

  ### 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

  - ### AbstractNativeCompileTask

    public AbstractNativeCompileTask()
    Creates a new `AbstractNativeCompileTask`.
    Since:
      2.2

- ## Method Details

  - ### getTaskFileVarFactory

    @Inject protected abstract org.gradle.api.internal.file.TaskFileVarFactory getTaskFileVarFactory()

  - ### getIncrementalCompilerBuilder

    @Inject protected abstract org.gradle.language.nativeplatform.internal.incremental.IncrementalCompilerBuilder getIncrementalCompilerBuilder()

  - ### getOperationLoggerFactory

    @Inject protected abstract org.gradle.internal.operations.logging.BuildOperationLoggerFactory getOperationLoggerFactory()

  - ### getFileCollectionFactory

    @Inject protected abstract org.gradle.api.internal.file.FileCollectionFactory getFileCollectionFactory()

  - ### compile

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

  - ### configureSpec

    protected void configureSpec(org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec spec)
    Configure spec.
    Since:
      2.5

  - ### createCompileSpec

    protected abstract org.gradle.nativeplatform.toolchain.internal.NativeCompileSpec createCompileSpec()
    Create compile spec.
    Since:
      2.2

  - ### 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

  - ### isPositionIndependentCode

    @Input public boolean isPositionIndependentCode()
    Should the compiler generate position independent code?
    Since:
      2.2

  - ### setPositionIndependentCode

    public void setPositionIndependentCode(boolean positionIndependentCode)
    Sets the position independent code.
    Since:
      2.2

  - ### isDebuggable

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

  - ### setDebuggable

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

  - ### isOptimized

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

  - ### setOptimized

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

  - ### getObjectFileDir

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

  - ### getIncludes

    @Internal("The paths for include directories are tracked via the includePaths property, the contents are tracked via discovered inputs") public abstract ConfigurableFileCollection getIncludes()
    Returns the header directories to be used for compilation.
    Since:
      2.2

  - ### includes

    public void includes(Object includeRoots)
    Add directories where the compiler should search for header files.
    Since:
      2.2

  - ### getSystemIncludes

    @Internal("The paths for include directories are tracked via the includePaths property, the contents are tracked via discovered inputs") public abstract ConfigurableFileCollection getSystemIncludes()
    Returns the system include directories to be used for compilation.
    Since:
      4.8

  - ### getSource

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

  - ### source

    public void source(Object sourceFiles)
    Adds a set of source files to be compiled. The provided sourceFiles object is evaluated as per `Project.files(Object...)`.
    Since:
      2.2

  - ### getMacros

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

  - ### setMacros

    public void setMacros(Map<String,String> macros)
    Sets the macros.
    Since:
      2.2

  - ### getCompilerArgs

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

  - ### getHeaderDependencies

    @Incremental @InputFiles @PathSensitive(NAME_ONLY) protected FileCollection getHeaderDependencies()
    The set of dependent headers. This is used for up-to-date checks only.
    Since:
      4.3