Module aya.cli.impl

Interface CompilerAdvisor

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
DelegateCompilerAdvisor, DiskCompilerAdvisor, InMemoryCompilerAdvisor

public interface CompilerAdvisor extends AutoCloseable
Advises the compiler to be incremental, helps in-memory analysis, and behaves as the bridge between the library compiler and its caller.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
     
    default void
     
    default @NotNull org.aya.syntax.GenericAyaParser
    createParser(@NotNull org.aya.util.reporter.Reporter reporter)
    Used for injecting parser from IJ plugin to support on-the-fly analysis.
    @Nullable org.aya.resolve.ResolveInfo
    doLoadCompiledCore(@NotNull org.aya.util.reporter.Reporter reporter, @NotNull LibraryOwner owner, @NotNull org.aya.syntax.ref.ModulePath mod, @Nullable Path sourcePath, @Nullable Path corePath, @NotNull org.aya.resolve.module.ModuleLoader recurseLoader)
    Try to load the compiled core.
    void
    doSaveCompiledCore(@NotNull LibrarySource file, @NotNull org.aya.resolve.ResolveInfo resolveInfo, @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.core.def.TyckDef> defs)
     
    static @NotNull CompilerAdvisor
     
    boolean
     
    default @Nullable org.aya.resolve.ResolveInfo
    loadCompiledCore(@NotNull org.aya.util.reporter.Reporter reporter, @NotNull LibraryOwner owner, @NotNull org.aya.syntax.ref.ModulePath mod, @Nullable Path sourcePath, @Nullable Path corePath, @NotNull org.aya.resolve.module.ModuleLoader recurseLoader)
     
    default void
    notifyIncrementalJob(@NotNull kala.collection.immutable.ImmutableSeq<LibrarySource> modified, @NotNull kala.collection.immutable.ImmutableSeq<kala.collection.immutable.ImmutableSeq<LibrarySource>> affected)
    Called when all modified sources are detected
    static @NotNull CompilerAdvisor
     
    void
     
    default void
    saveCompiledCore(@NotNull LibrarySource file, @NotNull org.aya.resolve.ResolveInfo resolveInfo, @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.core.def.TyckDef> defs)
     
    void
     
  • Method Details

    • onDisk

      @NotNull static @NotNull CompilerAdvisor onDisk()
    • inMemory

      @NotNull static @NotNull CompilerAdvisor inMemory()
    • isSourceModified

      boolean isSourceModified(@NotNull @NotNull LibrarySource source)
    • updateLastModified

      void updateLastModified(@NotNull @NotNull LibrarySource source)
    • prepareLibraryOutput

      void prepareLibraryOutput(@NotNull @NotNull LibraryOwner owner) throws IOException
      Throws:
      IOException
    • clearLibraryOutput

      void clearLibraryOutput(@NotNull @NotNull LibraryOwner owner) throws IOException
      Throws:
      IOException
    • clearModuleOutput

      void clearModuleOutput(@NotNull @NotNull LibrarySource source) throws IOException
      Throws:
      IOException
    • createParser

      @NotNull default @NotNull org.aya.syntax.GenericAyaParser createParser(@NotNull @NotNull org.aya.util.reporter.Reporter reporter)
      Used for injecting parser from IJ plugin to support on-the-fly analysis.
    • notifyIncrementalJob

      default void notifyIncrementalJob(@NotNull @NotNull kala.collection.immutable.ImmutableSeq<LibrarySource> modified, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<kala.collection.immutable.ImmutableSeq<LibrarySource>> affected)
      Called when all modified sources are detected
      Parameters:
      modified - User directly modified source files.
      affected - SCC of modified sources.
      API Note:
      the SCC is ordered, but DO NOT RELY on it.
    • doLoadCompiledCore

      @Nullable @Nullable org.aya.resolve.ResolveInfo doLoadCompiledCore(@NotNull @NotNull org.aya.util.reporter.Reporter reporter, @NotNull @NotNull LibraryOwner owner, @NotNull @NotNull org.aya.syntax.ref.ModulePath mod, @Nullable @Nullable Path sourcePath, @Nullable @Nullable Path corePath, @NotNull @NotNull org.aya.resolve.module.ModuleLoader recurseLoader) throws IOException, ClassNotFoundException
      Try to load the compiled core. For DiskCompilerAdvisor, returns null if the core path does not exist or either source or core path is null. For InMemoryCompilerAdvisor, returns null if the mod does not store in memory.
      Throws:
      IOException
      ClassNotFoundException
    • doSaveCompiledCore

      void doSaveCompiledCore(@NotNull @NotNull LibrarySource file, @NotNull @NotNull org.aya.resolve.ResolveInfo resolveInfo, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.core.def.TyckDef> defs) throws IOException
      Throws:
      IOException
    • loadCompiledCore

      @NonExtendable @Nullable default @Nullable org.aya.resolve.ResolveInfo loadCompiledCore(@NotNull @NotNull org.aya.util.reporter.Reporter reporter, @NotNull @NotNull LibraryOwner owner, @NotNull @NotNull org.aya.syntax.ref.ModulePath mod, @Nullable @Nullable Path sourcePath, @Nullable @Nullable Path corePath, @NotNull @NotNull org.aya.resolve.module.ModuleLoader recurseLoader)
    • saveCompiledCore

      @NonExtendable default void saveCompiledCore(@NotNull @NotNull LibrarySource file, @NotNull @NotNull org.aya.resolve.ResolveInfo resolveInfo, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.core.def.TyckDef> defs)
    • close

      default void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception