Package jetbrains.mps.tool.builder
Class WorkerBase
- java.lang.Object
 - 
- jetbrains.mps.tool.builder.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 Summary
Fields Modifier and Type Field Description protected EnvironmentmyEnvironmentprotected List<String>myErrorsprotected JavaCompilerOptionsmyJavaCompilerOptionsprotected booleanmySkipCompilationprotected ScriptmyWhatToDo 
- 
Constructor Summary
Constructors Constructor Description WorkerBase(Script whatToDo) 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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 ObjectsToProcessprotected ProjectcreateDummyProject()protected abstract EnvironmentcreateEnvironment()protected EnvironmentConfigcreateEnvironmentConfig(Script whatToDo)voiddebug(String text)protected voiddispose()voiderror(String text)protected voidextractModels(Collection<SModel> modelsList, SModule m)protected voidextractModels(Set<SModel> result, Project project)static StringBufferextractStackTrace(Throwable e)protected voidfailBuild(String name)protected StringBufferformatErrorsReport(String taskName)protected ComponentHostgetPlatform()voidinfo(String text)voidlog(String text, Throwable e)voidlog(Throwable e)protected voidprocessModuleFile(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.voidwarning(String text)abstract voidwork()voidworkFromMain() 
 - 
 
- 
- 
Field Detail
- 
myWhatToDo
protected final Script myWhatToDo
 
- 
myJavaCompilerOptions
protected final JavaCompilerOptions myJavaCompilerOptions
 
- 
mySkipCompilation
protected final boolean mySkipCompilation
 
- 
myEnvironment
protected Environment myEnvironment
 
 - 
 
- 
Constructor Detail
- 
WorkerBase
public WorkerBase(Script whatToDo)
 
 - 
 
- 
Method Detail
- 
createEnvironment
protected abstract Environment createEnvironment()
 
- 
createEnvironmentConfig
protected final EnvironmentConfig createEnvironmentConfig(Script whatToDo)
 
- 
workFromMain
public void workFromMain()
 
- 
work
public abstract void work()
 
- 
createDummyProject
protected Project createDummyProject()
 
- 
dispose
protected void dispose()
 
- 
getPlatform
protected final ComponentHost getPlatform()
 
- 
formatErrorsReport
protected StringBuffer formatErrorsReport(String taskName)
 
- 
failBuild
protected void failBuild(String name)
 
- 
extractModels
protected void extractModels(Collection<SModel> modelsList, SModule m)
 
- 
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 nullmodules- 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)
 
- 
log
public void log(Throwable e)
 
- 
extractStackTrace
public static StringBuffer extractStackTrace(Throwable e)
 
 - 
 
 -