/** * The artifact for the .o file that should be generated when compiling the {@code source} * artifact. */ public Artifact objFile(Artifact source) { if (source.isTreeArtifact()) { PathFragment rootRelativePath = source.getRootRelativePath().replaceName("obj_files"); return ruleContext.getTreeArtifact(rootRelativePath, ruleContext.getBinOrGenfilesDirectory()); } else { return inUniqueObjsDir(source, ".o"); } }