Search in sources :

Example 1 with BuildTimestamp

use of org.eclipse.titan.designer.compiler.BuildTimestamp in project titan.EclipsePlug-ins by eclipse.

the class TITANJavaBuilder method build.

@Override
protected IProject[] build(final int kind, final Map<String, String> args, final IProgressMonitor monitor) throws CoreException {
    IProject project = getProject();
    if (!TITANInstallationValidator.check(true)) {
        return project.getReferencedProjects();
    }
    if (!LicenseValidator.check()) {
        return project.getReferencedProjects();
    }
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    final boolean reportDebugInformation = store.getBoolean(PreferenceConstants.DISPLAYDEBUGINFORMATION);
    final SubMonitor progress = SubMonitor.convert(monitor);
    progress.beginTask("Build", 2);
    ProjectSourceParser sourceParser = GlobalParser.getProjectSourceParser(project);
    // TODO: this is temporary code!
    sourceParser.makefileCreatingAnalyzeAll();
    progress.worked(1);
    BuildTimestamp timestamp = BuildTimestamp.getNewBuildCounter();
    IProgressMonitor codeGeneratorMonitor = progress.newChild(1);
    codeGeneratorMonitor.beginTask("Checking prerequisites", sourceParser.getModules().size() + 1);
    for (Module module : sourceParser.getModules()) {
        TITANDebugConsole.println("Generating code for module `" + module.getIdentifier().getDisplayName() + "'");
        try {
            ProjectSourceCompiler.compile(timestamp, module, reportDebugInformation);
        } catch (Exception e) {
            ErrorReporter.logExceptionStackTrace("While generating Java code for module " + module.getIdentifier().getDisplayName(), e);
        }
        codeGeneratorMonitor.worked(1);
    }
    TITANDebugConsole.println("Generating code for single main");
    try {
        ProjectSourceCompiler.generateSingleMain(project, sourceParser.getModules(), reportDebugInformation);
        ProjectSourceCompiler.generateParallelMain(project, sourceParser.getModules(), reportDebugInformation);
    } catch (CoreException e) {
        ErrorReporter.logExceptionStackTrace("While generating Java code for main module ", e);
    }
    codeGeneratorMonitor.worked(1);
    codeGeneratorMonitor.done();
    return new IProject[0];
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) SubMonitor(org.eclipse.core.runtime.SubMonitor) BuildTimestamp(org.eclipse.titan.designer.compiler.BuildTimestamp) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Module(org.eclipse.titan.designer.AST.Module) IProject(org.eclipse.core.resources.IProject) ProjectSourceParser(org.eclipse.titan.designer.parsers.ProjectSourceParser) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 Module (org.eclipse.titan.designer.AST.Module)1 BuildTimestamp (org.eclipse.titan.designer.compiler.BuildTimestamp)1 ProjectSourceParser (org.eclipse.titan.designer.parsers.ProjectSourceParser)1