gmazelier / gradle-jasperreports

Provides the capability to compile JasperReports design files.
https://plugins.gradle.org/plugin/com.github.gmazelier.jasperreports
Apache License 2.0
25 stars 20 forks source link

pr-microsoft-support #9

Closed blaketastic2 closed 8 years ago

blaketastic2 commented 8 years ago

ability to save the files in Microsoft operating system.

blaketastic2 commented 8 years ago

I changed the file stuff to use the Java 7 path stuff instead of strings. I had a co-worker on windows complaining that the report generation was failing. Let me know if there is anything else that needs to go with this pull request.

gmazelier commented 8 years ago

Hi! Thanks again for your contribution. Happy to known this is useful.

Seems to me there is a issue with non absolute paths (for example source dir, which is relative by default). The following plugin configuration raises an error:

jasperreports {
    classpath = project.sourceSets.main.output
    compiler =  'net.sf.jasperreports.compilers.JRGroovyCompiler'
    useRelativeOutDir = true
    outDir = file("${project.buildDir}/classes/jasper")
}

With this stack trace:

Caused by: java.lang.IllegalArgumentException: 'other' is different type of Path
    at java_nio_file_Path$relativize.call(Unknown Source)
    at com.github.gmazelier.tasks.JasperReportsCompile.outputFile(JasperReportsCompile.groovy:96)
    at com.github.gmazelier.tasks.JasperReportsCompile$_execute_closure3.doCall(JasperReportsCompile.groovy:41)
    at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)
    at org.gradle.api.internal.changedetection.changes.RebuildIncrementalTaskInputs.doOutOfDate(RebuildIncrementalTaskInputs.java:45)
    at org.gradle.api.internal.changedetection.changes.StatefulIncrementalTaskInputs.outOfDate(StatefulIncrementalTaskInputs.java:46)

If you work with absolute paths, there is no error.

Path srcPath = src.getAbsoluteFile().toPath()
Path srcDirPath = srcDir.getAbsoluteFile().toPath()

Please let me know if this changes do not break anything for you, as I have no access to a Windows environment.

blaketastic2 commented 8 years ago

Thanks for pointing that out. I think I got it all worked out. Let me know if you find any other issues.

gmazelier commented 8 years ago

Great. Maybe logs message can be removed or at least depend on the verbose property (see line 102 in the same file for example). I will then release a new version. Have you planned other short-term improvements?

blaketastic2 commented 8 years ago

I removed the logs for now. No I don't have any other short-term improvements. This should be it for a bit.

gmazelier commented 8 years ago

OK. I merge this pull request as soon as it is updated and and I release a new version. Thanks!

blaketastic2 commented 8 years ago

Can you please merge this fix.

gmazelier commented 8 years ago

Version 0.3.2 is available.