From bcb7b4780eacec71f1c890efec3c7510af4d9b88 Mon Sep 17 00:00:00 2001 From: depryf Date: Sun, 3 Dec 2023 15:41:48 -0500 Subject: [PATCH] Trying to fix the build --- build.gradle | 16 ++++++++++++++++ .../naaccrxml/sas/SasGzipOutputStream.java | 8 ++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 1eafacc..3b1ba17 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,13 @@ import java.time.Duration +/** + * In addition to releasing the library on Maven Central, we also release a SAS library along with some macros. + * Since the release is triggered on GitHub via the creation of a release, the SAS zip distribution has to be + * manually created before and added to the release: + * + * gradlew clean createDistribution + */ + plugins { id 'java-library' id 'checkstyle' @@ -54,6 +62,12 @@ java { withSourcesJar() } +// I have absolutely no idea why I need to do this; it appears the test task depends on the created JAR file; I know it depends +// on the source code, but I can't figure out why it depends on the created archive itself. I found this workaround online... +tasks.named("test") { + dependsOn(tasks.named("jar")) +} + // customize the manifest jar { manifest { @@ -81,6 +95,8 @@ sonarqube { property "sonar.host.url", "https://sonarcloud.io" property 'sonar.exclusions', '**/lab/*' property 'sonar.coverage.exclusions', '**/lab/*' + property 'sonar.exclusions', '**/sas/*' + property 'sonar.coverage.exclusions', '**/sas/*' } } diff --git a/src/main/java/com/imsweb/naaccrxml/sas/SasGzipOutputStream.java b/src/main/java/com/imsweb/naaccrxml/sas/SasGzipOutputStream.java index 42155b6..16b131b 100644 --- a/src/main/java/com/imsweb/naaccrxml/sas/SasGzipOutputStream.java +++ b/src/main/java/com/imsweb/naaccrxml/sas/SasGzipOutputStream.java @@ -17,7 +17,7 @@ public class SasGzipOutputStream extends DeflaterOutputStream { /** * CRC-32 of uncompressed data. */ - protected CRC32 crc = new CRC32(); + protected CRC32 _crc = new CRC32(); /** * GZIP header magic number. @@ -43,7 +43,7 @@ public class SasGzipOutputStream extends DeflaterOutputStream { public SasGzipOutputStream(OutputStream out) throws IOException { super(out, new Deflater(Deflater.BEST_SPEED, true), 65536, false); writeHeader(); - crc.reset(); + _crc.reset(); } /** @@ -57,7 +57,7 @@ public SasGzipOutputStream(OutputStream out) throws IOException { @Override public synchronized void write(byte[] buf, int off, int len) throws IOException { super.write(buf, off, len); - crc.update(buf, off, len); + _crc.update(buf, off, len); } /** @@ -119,7 +119,7 @@ private void writeHeader() throws IOException { * offset. */ private void writeTrailer(byte[] buf, int offset) { - writeInt((int)crc.getValue(), buf, offset); // CRC-32 of uncompr. data + writeInt((int)_crc.getValue(), buf, offset); // CRC-32 of uncompr. data writeInt(def.getTotalIn(), buf, offset + 4); // Number of uncompr. bytes }