Package net.fabricmc.loom.task
Class ExtractNativesTask
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.AbstractCopyTask
org.gradle.api.tasks.Sync
net.fabricmc.loom.task.ExtractNativesTask
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>,org.gradle.api.file.ContentFilterable,org.gradle.api.file.CopyProcessingSpec,org.gradle.api.file.CopySourceSpec,org.gradle.api.file.CopySpec,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.file.copy.CopySpecSource,org.gradle.api.internal.IConventionAware,org.gradle.api.internal.TaskInternal,org.gradle.api.Named,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.api.tasks.util.PatternFilterable,org.gradle.util.Configurable<org.gradle.api.Task>
@DisableCachingByDefault
public abstract class ExtractNativesTask
extends org.gradle.api.tasks.Sync
下载并把 Minecraft 的平台相关 natives 解压到 natives 目录.
输入一律以 Provider 形态登记:早先的实现在构造函数里遍历
getFiles(),任务一被 realize(哪怕本次构建根本不跑它,例如 gradle help)就会解析整个
minecraftNatives 配置——一次网络 + 磁盘动作,配置阶段白付,且让配置缓存无法避开.
改用 named(...).flatMap(...).map(...) 之后,解析推迟到「Gradle 真正需要这份文件树」时:
- 任务不参与本次构建:配置与解析都不发生;
- 任务参与构建:在输入指纹计算/执行时解析,与改造前等价(仍是同一个配置、同一批 jar);
- up-to-date 与缓存行为不变——解析出来的文件仍是本任务的输入,供
Sync比对快照。
产物仍是每个 natives jar 一棵 zipTree,各自套一份 exclude/rename 规则,
与改造前逐 jar 构建 CopySpec 的形态一一对应,不改变叠加顺序之外的任何语义。
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.gradle.api.file.ArchiveOperationsMethods inherited from class org.gradle.api.tasks.Sync
createCopyAction, createRootSpec, getDeleter, getDestinationDir, getPreserve, getRootSpec, preserve, setDestinationDirMethods inherited from class org.gradle.api.tasks.AbstractCopyTask
copy, createCopyActionExecuter, dirPermissions, eachFile, eachFile, exclude, exclude, exclude, exclude, expand, expand, filePermissions, filesMatching, filesMatching, filesNotMatching, filesNotMatching, filter, filter, filter, filter, from, from, from, getDirectoryFileTreeFactory, getDirPermissions, getDocumentationRegistry, getDuplicatesStrategy, getExcludes, getFileLookup, getFilePermissions, getFileResolver, getFileSystem, getFilteringCharset, getIncludeEmptyDirs, getIncludes, getInstantiator, getMainSpec, getObjectFactory, getPropertyFactory, getSource, include, include, include, include, into, into, into, isCaseSensitive, rename, rename, rename, rename, setCaseSensitive, setDuplicatesStrategy, setExcludes, setFilteringCharset, setIncludeEmptyDirs, setIncludes, withMethods inherited from class org.gradle.api.internal.ConventionTask
conventionMapping, conventionMapping, getConventionMappingMethods inherited from class org.gradle.api.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, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Constructor Details
-
ExtractNativesTask
@Inject public ExtractNativesTask()
-
-
Method Details
-
getArchiveOperations
@Inject protected abstract org.gradle.api.file.ArchiveOperations getArchiveOperations()
-