Interface SpecContext

All Known Implementing Classes:
DeobfSpecContext, RemappedSpecContext

public interface SpecContext
  • Method Details

    • modDependencies

      List<FabricModJson> modDependencies()
      Returns a list of all the external mods that this project depends on regardless of configuration.
    • localMods

      List<FabricModJson> localMods()
    • modDependenciesCompileRuntime

      List<FabricModJson> modDependenciesCompileRuntime()
      Return a set of mods that should be used for transforms, that target EITHER the common or client.
    • modDependenciesCompileRuntimeClient

      List<FabricModJson> modDependenciesCompileRuntimeClient()
      Return a set of mods that should be used for transforms, that target ONLY the client.
    • productionNamespace

      MappingsNamespace productionNamespace()
    • allMods

      default List<FabricModJson> allMods()
    • getDependentProjects

      @Deprecated static Stream<org.gradle.api.Project> getDependentProjects(ProjectView projectView)
      Deprecated.
      已无生产实现,改用 getDependentProjectData(ProjectView)
      返回 SpecContext 依赖的其它项目的 Project,现恒为空.

      该方法与 ProjectView.getLoomProjectDependencies(String) 一样,是隔离模式之前 直接访问跨项目模型的旧 SPI:现在没有任何实现会返回非空值,第三方 processor 调用它只会 静默拿到空集合。需要依赖项目的信息请改用 getDependentProjectData(ProjectView)。

      Parameters:
      projectView - 当前项目的视图
      Returns:
      恒为空流
    • getDependentProjectData

      static Stream<LoomProjectData> getDependentProjectData(ProjectView projectView)
      返回 runtime/compile classpath 上去重后的依赖项目数据.

      去重依赖 LoomProjectData.equals(Object) 按项目路径判等:同一项目经内存共享表与 导出文件两条路径可能得到两个实例,只有路径判等才能把它们视作同一个项目。

      这些数据会参与 jar processor spec 的 hashCode,从而决定 processed jar 的路径与共享 缓存命中,所以「配置期拿到哪些依赖项目的数据」必须是确定的:

      • 非隔离模式:读取前会强制每个依赖项目先完成求值 (见 ProjectView.getLoomProjectDataDependencies(String)),依赖项目在 afterEvaluate 里登记的数据因此必定先于本次读取,结果与配置顺序、--parallel 无关;
      • 隔离模式(Isolated Projects):Gradle 禁止跨项目求值,上面的保证无法兑现, 依赖项目的数据是否可得取决于它是否恰好已被配置完,Loom 只能对确实缺失的情况输出一条 按(项目,依赖)去重的告警,无法让结果变确定;
      • 彻底消除这种不确定性需要把 mapped/processed jar 的产出从配置期搬进任务,属于架构级改动, 不在当前版本范围内。
      Parameters:
      projectView - 当前项目的视图
      Returns:
      依赖项目的数据流
    • distinctSorted

      static List<FabricModJson> distinctSorted(List<FabricModJson> mods)