Module aya.cli.impl

Interface CompilerAdvisor

All Known Implementing Classes:
DelegateCompilerAdvisor, DiskCompilerAdvisor, InMemoryCompilerAdvisor

public interface CompilerAdvisor
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 @NotNull org.aya.concrete.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(org.aya.core.serde.SerTerm.DeState deState, @NotNull org.aya.util.reporter.Reporter reporter, @NotNull kala.collection.immutable.ImmutableSeq<String> mod, @Nullable Path sourcePath, @Nullable Path corePath, @NotNull org.aya.resolve.module.ModuleLoader recurseLoader)
    Try to load the compiled core.
    void
    doSaveCompiledCore(org.aya.core.serde.Serializer.State serState, @NotNull LibrarySource file, @NotNull org.aya.resolve.ResolveInfo resolveInfo, @NotNull kala.collection.immutable.ImmutableSeq<org.aya.core.def.GenericDef> defs)
     
    static @NotNull CompilerAdvisor
     
    boolean
     
    default @Nullable org.aya.resolve.ResolveInfo
    loadCompiledCore(org.aya.core.serde.SerTerm.DeState deState, @NotNull org.aya.util.reporter.Reporter reporter, @NotNull kala.collection.immutable.ImmutableSeq<String> 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(org.aya.core.serde.Serializer.State serState, @NotNull LibrarySource file, @NotNull org.aya.resolve.ResolveInfo resolveInfo, @NotNull kala.collection.immutable.ImmutableSeq<org.aya.core.def.GenericDef> 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.concrete.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 org.aya.core.serde.SerTerm.DeState deState, @NotNull @NotNull org.aya.util.reporter.Reporter reporter, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<String> 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 org.aya.core.serde.Serializer.State serState, @NotNull @NotNull LibrarySource file, @NotNull @NotNull org.aya.resolve.ResolveInfo resolveInfo, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.core.def.GenericDef> defs) throws IOException
      Throws:
      IOException
    • loadCompiledCore

      @NonExtendable @Nullable default @Nullable org.aya.resolve.ResolveInfo loadCompiledCore(@NotNull org.aya.core.serde.SerTerm.DeState deState, @NotNull @NotNull org.aya.util.reporter.Reporter reporter, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<String> mod, @Nullable @Nullable Path sourcePath, @Nullable @Nullable Path corePath, @NotNull @NotNull org.aya.resolve.module.ModuleLoader recurseLoader)
    • saveCompiledCore

      @NonExtendable default void saveCompiledCore(@NotNull org.aya.core.serde.Serializer.State serState, @NotNull @NotNull LibrarySource file, @NotNull @NotNull org.aya.resolve.ResolveInfo resolveInfo, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.core.def.GenericDef> defs)