Skip to content

Commit

Permalink
IEP-928: Workspace hangs if project is closed while indexer is running (
Browse files Browse the repository at this point in the history
#812)

* Handling parse in sep job

* Update IDFBuildConfiguration.java

* fix(build): externalizing job name
  • Loading branch information
sigmaaa authored Sep 15, 2023
1 parent 5104b10 commit 6ff9814
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobGroup;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
Expand Down Expand Up @@ -124,7 +127,7 @@ public class IDFBuildConfiguration extends CBuildConfiguration
public static final String CMAKE_ENV = "cmake.environment"; //$NON-NLS-1$
public static final String BUILD_COMMAND = "cmake.command.build"; //$NON-NLS-1$
public static final String CLEAN_COMMAND = "cmake.command.clean"; //$NON-NLS-1$

private JobGroup jobGroup = new JobGroup("Parsing Job...", 1, 1); //$NON-NLS-1$
private ILaunchTarget launchtarget;
private Map<IResource, IScannerInfo> infoPerResource;
/**
Expand Down Expand Up @@ -971,11 +974,26 @@ public void clean(IConsole console, IProgressMonitor monitor) throws CoreExcepti
private void processCompileCommandsFile(IConsole console, IProgressMonitor monitor) throws CoreException
{
IFile file = getCompileCommandsJsonFile(monitor);

CompileCommandsJsonParser parser = new CompileCommandsJsonParser(
new ParseRequest(file, new CMakeIndexerInfoConsumer(this::setScannerInformation, getProject()),
CommandLauncherManager.getInstance().getCommandLauncher(this), console));
parser.parse(monitor);
Job parseJob = new Job(Messages.IDFBuildConfiguration_ParseCommand)
{
protected IStatus run(IProgressMonitor monitor)
{
try
{
parser.parse(monitor);
}
catch (CoreException e)
{
Logger.log(e);
}
return Status.OK_STATUS;
}
};
parseJob.setJobGroup(jobGroup);
parseJob.schedule();
}

private IFile getCompileCommandsJsonFile(IProgressMonitor monitor) throws CoreException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class Messages extends NLS
public static String CMakeBuildConfiguration_Failure;
public static String CMakeErrorParser_NotAWorkspaceResource;
public static String IDFBuildConfiguration_CMakeBuildConfiguration_NoToolchainFile;
public static String IDFBuildConfiguration_ParseCommand;
public static String IncreasePartitionSizeTitle;
public static String IncreasePartitionSizeMessage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CMakeBuildConfiguration_ProcCompJson=Processing compile_commands.json
CMakeBuildConfiguration_Failure=Failure running cmake: %s\n
CMakeErrorParser_NotAWorkspaceResource=Could not map %s to a workspace resource. Did the build run in a container?
IDFBuildConfiguration_CMakeBuildConfiguration_NoToolchainFile=No toolchain file found
IDFBuildConfiguration_ParseCommand=Parse Compile Commands File
IncreasePartitionSizeTitle=Low Application Partition Size
IncreasePartitionSizeMessage=Less than 30% of application partition size is free({0} of {1} bytes), would you like to increase it? Please click <a href={2}>here</a> to check more details.
ToolsInitializationDifferentPathMessageBoxTitle=Different IDF path found in the config file
Expand Down

0 comments on commit 6ff9814

Please sign in to comment.