Class ProjectView.AbstractProjectView
java.lang.Object
net.fabricmc.loom.configuration.processors.speccontext.ProjectView.AbstractProjectView
- All Implemented Interfaces:
ProjectView
- Direct Known Subclasses:
DeobfProjectView.Impl,RemappedProjectView.Impl
- Enclosing interface:
ProjectView
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.fabricmc.loom.configuration.processors.speccontext.ProjectView
ProjectView.AbstractProjectView, ProjectView.ArtifactUsage -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LoomGradleExtensionprotected final org.gradle.api.Project -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.fabricmc.loom.configuration.processors.speccontext.ProjectView
getLoomProjectDependencies
-
Field Details
-
project
protected final org.gradle.api.Project project -
extension
-
-
Constructor Details
-
AbstractProjectView
protected AbstractProjectView(org.gradle.api.Project project)
-
-
Method Details
-
getLoomProjectDataDependencies
Description copied from interface:ProjectView返回指定配置中依赖项目的跨项目数据.这些数据会被打进 jar processor 的 spec 并参与其
hashCode,因此它决定了 processed jar 的路径与共享缓存的命中。数据有两个来源:构建级内存共享表 (由依赖项目自身的afterEvaluate写入)与依赖项目导出的数据文件。后者由依赖项目的 任务在执行期产出,配置期(冷启动)必然不存在,所以配置期能否读到数据只取决于前者, 也就是只取决于依赖项目是否已经完成求值。非隔离模式:本方法在读取前用
Project.evaluationDependsOn(String)强制每个 依赖项目先完成求值,把「依赖项目的afterEvaluate先于本次读取」钉死,从而共享表必定 命中、哈希恒定包含依赖数据,与配置顺序、是否--parallel无关。只有当确实会消费这些 数据(ProjectView.disableProjectDependantMods()为 false)时才强制求值,不给不需要它的构建增加 配置开销。若两个 Loom 项目互相声明项目依赖,强制求值会让 Gradle 抛出循环求值异常 (CircularReferenceException,消息里会点名参与循环的项目);Loom 不做环检测,交给 Gradle 报告。隔离模式(Isolated Projects):跨项目求值被 Gradle 禁止,无法用上面的手段补救, 依赖项目的数据要么恰好因配置顺序已可得,要么缺失。这里做两件事弥补:
- 把依赖项目的
exportLoomProjectData产物声明为本项目编译任务的输入 (wireProjectDataTask),Gradle 据此自动把该任务纳入任务图——本次构建里 数据文件就一定会在被读取前产出,不再依赖「上一次构建恰好跑过导出」; - 数据仍缺失时(例如对端不是 Loom 项目)输出一条按(当前项目,依赖项目)去重的告警。
- Specified by:
getLoomProjectDataDependenciesin interfaceProjectView- Parameters:
name- 配置名(通常是runtimeClasspath/compileClasspath)- Returns:
- 依赖项目的数据流;不是 Loom 项目的依赖不会出现在其中
- 把依赖项目的
-
getMods
- Specified by:
getModsin interfaceProjectView
-
disableProjectDependantMods
public boolean disableProjectDependantMods()- Specified by:
disableProjectDependantModsin interfaceProjectView
-
areEnvironmentSourceSetsSplit
public boolean areEnvironmentSourceSetsSplit()- Specified by:
areEnvironmentSourceSetsSplitin interfaceProjectView
-