Skip to content

Commit

Permalink
Merge pull request #10 from vincentml/windows-gradle
Browse files Browse the repository at this point in the history
Minor changes to allow building on Windows
  • Loading branch information
ndw authored Jun 9, 2020
2 parents 294d4e5 + 706bcee commit c6c0d43
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
sourceSets { }

import com.github.eerohele.SaxonXsltTask
import org.gradle.internal.os.OperatingSystem

repositories {
mavenLocal()
Expand Down Expand Up @@ -107,13 +108,16 @@ task setupXSpec(type: Copy, dependsOn: ['downloadXSpec']) {
setupXSpec.onlyIf {
!file("${buildDir}/xspec-${xspecVersion}/README.md").exists()
}
def xspecCmd = (OperatingSystem.current().isWindows()) ?
"${buildDir}\\xspec-${xspecVersion}\\bin\\xspec.bat" :
"${buildDir}/xspec-${xspecVersion}/bin/xspec.sh"

// ============================================================

// Generate tasks to format each test document
fileTree(dir: "src/test/resources/xslt", include: "*.xsl").each { xsl ->
// Work out the base filename of the test
def base = xsl.toString()
def base = xsl.toString().replace("\\", "/")
def pos = base.indexOf("/resources/xslt/")
if (pos > 0) {
base = base.substring(pos+16)
Expand Down Expand Up @@ -156,7 +160,7 @@ fileTree(dir: "src/test/resources/xslt", include: "*.xsl").each { xsl ->

// Generate tasks to run each set of XSpec tests
fileTree(dir: "src/test/xspec").each { xspec -> // Work out the base filename of the test
def base = xspec.toString()
def base = xspec.toString().replace("\\", "/")
def pos = base.indexOf("/test/xspec/")
if (pos > 0) {
base = base.substring(pos+12)
Expand All @@ -173,8 +177,7 @@ fileTree(dir: "src/test/xspec").each { xspec -> // Work out the base filename o
include base + "-result.xml"
})
errorOutput = new ByteArrayOutputStream()
commandLine "${buildDir}/xspec-${xspecVersion}/bin/xspec.sh",
xspec.toString()
commandLine xspecCmd, xspec.toString()

ext.output = {
return errorOutput.toString()
Expand All @@ -188,8 +191,7 @@ fileTree(dir: "src/test/xspec").each { xspec -> // Work out the base filename o
outputs.files(fileTree(buildDir) {
include base + "-result.xml"
})
commandLine "${buildDir}/xspec-${xspecVersion}/bin/xspec.sh",
xspec.toString()
commandLine xspecCmd, xspec.toString()
ext.output = {
return ""
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ failOnXSPecErrors=false
# it's available.
saxonEE=true

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

0 comments on commit c6c0d43

Please sign in to comment.