-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add command to build workspace #326
Conversation
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ansyral It works fine. Could you create a test?
Can you remind me, what is the reason for having this extension? |
@snjeza , I added the tests. |
@ansyral tests fail
|
@snjeza unfortunately i cannot repro it locally. BTW, do you know why jenkins build isn't enabled for this pr? |
ok to test Jenkins |
38913f6
to
20ed6b7
Compare
* @see org.eclipse.jdt.ls.core.internal.JavaProtocolExtensions#buildWorkspace(java.lang.String) | ||
*/ | ||
@Override | ||
public CompletableFuture<BuildWorkspaceResult> buildWorkspace(String type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the expected values for type? At the moment it looks like it is not used, we need to clarify its purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could be removed
@NonNull | ||
private BuildWorkspaceStatus status; | ||
|
||
private String details; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be better if details is an array of org.eclipse.lsp4j.Diagnostic
instead of an concatenated list of compiler error strings.
} | ||
} catch (CoreException e) { | ||
logException("Failed to build workspace.", e); | ||
return new BuildWorkspaceResult(BuildWorkspaceStatus.FAILED, String.format("Exception: %s.", e.getMessage())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we distinguish between a build failure and a build that returns errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice~ I'll add another status to tell the two
@ansyral any update? |
ffdd365
to
fc7249c
Compare
@gorkem added a new iteration and rebased on the master branch |
private static List<IMarker> getBuildErrors(IProgressMonitor monitor) throws CoreException { | ||
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); | ||
List<IMarker> errors = new ArrayList<>(); | ||
for (IProject project : projects) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check is monitor is cancelled
for (Map.Entry<IResource, List<IMarker>> entry : map.entrySet()) { | ||
IResource resource = entry.getKey(); | ||
IFile file = resource.getAdapter(IFile.class); | ||
if (file != null && JavaCore.isJavaLikeFileName(file.getName())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will miss build files. Check with ProjectsManager#isBuildFile
@@ -0,0 +1,7 @@ | |||
public class s1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Java conventions: Pascal cased files and class names.
*/ | ||
public enum BuildWorkspaceStatus { | ||
|
||
FAILED, SUCCEED, WITHERROR, CANCELLED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WITH_ERROR
We should probably report some progress to the client, not sure how though. But I know vscode supports it |
@fbricon added the progress in the pr redhat-developer/vscode-java#298 |
@fbricon do you have more comments about the pr? could you please help merge the pr if no more comments? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the PR cannot be rebased cleanly
|
||
public BuildWorkspaceStatus buildWorkspace(IProgressMonitor monitor) { | ||
try { | ||
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be a full build? or even better, have the build kind be received as a command parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a parameter
return to; | ||
} | ||
|
||
private static void createFolders(IContainer folder, IProgressMonitor monitor) throws CoreException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be replaced by a call to JDTUtils.createFolders
Signed-off-by: xuzho <[email protected]>
Signed-off-by: xuzho <[email protected]>
Signed-off-by: xuzho <[email protected]>
Signed-off-by: xuzho <[email protected]>
Signed-off-by: xuzho <[email protected]>
Signed-off-by: xuzho <[email protected]>
Signed-off-by: xuzho <[email protected]>
Signed-off-by: xuzho <[email protected]>
Signed-off-by: xuzho <[email protected]>
@tsmaeder is this something Che would use? If yes, can you check the API matches your expectations? |
I noticed that if you delete some packages from CLI (outside vscode), the missing classes are not picked up, so no compilation errors. Calling the build command won't actually show any compilation either. You need to restart vscode. I think the workspace needs to be refreshed before the build is triggered |
} | ||
|
||
public BuildWorkspaceStatus buildWorkspace(boolean forceReBuild, IProgressMonitor monitor) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, monitor);
here, fixes the issues with out-of-synch file system.
Signed-off-by: xuzho [email protected]