Skip to content

Added API to manually run CMake - #1483

Open
DangMinhTam382 wants to merge 5 commits into
eclipse-cdt:mainfrom
DangMinhTam382:CMakeConfigurationWork
Open

Added API to manually run CMake#1483
DangMinhTam382 wants to merge 5 commits into
eclipse-cdt:mainfrom
DangMinhTam382:CMakeConfigurationWork

Conversation

@DangMinhTam382

Copy link
Copy Markdown
Contributor

Allows ISV to manually run CMake without having to build the project.
Moved code to separate method and make a convenience protected for the derived to call.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

Test Results

4 719 tests  ±0   4 710 ✅ ±0   2m 23s ⏱️ -10s
  183 suites ±0       9 💤 ±0 
  183 files   ±0       0 ❌ ±0 

Results for commit 1d4ca49. ± Comparison against base commit 90d1dd3.

♻️ This comment has been updated with latest results.

@DangMinhTam382

Copy link
Copy Markdown
Contributor Author

Hi Mr. @betamaxbandit ,
CC: Mr. @Kummallinen ,

Before making this PR official, could you take a quick look and let me know what you think?

FYI, it built failed due to the removal of IMG_DLCL_COPY_VIEW_TO_CLIPBOARD in IInternalDebugUIConstants.class.
Fix for this build should be included in #1485

Thanks.

@DangMinhTam382
DangMinhTam382 force-pushed the CMakeConfigurationWork branch from db124ca to 6b81f27 Compare June 25, 2026 10:56
@betamaxbandit

Copy link
Copy Markdown
Contributor

Hi Mr. @betamaxbandit , CC: Mr. @Kummallinen ,

Before making this PR official, could you take a quick look and let me know what you think?

Hi @DangMinhTam382 ,
Thanks for this. I've started reviewing this, but need some more time. I'll probably finish the review tomorrow (Fr).
Cheers John

Allows ISV to manually run CMake without having to build the project.
Moved code to separate method and make a convenience protected for the
derived to call.
@DangMinhTam382
DangMinhTam382 force-pushed the CMakeConfigurationWork branch from 6b81f27 to f70ef1b Compare July 20, 2026 10:14
@DangMinhTam382

Copy link
Copy Markdown
Contributor Author

Hi Mr. @betamaxbandit ,

I have made some modification to allow manual testing for this PR.
This is now ready to be review now!

Many thanks,
Tam.

@betamaxbandit betamaxbandit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few minor grammar issues.


### 9) CMake configuration

Verifies that API for configuring CMake could work individually.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifies that the API for configuring CMake can be invoked independently.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I updated the README.md file

### 9) CMake configuration

Verifies that API for configuring CMake could work individually.
Note, API could only be test in Developer environment with plug-in **org.eclipse.cdt.cmake.example** included.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this API can only be tested in a CDT development environment that includes the org.eclipse.cdt.cmake.example plug-in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I updated the README.md file

Comment on lines +49 to +52
1. Remove existing "**/build/**" folder.
2. Right click project > select "Configure CMake Project".

Expected: CMake Configuration process start with active launch settings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Remove any existing **/build/** folder.
  2. Right-click the project and select Configure CMake Project.

Expected: The CMake configuration process starts using the active launch settings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I updated the README.md file

@jld01
jld01 marked this pull request as ready for review July 21, 2026 13:43
ILog.of(ConfigureExtendedCMakeProjectHandler.class)
.error("Failed to configure for extended CMake Project", e); //$NON-NLS-1$
}
return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runInWorkspace should return an IStatus. Returning null after logging the exception is risky and means the Jobs framework does not receive a proper failure status.

Could this return the CoreException status, or an error status for IOException?

Something like ...

} catch (CoreException e) {
	return e.getStatus();
} catch (IOException e) {
	ILog.of(ConfigureExtendedCMakeProjectHandler.class)
			.error("Failed to configure for extended CMake Project", e); //$NON-NLS-1$
	return Status.error("Failed to configure for extended CMake Project", e); //$NON-NLS-1$
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, thanks for pointing this out and the suggestion as well.

I believe the WorkspaceJob does log the error if an error status is return.
So, I grouped them together and return a simple
Status.error(message, exception)

WDT?

return null;
}
};
job.schedule();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job modifies project state: markers, resource refresh, and scanner information. Should it set a scheduling rule before scheduling, probably the project, to avoid running concurrently with other workspace operations on the same project?
Suggestion ...

job.setRule(project);
job.schedule();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm with you on this one.

I'm not quite sure if there's another WS job running during CMake configuration process, so I'll play it safe here and set rule to it as suggested.

point="org.eclipse.ui.commands">
<command
id="org.eclipse.cdt.cmake.example.configureCMakeProject"
name="Configure Extended CMake Project">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The menu label says "Configure CMake Project" but the command name says "Configure Extended CMake Project". Could these be made consistent? Unless "Extended" has a specific meaning here, I suggest using "Configure CMake Project" in both places.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, the initial intent was to allow CMake configuration only for Extended CMake projects.
Later, this was changed to support all CMake projects, and these spots were somehow missed.

Updated the UI and class names to align with the current behavior.

@betamaxbandit betamaxbandit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
this is looking really good.
There's a few minor issues that should be resolved please.

@DangMinhTam382
DangMinhTam382 force-pushed the CMakeConfigurationWork branch from a8aa06f to 6314dbd Compare July 22, 2026 09:00

@DangMinhTam382 DangMinhTam382 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Mr. @betamaxbandit ,

I fixed your comments and this should be ready to be reviewed again

Many thanks,
Tam

return null;
}
};
job.schedule();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm with you on this one.

I'm not quite sure if there's another WS job running during CMake configuration process, so I'll play it safe here and set rule to it as suggested.


### 9) CMake configuration

Verifies that API for configuring CMake could work individually.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I updated the README.md file

Comment on lines +49 to +52
1. Remove existing "**/build/**" folder.
2. Right click project > select "Configure CMake Project".

Expected: CMake Configuration process start with active launch settings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I updated the README.md file

ILog.of(ConfigureExtendedCMakeProjectHandler.class)
.error("Failed to configure for extended CMake Project", e); //$NON-NLS-1$
}
return null;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, thanks for pointing this out and the suggestion as well.

I believe the WorkspaceJob does log the error if an error status is return.
So, I grouped them together and return a simple
Status.error(message, exception)

WDT?

point="org.eclipse.ui.commands">
<command
id="org.eclipse.cdt.cmake.example.configureCMakeProject"
name="Configure Extended CMake Project">

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, the initial intent was to allow CMake configuration only for Extended CMake projects.
Later, this was changed to support all CMake projects, and these spots were somehow missed.

Updated the UI and class names to align with the current behavior.

@betamaxbandit betamaxbandit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks Tam for reworking this.
I think it's now ready to merge.

Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.cmake.example;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.0.1.qualifier

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 1.0.100

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Mr. @jld01 ,

Updated the micro version to 100 as suggested.
Just for my understanding, is "increasing micro by 100" always applied? or is it just temporary?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update, @DangMinhTam382. The CDT project follows the same versioning rules as Eclipse Platform. The bundle micro version is updated by 1 for occasional CDT bugfix releases from an existing release branch (such as CDT 11.6.1). For the regular minor releases (where a new release branch will be made shortly before release), we update the so-called service segment.

@DangMinhTam382

Copy link
Copy Markdown
Contributor Author

@jld01 jld01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundle version looks good now.

@DangMinhTam382

Copy link
Copy Markdown
Contributor Author

Thanks Mr. @betamaxbandit and Mr. @jld01 for reviewing this.

Mr. @jonahgraham, could you have a look and merge this one for me?
Also, there are 5 commits in this PR, do they need to be squash into 1 before merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants