Class ApiJar
- All Implemented Interfaces:
Comparable<Task>
,org.gradle.api.internal.DynamicObjectAware
,org.gradle.api.internal.TaskInternal
,ExtensionAware
,Task
,org.gradle.util.Configurable<Task>
This task and the Jar it produces are designed primarily for internal use in support
of Gradle's "compile avoidance" performance feature. The task is automatically included
in the task graph for any JVM library that declares an api { ... }
specification, and the resulting Jar will automatically be placed on the compile time
classpath of projects that depend on the library in lieu of the library's complete
so-called "Runtime Jar".
Swapping the API Jar in for the Runtime Jar at compile time is what makes "compile avoidance" possible: because the contents of the API Jar change only when actual API changes are made, the API Jar passes Gradle's up-to-date checks, even if the implementation in the Runtime Jar has changed. Ultimately, this means that projects depending on the library in question will need to recompile potentially far less often.
In order to ensure that API Jars change as infrequently as possible, this task and
its supporting classes ensure that only actual public API members are included in the
API Jar, and that the methods among those members are stripped of their implementation.
Because the members included in API Jars exist only for compilation purposes, they need
no actual implementation, and for this reason, all such methods throw
UnsupportedOperationException
in the unlikely event that they are present on
the classpath and invoked at runtime.
The inputs to this task are Java class files which must be provided via
TaskInputs
.
- Since:
- 2.10
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Task
Task.Namer
-
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
setExportedPackages
(Set<String> exportedPackages) void
setOutputFile
(File outputFile) Methods inherited from class org.gradle.api.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
-
Constructor Details
-
ApiJar
public ApiJar()
-
-
Method Details
-
getExportedPackages
-
setExportedPackages
-
getOutputFile
-
setOutputFile
-
createApiJar
- Throws:
IOException
-