Skip to content

Commit

Permalink
Fix schemaZip Gradle task on MS Windows
Browse files Browse the repository at this point in the history
Prior to this commit, the schemaZip Gradle task failed to find Spring
schema files on MS Windows due to path separators hard coded to forward
slashes that are not compatible with the Windows operating system.

Consequently, a full build failed on Windows since the distZip task was
not able to locate the zipped schema archive that the schemaZip task
failed to create.

This commit fixes this by updating the schemaZip task to search for
schema files using backslashes as well as forward slashes.

Closes gh-23933
  • Loading branch information
y987425112 authored and sbrannen committed Nov 13, 2019
1 parent 64db939 commit 8e65834
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gradle/docs.gradle
Expand Up @@ -149,14 +149,14 @@ task schemaZip(type: Zip) {
def Properties schemas = new Properties();

subproject.sourceSets.main.resources.find {
it.path.endsWith("META-INF/spring.schemas")
(it.path.endsWith("META-INF/spring.schemas") || it.path.endsWith("META-INF\\spring.schemas"))
}?.withInputStream { schemas.load(it) }

for (def key : schemas.keySet()) {
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
assert shortName != key
File xsdFile = subproject.sourceSets.main.resources.find {
it.path.endsWith(schemas.get(key))
(it.path.endsWith(schemas.get(key)) || it.path.endsWith(schemas.get(key).replaceAll('\\/','\\\\')))
}
assert xsdFile != null
into (shortName) {
Expand Down

0 comments on commit 8e65834

Please sign in to comment.