From b2468bf9f702353b7347f4b14ba8965ce2bf63bf Mon Sep 17 00:00:00 2001 From: Patrick Koenig Date: Thu, 7 Jan 2021 11:20:55 -0800 Subject: [PATCH 1/3] Preserve DOCTYPE in checkstyle.xml --- .../resources/checkstyle/checkstyle.xml | 7 ------- .../com/palantir/baseline/plugins/BaselineConfig.java | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/gradle-baseline-java-config/resources/checkstyle/checkstyle.xml b/gradle-baseline-java-config/resources/checkstyle/checkstyle.xml index 72b51818f..d45ef5f1a 100644 --- a/gradle-baseline-java-config/resources/checkstyle/checkstyle.xml +++ b/gradle-baseline-java-config/resources/checkstyle/checkstyle.xml @@ -3,13 +3,6 @@ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd"> - - diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineConfig.java b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineConfig.java index a6a66471f..0e62b8579 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineConfig.java +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineConfig.java @@ -126,6 +126,10 @@ public void execute(Task task) { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty( + OutputKeys.DOCTYPE_PUBLIC, document.getDoctype().getPublicId()); + transformer.setOutputProperty( + OutputKeys.DOCTYPE_SYSTEM, document.getDoctype().getSystemId()); DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(new FileWriter(checkstyleXml.toFile())); From 224e891cb1d5775dd3c406ac1220b8517629b7bc Mon Sep 17 00:00:00 2001 From: Patrick Koenig Date: Thu, 7 Jan 2021 19:20:55 +0000 Subject: [PATCH 2/3] Add generated changelog entries --- changelog/@unreleased/pr-1606.v2.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/@unreleased/pr-1606.v2.yml diff --git a/changelog/@unreleased/pr-1606.v2.yml b/changelog/@unreleased/pr-1606.v2.yml new file mode 100644 index 000000000..bc0282637 --- /dev/null +++ b/changelog/@unreleased/pr-1606.v2.yml @@ -0,0 +1,5 @@ +type: fix +fix: + description: Baseline correctly preserves the DOCTYPE when generating checkstyle.xml. + links: + - https://github.com/palantir/gradle-baseline/pull/1606 From 41f85298c88be63dea2029ff791e0e6102a3f024 Mon Sep 17 00:00:00 2001 From: Patrick Koenig Date: Thu, 7 Jan 2021 11:58:32 -0800 Subject: [PATCH 3/3] Revert --- .../resources/checkstyle/checkstyle.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gradle-baseline-java-config/resources/checkstyle/checkstyle.xml b/gradle-baseline-java-config/resources/checkstyle/checkstyle.xml index d45ef5f1a..72b51818f 100644 --- a/gradle-baseline-java-config/resources/checkstyle/checkstyle.xml +++ b/gradle-baseline-java-config/resources/checkstyle/checkstyle.xml @@ -3,6 +3,13 @@ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd"> + +