Developing on Windows

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Developing on Windows

Danny Hyun
I've been working on setting up a ratpack dev environment on my windows machine and I've been running into a few troubles that others may also experience.

ratpack.gradle says that at least jdk7 is required, but jdk 8 fails to pass the compile phase. Jdk7 works just fine.
You can do set JAVA_HOME painlessly via org.gradle.java.home={ALTERNATE_JAVA_HOME} in a gradle.properties file.

The next problem is that you need to set GRADLE_OPTS="-Dfile.encoding=UTF-8". If this is required wouldn't it be better to just set this in ratpack.gradle? Again you can set this in gradle.properties with the following line:

org.gradle.jvmargs=-Dfile.encoding=UTF-8

If have multiple drives mounted in your file system and your ratpack projects lives on a device other than C:\, LaunchConfigsInternalSpec will fail. In the spec for relative directory configuration, it builds a config file wherever java.io.tmpdir is pointing, C:\{your_path_here}. It then tries to find the relative path to the  ratpack project directory, D:\. This throws an exception because the files have different root directories.

I was able to work around this by adding jvmArgs "-Djava.io.tmpdir=D:/tmp" as the last line of the test {} block in ratpack.gradle. It would be nice if we can get some whitelisted system properties to be sent to the various tasks within the ratpack.gradle project. Maybe we can add jvmArgs System.properties.findAll { it.startsWith('some.prefix.') } or something like that. I want to avoid a wholesale systemProperties System.properties as this will override the UTF-8 encoding and JAVA_HOME settings.

The last issue I had is with testing the ratpack-manual module. Because windows uses \ as a file separator, I had to modify the GradleFixture like this:

def localRepoPath = new File(localRepo).canonicalPath?.replaceAll("\\\\", "/")

If you make all of these modifications, this should at least clear the technical problems in compilation and executing tests.

Can anyone from the team see if it's a good idea to incorporate some of these modifications into the project?
Reply | Threaded
Open this post in threaded view
|

Re: Developing on Windows

Luke Daley
Administrator
We can't set `org.gradle.java.home` as we don't know where JAVA_HOME is on different machines.

We could use `org.gradle.jvmargs` for the UTF-8 encoding (though you're mad if you don't set this for every environment anyway). I'd accept a PR for this.

If you could fix LaunchConfigsInternalSpec (or the underlying main code) to work in your environment that would be great. If it needs discussion on how to fix, please open an issue. We should handle this situation gracefully if possible.

Re localRepoPath, change sounds good. Would be good to have a comment in the code alongside saying why it's necessary.

Thanks!

Reply | Threaded
Open this post in threaded view
|

Re: Developing on Windows

Danny Hyun
Thanks Luke.

The note about JAVA_HOME was more for people who are using JDK8 at the moment, and I'll follow up on the rest.
Reply | Threaded
Open this post in threaded view
|

Re: Developing on Windows

Danny Hyun
Just to update this discussion I have submitted an issue https://github.com/ratpack/ratpack/issues/387