From 1eefd433b6be85f00d14ebd289dcd16dcaf7fb9d Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Fri, 19 May 2023 16:53:32 -0600 Subject: [PATCH] Add spring-security.xsd symlink Closes gh-13131 --- .../spring/gradle/convention/SchemaZipPlugin.groovy | 13 +++++++++++-- .../security/config/spring-security.xsd | 1 + .../security/config/doc/XsdDocumentedTests.java | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 120000 config/src/main/resources/org/springframework/security/config/spring-security.xsd diff --git a/buildSrc/src/main/groovy/io/spring/gradle/convention/SchemaZipPlugin.groovy b/buildSrc/src/main/groovy/io/spring/gradle/convention/SchemaZipPlugin.groovy index 72de4b3f73..caafb07ab7 100644 --- a/buildSrc/src/main/groovy/io/spring/gradle/convention/SchemaZipPlugin.groovy +++ b/buildSrc/src/main/groovy/io/spring/gradle/convention/SchemaZipPlugin.groovy @@ -1,9 +1,9 @@ package io.spring.gradle.convention -import org.gradle.api.plugins.JavaPlugin -import org.gradle.api.tasks.bundling.Zip import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.plugins.JavaPlugin +import org.gradle.api.tasks.bundling.Zip public class SchemaZipPlugin implements Plugin { @@ -37,6 +37,15 @@ public class SchemaZipPlugin implements Plugin { from xsdFile.path } } + File symlink = module.sourceSets.main.resources.find { + it.path.endsWith('org/springframework/security/config/spring-security.xsd') + } + if (symlink != null) { + schemaZip.into('security') { + duplicatesStrategy 'exclude' + from symlink.path + } + } } } } diff --git a/config/src/main/resources/org/springframework/security/config/spring-security.xsd b/config/src/main/resources/org/springframework/security/config/spring-security.xsd new file mode 120000 index 0000000000..976a03ccd6 --- /dev/null +++ b/config/src/main/resources/org/springframework/security/config/spring-security.xsd @@ -0,0 +1 @@ +spring-security-5.7.xsd \ No newline at end of file diff --git a/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java b/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java index 6e1e4bbe6f..0f1bb495f9 100644 --- a/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java +++ b/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java @@ -150,8 +150,8 @@ public class XsdDocumentedTests { .getParentFile() .list((dir, name) -> name.endsWith(".xsd")); // @formatter:on - assertThat(schemas.length).isEqualTo(19) - .withFailMessage("the count is equal to 19, if not then schemaDocument needs updating"); + assertThat(schemas.length).isEqualTo(20) + .withFailMessage("the count is equal to 20, if not then schemaDocument needs updating"); } /**