Interface GenerationTargetFacet

  • All Superinterfaces:
    SModuleFacet
    All Known Subinterfaces:
    JavaModuleFacet, TestsFacet
    All Known Implementing Classes:
    JavaModuleFacetImpl, NaiveJavaModuleFacet, TestsFacetImpl

    public interface GenerationTargetFacet
    extends SModuleFacet
    PROVISIONAL API, DO NOT USE OUTSIDE OF MPS. Facet for a module that is capable of producing file artifacts, e.g. source code, configuration files, images. It's distinct from JavaModuleFacet which knows about class files and classpath, while this one doesn't imply generated artifacts need any special treatment. FIXME what about make scenario, with output location re-defined? Perhaps, facet shall tell relative location only (Path instead of IFile), while Make determines placement. What about module compile then? How would it take base path?

    DESIGN NOTE: With location-agnostic modules, might be fruitful to express locations as relative Path, not IFile objects. It's common to collect module's output paths just to match paths of generated files and to re-target them to different location (see ModuleOutputPaths). OTOH, relative to what?

    Single module may instantiate multiple GenerationTargetFacet instances to target multiple generation objectives. It's up to specific facet to tell e.g. Make process which compiler/processor to use. TODO Perhaps, Make process may pick appropriate GenerationTargetFacet based on facet type (e.g. GTFSupplier.getSourceGenerationFacet(SModel):GTF. SModel may keep facet type as its property.

    Since:
    3.5
    • Method Detail

      • getOutputRoot

        @Nullable
        IFile getOutputRoot​(@NotNull
                            SModel model)
        XXX See javadoc for JavaModuleFacet#getOutputRoot(). Perhaps, with the rise of textgen-controlled location, GTF shall tell root only and cease answering getOutputLocation()?
        Parameters:
        model - model of a module this facet is associated with
        Returns:
        FS location where generated files for the model go, same or ancestor of getOutputLocation(SModel) value, or null if this facet doesn't manage output of the model
      • getOutputLocation

        @Nullable
        IFile getOutputLocation​(@NotNull
                                SModel model)
        Location for output files. Generally, shall not be nullable, but would like to give implementors freedom to imply own restrictions (and it's safer to override with NotNull than vice versa).
        Parameters:
        model - model of a module this facet is associated with
        Returns:
        FS location where generated files for the model go (not necessarily unique for the model, models may share one, unless otherwise noted by implementation)
      • getOutputCacheRoot

        @Nullable
        IFile getOutputCacheRoot​(@NotNull
                                 SModel model)
        Parameters:
        model - model of a module this facet is associated with
        Returns:
        FS location where auxiliary generated model files go, same or ancestor of getOutputCacheLocation(SModel) value, or null if this facet doesn't manage output of the model
      • getOutputCacheLocation

        @Nullable
        IFile getOutputCacheLocation​(@NotNull
                                     SModel model)
        Facilitates keeping related generated artifacts, e.g. descriptor, index, debug-related information, which is auxiliary to primary generation artifacts residing in getOutputLocation(SModel)
        Parameters:
        model - model of a module this facet is associated with
        Returns:
        FS location for auxiliary generated files