Skip to content
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

Ask to run generate proto tasks after projects are imported #2195

Merged
merged 4 commits into from
Aug 29, 2022

Conversation

jdneo
Copy link
Contributor

@jdneo jdneo commented Aug 23, 2022

After projects are imported, check if any of the projects contains the
classpath entry having 'protobuf_generated_source' attribute and is empty.

If we found such projects, ask users to run 'generateProto' and generateTestProto
Gradle tasks to generate those Java source files.

How to test this PR

  1. Import https://github.com/square/retrofit
  2. If the protobuf output sources haven't been generated, a notification will be popped up to ask user to generate.
  3. If it has been generated, nothing happens.

Signed-off-by: Sheng Chen sheche@microsoft.com

@jdneo jdneo marked this pull request as ready for review August 23, 2022 08:43
After projects are imported, check if any of the projects contains the
classpath entry having 'protobuf_generated_source' attribute and is empty.

If we found such projects, ask users to run 'generateProto' and `generateTestProto`
Gradle tasks to generate those Java source files.

Signed-off-by: Sheng Chen <sheche@microsoft.com>
@jdneo
Copy link
Contributor Author

jdneo commented Aug 24, 2022

test this please

Signed-off-by: Sheng Chen <sheche@microsoft.com>
Signed-off-by: Sheng Chen <sheche@microsoft.com>
…nerate

Signed-off-by: Sheng Chen <sheche@microsoft.com>
@jdneo jdneo merged commit 832ba92 into eclipse-jdtls:master Aug 29, 2022
@jdneo jdneo deleted the cs/protobuf-auto-generate branch August 29, 2022 01:41
if (!projectUris.isEmpty()) {
ActionableNotification notification = new ActionableNotification().withSeverity(MessageType.Info)
.withMessage("Would you like to generate Java source files out of your proto files?")
.withCommands(Arrays.asList(new Command("Yes", "java.protobuf.generateSources", Arrays.asList(projectUris))));
Copy link
Contributor

Choose a reason for hiding this comment

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

@jdneo I've tested the change and it works well. Apologies for taking long. Regarding the prompt, I would change "Yes" to "Generate". I think if we have a Yes/No dialog but we only want to display the action that does something, then we can just name it by the action that will be taken.

Copy link
Contributor Author

@jdneo jdneo Aug 29, 2022

Choose a reason for hiding this comment

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

Generate sounds better than Yes. 👍

I'll raise another PR to change it

Here: #2200

@jdneo jdneo added this to the End August 2022 milestone Aug 29, 2022
gayanper pushed a commit to gayanper/eclipse.jdt.ls that referenced this pull request Sep 8, 2022
…jdtls#2195)

* Ask to run generate proto task after projects import

After projects are imported, check if any of the projects contains the
classpath entry having 'protobuf_generated_source' attribute and is empty.

If we found such projects, ask users to run 'generateProto' and `generateTestProto`
Gradle tasks to generate those Java source files.

Signed-off-by: Sheng Chen <sheche@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants