Class WorkerBase

  • Direct Known Subclasses:
    CoreWorker, PlatformWorker

    public abstract class WorkerBase
    extends Object
    MPS-aware job triggered by an Ant task. Unlike the task, assumes MPS classes in the classpath. Extent of the classes is not well defined, though and may vary from worker to worker (e.g. some gonna use IdeaEnironment and hence need IDEA platform, others may stick to MpsEnvironment with less classes in the classpath). The mechanism to describe this is not well-defined at the moment. Now MPS workers start with a help of a code in MpsLoadTask class which generally loads everything under mps-home/lib based on Ant Project properties (various "artifacts.*" values). Task has control over classpath through MpsLoadTask#calculateClassPath() method and may supply extra elements in use by particular worker (e.g. MigrationTask adds jars of migration plugin)
    • Field Detail

      • myWhatToDo

        protected final Script myWhatToDo
      • mySkipCompilation

        protected final boolean mySkipCompilation
    • Constructor Detail

      • WorkerBase

        public WorkerBase​(Script whatToDo)
    • Method Detail

      • createEnvironment

        protected abstract Environment createEnvironment()
      • workFromMain

        public void workFromMain()
      • work

        public abstract void work()
      • createDummyProject

        protected Project createDummyProject()
      • dispose

        protected void dispose()
      • failBuild

        protected void failBuild​(String name)
      • extractModels

        protected void extractModels​(Set<SModel> result,
                                     Project project)
      • collectFromModuleFiles

        protected Set<SModule> collectFromModuleFiles​(SRepository repo)
        XXX Perhaps, would be better to pass Project here so that we populate Project explicitly, rather than collect some modules (under Project's MA lock!), but process them independently using ObjectsToProcess
      • processModuleFile

        protected void processModuleFile​(SRepository repo,
                                         File moduleSourceDescriptorFile,
                                         Set<SModule> modules)
        Discovers module(s) from specified location of a module descriptor, loads and registers them in global (JUST FOR NOW) repository with custom owner. The method used to filter out read-only module and DevKit which is odd provided we have no idea what's the reason to load the module in the first place. Now it's caller responsibility to deal with loaded modules and ignore those undesired as appropriate.
        Parameters:
        moduleSourceDescriptorFile - not null
        modules - collection to populate, not null.
      • info

        public void info​(String text)
      • warning

        public void warning​(String text)
      • debug

        public void debug​(String text)
      • error

        public void error​(String text)