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

Allow to disable protobuf compiler #48

Closed
ksafonov opened this issue Jan 16, 2014 · 8 comments
Closed

Allow to disable protobuf compiler #48

ksafonov opened this issue Jan 16, 2014 · 8 comments
Milestone

Comments

@ksafonov
Copy link

I've got a couple of protobuf files in my project which should not be compiled as part of project build. At the moment I get an exception thrown (see below) and my project does not compile at all (which sucks!). I would prefer protobuf compilation to be disabled explicitly or automatically if protoc path is not specified.

IDEA IU-133.193
Protobuf plugin 0.5.5

Also please note a mistype in the message below ("Please set in Settins > Compiler")


Exception:
Cannot generate protobuf files as the path to protoc has not been set. Please set in Settins > Compiler
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:113)
at protobuf.compiler.PbCompiler.generate(PbCompiler.java:106)
at protobuf.compiler.PbPrecompileTask.execute(PbPrecompileTask.java:32)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:2375)
at com.intellij.compiler.impl.CompileDriver.access$900(CompileDriver.java:122)
at com.intellij.compiler.impl.CompileDriver$8.run(CompileDriver.java:706)
at com.intellij.compiler.progress.CompilerTask.run(CompilerTask.java:167)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:373)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:436)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:153)

@tcripps
Copy link
Collaborator

tcripps commented Jan 17, 2014

Thanks for the feedback and for pointing out the spelling error. The stack trace in your log should not prevent you from compiling. It simply comes from logging an error level condition. I am considering changing that to a warning.

I don't think removing the path to protoc is the right way to disable the compilation of only some protobuf files in your project. You can do it at the module level (or for all modules in your project) via the Facet settings by opening the Project Structure dialog, selecting Facets on the left pane. Then either disable compilation individually per module or for all modules by clicking on the "Protobuf Facet" group label, and then the "All Facets" tab and unchecking the "Enable compilation" checkbox. I know this is super obvious (sarcasm), but that's where IDEA buries facet settings.

@ksafonov
Copy link
Author

Oh there's one more stack trace actually (see below). Maybe this one stops compilation?

I've got ~ 30 maven modules in my project, two of them have *.proto files (in main/resources). Surprisingly, IDEA detected the Protobuf facet for none of them. I manually added facets for these modules and unchecked the 'Enable compilation' option. This did not help unfortunately.

I would also include the name of the module into the "Cannot generate protobuf files as the path to protoc has not been set" warning.

java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lcom.intellij.openapi.compiler.GeneratingCompiler$GenerationItem;
at protobuf.compiler.PbCompiler.generate(PbCompiler.java:107)
at protobuf.compiler.PbPrecompileTask.execute(PbPrecompileTask.java:32)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:2375)
at com.intellij.compiler.impl.CompileDriver.access$900(CompileDriver.java:122)
at com.intellij.compiler.impl.CompileDriver$8.run(CompileDriver.java:706)
at com.intellij.compiler.progress.CompilerTask.run(CompilerTask.java:167)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:373)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:436)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:153)

On Jan 17, 2014, at 10:48 AM, Travis Cripps notifications@github.com wrote:

Thanks for the feedback and for pointing out the spelling error. The stack trace in your log should not prevent you from compiling. It simply comes from logging an error level condition. I am considering changing that to a warning.

I don't think removing the path to protoc is the right way to disable the compilation of only some protobuf files in your project. You can do it at the module level (or for all modules in your project) via the Facet settings by opening the Project Structure dialog, selecting Facets on the left pane. Then either disable compilation individually per module or for all modules by clicking on the "Protobuf Facet" group label, and then the "All Facets" tab and unchecking the "Enable compilation" checkbox. I know this is super obvious (sarcasm), but that's where IDEA buries facet settings.


Reply to this email directly or view it on GitHub.

@tcripps
Copy link
Collaborator

tcripps commented Jan 20, 2014

Thanks for the follow up. I think there may be an error, then.

On Sat, Jan 18, 2014 at 11:48 PM, Kirill Safonov
notifications@github.comwrote:

Oh there's one more stack trace actually (see below). Maybe this one stops
compilation?

I've got ~ 30 maven modules in my project, two of them have *.proto files
(in main/resources). Surprisingly, IDEA detected the Protobuf facet for
none of them. I manually added facets for these modules and unchecked the
'Enable compilation' option. This did not help unfortunately.

I would also include the name of the module into the "Cannot generate
protobuf files as the path to protoc has not been set" warning.

java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
[Lcom.intellij.openapi.compiler.GeneratingCompiler$GenerationItem;
at protobuf.compiler.PbCompiler.generate(PbCompiler.java:107)
at protobuf.compiler.PbPrecompileTask.execute(PbPrecompileTask.java:32)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:2375)
at
com.intellij.compiler.impl.CompileDriver.access$900(CompileDriver.java:122)
at com.intellij.compiler.impl.CompileDriver$8.run(CompileDriver.java:706)
at com.intellij.compiler.progress.CompilerTask.run(CompilerTask.java:167)
at
com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)

at
com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)

at
com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)

at
com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)

at
com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)

at
com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:373)

at
com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:436)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)

at java.lang.Thread.run(Thread.java:680)
at
com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:153)

On Jan 17, 2014, at 10:48 AM, Travis Cripps notifications@github.com
wrote:

Thanks for the feedback and for pointing out the spelling error. The
stack trace in your log should not prevent you from compiling. It simply
comes from logging an error level condition. I am considering changing that
to a warning.

I don't think removing the path to protoc is the right way to disable
the compilation of only some protobuf files in your project. You can do it
at the module level (or for all modules in your project) via the Facet
settings by opening the Project Structure dialog, selecting Facets on the
left pane. Then either disable compilation individually per module or for
all modules by clicking on the "Protobuf Facet" group label, and then the
"All Facets" tab and unchecking the "Enable compilation" checkbox. I know
this is super obvious (sarcasm), but that's where IDEA buries facet
settings.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/48#issuecomment-32703084
.

@mhgrove
Copy link

mhgrove commented Jul 3, 2014

To confirm, failure to specify the path to protoc or an incorrect path prevents your entire project from building.

My protobuf files almost never change, protoc does not need to run on every compile. It should be manual only.

@tcripps
Copy link
Collaborator

tcripps commented Jul 8, 2014

mhgrove: In the case of an initial build, you'd expect the failure to run the protoc build phase to be a failure. Once you've built successfully, the plugin should detect that your .proto files haven't changed and skip class generation without invoking protoc. There was a bug in v0.5.5 in detecting this properly. If you don't expect the .proto files to change, you can also just disable the plugin by going to the module manager screen, clicking on Facets in the list on the left, choosing the ProtoBuffers facet (top group--not a module), selecting the All Modules and then deselect the checkbox that enables compilation.

@ryanobjc
Copy link

I'd also like to be able to disable compilation as well! This error is preventing the build from running:

4:40:00 PM Throwable: Cannot generate protobuf files as the path to protoc has not been set. Please set in Settins > Compiler
4:40:01 PM Compilation completed with 0 errors and 0 warnings in 0 sec

My project has 500k loc and normally generates 500+ warnings. There are no protobuf facets configured.

@ryanobjc
Copy link

looks like if i set the setting to literally any value, the plugin works.

Kind of a bummer that the out of the box install of this plugin breaks your build, but not in any way that is obvious. Intellij says the build completed. It did not. This bug was really confusing to me.

@driekken
Copy link

This issue prevents IntelliJ (version 14.0.2) from compiling Scala sources.

And the only sign that something is wrong is the same as above:

Throwable: Cannot generate protobuf files as the path to protoc has not been set. Please set in Settins > Compiler

The funny thing is that I don't have any *.proto files or the Protobuf Facet enabled at all in my project.

I've set the setting to a gibberish value and now everything works ok. Probably uninstalling the Protobuf plugin should also do the trick, but I did not try it.

I've been scratching my head for a few hours not understanding what's going on, so hopefully this will help people with a similar problem.

tcripps pushed a commit that referenced this issue Jan 15, 2015
Only warn of compiler path if there are proto files to process (Issue #53).
@tcripps tcripps added this to the 0.5.9 milestone Feb 3, 2015
@tcripps tcripps closed this as completed Feb 3, 2015
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

No branches or pull requests

5 participants