-
Notifications
You must be signed in to change notification settings - Fork 28
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
Issues running on Windows #6
Comments
This might be related to the second item mentioned above: google/protobuf-gradle-plugin#268 |
It looks like the problem is that the script thats embedded in the jar via spring boot is not executable in windows. I dont think there is any issue with the gradle protobuf plugin. The fix is probably going to involved distributing another artifact that is executable on windows. I dont have any way to test it out at the moment. But I think if you point the protobuf gradle plugin to an executable bat script that executes the jar via java it might work in mean time. This will give me a chance to work on the long term solution. I dont have much experience with windows batch scripts but try this if possible
build.gradle
If that works then I can come up with a gradle task to hold you over in the mean time. |
@marcoferrer Thanks, the batch script
I think that leading slash is the issue. |
Whats confusing for me is that the snippet you posted is referencing the old stand alone compiler "kroto-plus-compiler-0.1.3.jar" and not the protoc plugin "protoc-gen-kroto-plus-0.1.3-jvm8.jar" . If your using the kroto-plus gradle plugin for 0.1.3 you can disable it. If possible can you post a snippet of your gradle config? |
Aha, looks like I still had a
The krotoplus config is:
I've used the
so you can see that the first
then the protoc command exits without an error. Note the second |
A workaround seems to be to do this to relativize the config path before passing it to protoc:
Messy, but it seems to work. UPDATE: Use |
If this can hold you over in the mean time I can work on getting better windows support into an upcoming release. |
Yup, it can! I've got workarounds for all issues identified. Looking forward to the next release. |
So I think I have a good solution to this problem but wanted to hold off on releasing it too early. I didnt want to hold up the coroutines update but the next release after that should have something in it to address this. |
@brandmooffin as per our convo, You can use the documentation from here to implement the windows support outlined in this issue. deployment-script-customization |
@brandmooffin We can try doing what the maven protobuf plugin does and wrap the jar using this. |
The other half of this issue is the fact that the protoc |
One correction for anyone finding this from Google, and using these workarounds... this should be:
The reason is that in Gradle |
after applying those changes I still unfortunately get an error: Execution failed for task ':newproto:generateProto'.
And I'm at a lost to understand what shall I do, many thank's for any hint. |
@Abegemot Can you post a snippet of your current build configuration? |
Sure, thank you so much, I really found your work not only very interesting but in my opinion you and the other people trying to bring protobuf to kotlin in a gentle and convenient way ought to be supported by jetbrains to bring up an official answer to such a technical cornerstone such as protobuf .
protobuf{
} } |
Looking at the stacktrace posted earlier, I think the null pointer is coming from this line More specifically I think its the call to println("ConfigPath=${file(System.getProperty("user.dir")).toPath().toAbsolutePath().relativize(krotoConfig.toPath().toAbsolutePath()).toString()}")`? Also could you give this a try? option "ConfigPath=${krotoConfig.absolutePath.replace(rootProject.projectDir.path, "").drop(1)}" |
Thank you that did the job, nevertheless unfortunately when I run the build I only get generated the messages but not the grpc calls, which is weird, and can't start up a server or do anything. |
I managed to hack together a pure gradle solutions to fix the windows problem.
|
Also, it seems a better solution for the ConfigPath problem is to simply strip away the drive ("C:"), then you can use absolute paths. I had a problem with the above solution in multi-project setup, where without absolute paths, it would not be able to find the config, if I assembled from the parent project.
|
That only works if you know everything is on the c:\ drive. |
* build and publish native artifacts #6 * update tests to use native artifact * bugfix for plugin working directory resolution * update build to resolve plugin config relatively * bump project version
I'm using |
With |
Hello. I'm using kroto-generator in an Android project and I think that I still have this issue on Windows. When I build the project I receive:
I think it may be related to my folder structure. I have the following setup:
// build.gradle
protobuf {
protoc {
artifact = Deps.protoc
}
plugins {
grpc {
artifact = Deps.grpcGenerator
}
javalite {
artifact = Deps.javaLiteGenerator
}
kroto {
artifact = Deps.krotoGenerator
}
}
generateProtoTasks {
def krotoConfig = file("krotoconfig.asciipb")
all()*.plugins {
javalite {}
}
ofNonTest()*.plugins {
grpc {
// Options added to --grpc_out
option 'lite'
}
kroto {
outputSubDir = "java"
option "ConfigPath=$krotoConfig"
}
}
}
} I found that if I use @Brainfree's solution for Windows, then it works, but I expected that release Please let me know if there is some more information I can provide. |
@fitzsia2 So originally the kroto+ plugin was not able to execute on windows environments. Version Considering you had issues discovering this means that its not immediately clear to users and should be better documented. Thank you for bringing this to light. kroto {
outputSubDir = "java"
if(osdetector.os == "windows") {
// We want to relativize the configuration path
// because absolute paths cause issues in windows
// environments
option "ConfigPath=${krotoConfig.absolutePath.replace(System.getProperty("user.dir"), "").drop(1)}"
} else {
option "ConfigPath=$krotoConfig"
}
} Line 126 in 2b0b447
|
Hi guys, we just experienced somethings similar using Maven (protobuf-maven-plugin):
We configured config path just like that:
(maven multimodule project) Do we have some workaround for Maven & Windows like we have for Gradle please? |
Ok, I don't use Windows myself (ugh), but some of my coworkers do. There are issues running this on Windows:
Note the leading slash on the
-jar
argument.Looking at the
--debug
logs, it looks like a--plugin
parameter is addd to the call toprotoc
, with the following value:but protoc is assuming the jar file is an executable it can run. I have tried associating ".jar" files with "java" (and this seems to have worked), but for some reason when running via
protoc
, the same "not a valid Win32 application" error still happens.The text was updated successfully, but these errors were encountered: