Class AccessTransformerService

java.lang.Object
net.fabricmc.loom.util.service.Service<AccessTransformerService.Options>
dev.architectury.loom.accesstransformer.AccessTransformerService

public final class AccessTransformerService extends Service<AccessTransformerService.Options>
A service that executes the access transformer tool. The tool information and the AT files are specified in the options.
  • Field Details

  • Constructor Details

  • Method Details

    • createOptions

      public static org.gradle.api.provider.Provider<AccessTransformerService.Options> createOptions(org.gradle.api.Project project, Object atFiles)
    • createOptions

      public static AccessTransformerService.Options createOptions(org.gradle.api.model.ObjectFactory objects, AccessTransformerService.Tool tool, Object atFiles)
      执行期创建服务选项.

      与 createOptions(Project, Object) 等价,区别只在于 AT 工具的信息与工具服务的设置 都已经在配置期解析成纯值,因此本方法不需要 Project。

      Parameters:
      objects - 执行期可用的对象工厂
      tool - 配置期解析出的 AT 工具信息
      atFiles - 待应用的 access transformer 文件
      Returns:
      服务选项
    • resolveTool

      public static AccessTransformerService.Tool resolveTool(org.gradle.api.Project project)
      配置期解析 AT 工具,得到执行期可用的信息.

      工具 classpath 来自项目依赖解析、JVM 可执行文件来自 Java 工具链,两者都只能在配置期取得, 因此在这里一次性解析出来再传给执行期。

      Parameters:
      project - 当前项目
      Returns:
      AT 工具信息
    • createOptionsForLoaderAts

      public static org.gradle.api.provider.Provider<AccessTransformerService.Options> createOptionsForLoaderAts(org.gradle.api.Project project, TempFiles tempFiles)
    • extractLoaderAts

      public static List<String> extractLoaderAts(Path jar, UserdevConfig.AccessTransformerLocation location, TempFiles tempFiles) throws IOException
      把 loader 的 AT 文件从 userdev jar 里抽到本次调用的临时目录,返回抽出的文件路径.

      与 createOptionsForLoaderAts(Project, TempFiles) 共用这一处实现:配置期路径在选项被求值时 抽取,执行期任务在自己的临时目录里抽取,因此两条路径的 --atFile 集合与顺序不会分叉。

      Parameters:
      jar - userdev jar
      location - AT 文件在 jar 里的位置声明(UserdevConfig.ats)
      tempFiles - 抽出文件的临时目录;必须活到 AT 工具执行结束
      Throws:
      IOException
    • execute

      public void execute(Path input, Path output) throws IOException
      Throws:
      IOException