Class SourceRemapper

java.lang.Object
net.fabricmc.loom.util.SourceRemapper

public class SourceRemapper extends Object
  • Field Details

    • SKIPPED_LOG_MARKER

      public static final String SKIPPED_LOG_MARKER
      「配置期 mod 源码重映射因 MC jar 未就位而整批跳过」的日志前缀.

      公开是为了让测试按同一份字面量断言:跳过是**预期行为**(见 remapAll()), 但它是「静默失败」的反面——必须能从构建日志里确认它确实发生了。

      See Also:
  • Constructor Details

    • SourceRemapper

      public SourceRemapper(org.gradle.api.Project project, ServiceFactory serviceFactory, boolean toNamed)
    • SourceRemapper

      public SourceRemapper(org.gradle.api.Project project, ServiceFactory serviceFactory, String from, String to)
  • Method Details

    • scheduleRemapSources

      public void scheduleRemapSources(File source, File destination, boolean reproducibleFileOrder, boolean preserveFileTimestamps, Runnable completionCallback)
    • remapAll

      public void remapAll()
    • createMercury

      public static org.cadixdev.mercury.Mercury createMercury(org.cadixdev.lorenz.MappingSet mappings, Iterable<Path> classPathFiles)
      构造用于 sources 重映射的 Mercury 实例.

      不依赖 Project,映射集与 classpath 全部由调用方备妥。

      这是 sources 重映射的计算核心。原实现从 LoomGradleExtension 取 mappings、mapped MC jar、unmapped mod 集合,并在配置期解析 detachedConfiguration; 拆分后这些都在调用方一次性备好,本方法只做「构造 Mercury 并装配 processor」。

    • copyNonJavaFiles

      public static void copyNonJavaFiles(Path from, Path to, org.slf4j.Logger logger, Path source) throws IOException
      Throws:
      IOException
    • createMercuryWithClassPath

      public static org.cadixdev.mercury.Mercury createMercuryWithClassPath(Iterable<Path> classPathFiles)
      构造带 classpath 的 Mercury 实例.

      不依赖 Project,classpath 由调用方显式给出。

      把「从哪里取 classpath」与「如何构造 Mercury」分开:前者是项目模型访问 (只能在配置期做),后者是纯计算,可以移到执行阶段用已解析好的文件列表构造。

    • createMercuryWithClassPath

      public static org.cadixdev.mercury.Mercury createMercuryWithClassPath(org.gradle.api.Project project, boolean toNamed)