mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Moved compile_commands.json file to performPrebuildGeneration, so the file to be generated only when Makefiles generation is set to be on.
This commit is contained in:
parent
c8e47b321d
commit
b6d64ed76d
2 changed files with 27 additions and 4 deletions
|
@ -17,6 +17,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.jsoncdb.CompilationDatabaseInformation;
|
import org.eclipse.cdt.managedbuilder.core.jsoncdb.CompilationDatabaseInformation;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder;
|
import org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder;
|
||||||
import org.eclipse.cdt.managedbuilder.testplugin.AbstractBuilderTest;
|
import org.eclipse.cdt.managedbuilder.testplugin.AbstractBuilderTest;
|
||||||
|
@ -199,4 +205,19 @@ public class CompilationDatabaseGenerationTest extends AbstractBuilderTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMakeFileGenerationOff() throws Exception {
|
||||||
|
setWorkspace("regressions");
|
||||||
|
final IProject app = loadProject("helloworldC");
|
||||||
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(app);
|
||||||
|
IManagedProject mProj = info.getManagedProject();
|
||||||
|
IConfiguration cfg = mProj.getConfigurations()[0];
|
||||||
|
IToolChain toolChain = cfg.getToolChain();
|
||||||
|
IBuilder builder = toolChain.getBuilder();
|
||||||
|
setGenerateFileOptionEnabled(true);
|
||||||
|
builder.setManagedBuildOn(false);
|
||||||
|
app.build(IncrementalProjectBuilder.FULL_BUILD, null);
|
||||||
|
assertFalse(app.getFile("Debug/compile_commands.json").exists());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,10 +510,6 @@ public class CommonBuilder extends ACBuilder implements IIncrementalProjectBuild
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
if (isGenerateFileOptionEnabled()) {
|
|
||||||
CompilationDatabaseGenerator generator = new CompilationDatabaseGenerator(getProject(), activeCfg);
|
|
||||||
generator.generate();
|
|
||||||
}
|
|
||||||
//bug 219337
|
//bug 219337
|
||||||
if (kind == INCREMENTAL_BUILD || kind == AUTO_BUILD) {
|
if (kind == INCREMENTAL_BUILD || kind == AUTO_BUILD) {
|
||||||
if (buildConfigResourceChanges()) { //only build projects with project resource changes
|
if (buildConfigResourceChanges()) { //only build projects with project resource changes
|
||||||
|
@ -883,6 +879,12 @@ public class CommonBuilder extends ACBuilder implements IIncrementalProjectBuild
|
||||||
|
|
||||||
protected BuildStatus performPrebuildGeneration(int kind, CfgBuildInfo bInfo, BuildStatus buildStatus,
|
protected BuildStatus performPrebuildGeneration(int kind, CfgBuildInfo bInfo, BuildStatus buildStatus,
|
||||||
IProgressMonitor monitor) throws CoreException {
|
IProgressMonitor monitor) throws CoreException {
|
||||||
|
|
||||||
|
if (isGenerateFileOptionEnabled()) {
|
||||||
|
CompilationDatabaseGenerator generator = new CompilationDatabaseGenerator(getProject(),
|
||||||
|
bInfo.getConfiguration());
|
||||||
|
generator.generate();
|
||||||
|
}
|
||||||
IBuilder builder = bInfo.getBuilder();
|
IBuilder builder = bInfo.getBuilder();
|
||||||
if (builder.isInternalBuilder())
|
if (builder.isInternalBuilder())
|
||||||
return buildStatus;
|
return buildStatus;
|
||||||
|
|
Loading…
Add table
Reference in a new issue