This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git
commit c456ae7540f83946417bd3d80d47faec10b91c81 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Wed Nov 25 21:56:33 2026 +0000 Format Groovy IT scripts Formatting only: the CONVERSION-phase AST of every file is unchanged. See https://github.com/apache/maven-invoker-plugin/issues/811. --- src/it/MSOURCES-121/verify.groovy | 2 +- src/it/MSOURCES-140/verify.groovy | 2 +- src/it/MSOURCES-62/verify.groovy | 14 ++-- src/it/MSOURCES-95/verify.groovy | 2 +- src/it/jar-attached/verify.groovy | 8 +-- src/it/jar-classifier/verify.groovy | 34 ++++----- src/it/jar-includes-excludes/verify.groovy | 65 ++++++----------- src/it/jar-no-fork/verify.groovy | 33 ++++----- src/it/jar-with-archive-config/verify.groovy | 39 ++++------ src/it/jar-without-descriptor-config/verify.groovy | 33 ++++----- src/it/jar/verify.groovy | 34 ++++----- src/it/manifest-content/verify.groovy | 8 +-- src/it/project-without-sources/verify.groovy | 8 +-- src/it/reproducible/verify.groovy | 83 ++++++++++------------ src/it/test-jar-classifier/verify.groovy | 34 ++++----- src/it/test-jar-generated/verify.groovy | 29 ++++---- src/it/test-jar-no-fork/verify.groovy | 33 ++++----- src/it/test-jar/verify.groovy | 34 ++++----- .../verify.groovy | 2 +- .../verify.groovy | 2 +- src/it/verify-parameter-goal-jar/verify.groovy | 2 +- .../verify.groovy | 2 +- .../verify-parameter-goal-test-jar/verify.groovy | 2 +- 23 files changed, 200 insertions(+), 305 deletions(-) diff --git a/src/it/MSOURCES-121/verify.groovy b/src/it/MSOURCES-121/verify.groovy index e58ef75..c783834 100644 --- a/src/it/MSOURCES-121/verify.groovy +++ b/src/it/MSOURCES-121/verify.groovy @@ -17,6 +17,6 @@ * under the License. */ -File buildLog = new File( basedir, 'build.log' ) +File buildLog = new File(basedir, 'build.log') assert buildLog.text =~ /\[ERROR\] Artifact org.apache.maven.its.sources:jar-no-fork:java-source:sources:1.0-SNAPSHOT already attached to a file target.jar-no-fork-1.0-SNAPSHOT-sources.jar: attach to target.jar-no-fork-1.0-SNAPSHOT-secondary-sources.jar should be done with another classifier/ diff --git a/src/it/MSOURCES-140/verify.groovy b/src/it/MSOURCES-140/verify.groovy index 8cc6491..422cc02 100644 --- a/src/it/MSOURCES-140/verify.groovy +++ b/src/it/MSOURCES-140/verify.groovy @@ -17,6 +17,6 @@ * under the License. */ -File buildLog = new File( basedir, 'build.log' ) +File buildLog = new File(basedir, 'build.log') assert buildLog.text =~ /\[INFO\] Artifact org.apache.maven.its.sources:jar-no-fork:java-source:sources:1.0-SNAPSHOT already attached to target.jar-no-fork-1.0-SNAPSHOT-sources.jar: ignoring same re-attach \(same artifact, same file\)/ diff --git a/src/it/MSOURCES-62/verify.groovy b/src/it/MSOURCES-62/verify.groovy index cc7480f..4b8a174 100644 --- a/src/it/MSOURCES-62/verify.groovy +++ b/src/it/MSOURCES-62/verify.groovy @@ -18,18 +18,18 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File target = new File( basedir, "target" ); +File target = new File(basedir, "target") assert target.exists() && target.isDirectory() : "target file is missing or not a directory." -File artifact = new File( target, "MSOURCES-62-1.0-SNAPSHOT-sources.jar" ); +File artifact = new File( target, "MSOURCES-62-1.0-SNAPSHOT-sources.jar" ) assert artifact.exists() && !artifact.isDirectory() : "artifact file is missing or a directory." -JarFile jar = new JarFile( artifact ); +JarFile jar = new JarFile( artifact ) -Attributes manifest = jar.getManifest().getMainAttributes(); +Attributes manifest = jar.getManifest().getMainAttributes() -String val = manifest.getValue( new Attributes.Name( "An-Entry" ) ); -System.out.println("An-Entry:'"+val+"'"); +String val = manifest.getValue( new Attributes.Name( "An-Entry" ) ) +System.out.println("An-Entry:'"+val+"'") assert "Some Value".equals( val ) diff --git a/src/it/MSOURCES-95/verify.groovy b/src/it/MSOURCES-95/verify.groovy index bf8d6e9..753df64 100644 --- a/src/it/MSOURCES-95/verify.groovy +++ b/src/it/MSOURCES-95/verify.groovy @@ -17,7 +17,7 @@ * under the License. */ -File buildLog = new File( basedir, 'build.log' ) +File buildLog = new File(basedir, 'build.log') String sourcesJarFileName = 'empty-source-directory-1.0-SNAPSHOT-sources.jar' String testSourcesJarFileName = "empty-source-directory-1.0-SNAPSHOT-test-sources.jar" diff --git a/src/it/jar-attached/verify.groovy b/src/it/jar-attached/verify.groovy index 5cfbe22..f277290 100644 --- a/src/it/jar-attached/verify.groovy +++ b/src/it/jar-attached/verify.groovy @@ -17,10 +17,10 @@ * under the License. */ -File jarFile = new File( basedir, "target/jar-attached-1.0-SNAPSHOT-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/jar-attached-1.0-SNAPSHOT-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -File attachedFile = new File( localRepositoryPath, "org/apache/maven/its/ejb/jar-attached/1.0-SNAPSHOT/jar-attached-1.0-SNAPSHOT-sources.jar" ); -System.out.println( "Checking for existence of " + attachedFile ); +File attachedFile = new File(localRepositoryPath, "org/apache/maven/its/ejb/jar-attached/1.0-SNAPSHOT/jar-attached-1.0-SNAPSHOT-sources.jar") +System.out.println("Checking for existence of " + attachedFile) assert attachedFile.isFile() diff --git a/src/it/jar-classifier/verify.groovy b/src/it/jar-classifier/verify.groovy index dce1f7a..cafb5b0 100644 --- a/src/it/jar-classifier/verify.groovy +++ b/src/it/jar-classifier/verify.groovy @@ -17,32 +17,22 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/jar-classifier-1.0-SNAPSHOT-foo.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/jar-classifier-1.0-SNAPSHOT-foo.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) -String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", - "generated.properties", -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +String[] includedEntries = ["META-INF/MANIFEST.MF", "MyClass.java", "main.properties", "generated.properties",] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyTest.java", - "test.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyTest.java", "test.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } diff --git a/src/it/jar-includes-excludes/verify.groovy b/src/it/jar-includes-excludes/verify.groovy index 82c43da..6d6ed20 100644 --- a/src/it/jar-includes-excludes/verify.groovy +++ b/src/it/jar-includes-excludes/verify.groovy @@ -17,60 +17,41 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/jar-includes-excludes-1.0-SNAPSHOT-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/jar-includes-excludes-1.0-SNAPSHOT-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) -String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass2.java" -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +String[] includedEntries = ["META-INF/MANIFEST.MF", "MyClass2.java"] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyTest.java", - "test.properties", - "MyClass.java", - "main.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyTest.java", "test.properties", "MyClass.java", "main.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } -jarFile = new File( basedir, "target/jar-includes-excludes-1.0-SNAPSHOT-test-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +jarFile = new File(basedir, "target/jar-includes-excludes-1.0-SNAPSHOT-test-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -jar = new JarFile( jarFile ); +jar = new JarFile(jarFile) -includedEntries = [ - "META-INF/MANIFEST.MF", - "MyTest.java", - "test.properties", -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +includedEntries = ["META-INF/MANIFEST.MF", "MyTest.java", "test.properties",] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -excludedEntries = [ - "MyTest2.java", - "MyClass.java" -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +excludedEntries = ["MyTest2.java", "MyClass.java"] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } diff --git a/src/it/jar-no-fork/verify.groovy b/src/it/jar-no-fork/verify.groovy index d804886..8aa6a7f 100644 --- a/src/it/jar-no-fork/verify.groovy +++ b/src/it/jar-no-fork/verify.groovy @@ -17,31 +17,22 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/jar-no-fork-1.0-SNAPSHOT-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/jar-no-fork-1.0-SNAPSHOT-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) -String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +String[] includedEntries = ["META-INF/MANIFEST.MF", "MyClass.java", "main.properties",] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyTest.java", - "test.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyTest.java", "test.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } diff --git a/src/it/jar-with-archive-config/verify.groovy b/src/it/jar-with-archive-config/verify.groovy index ad090f3..9e85fb1 100644 --- a/src/it/jar-with-archive-config/verify.groovy +++ b/src/it/jar-with-archive-config/verify.groovy @@ -17,36 +17,27 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/jar-with-archive-config-1.0-SNAPSHOT-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/jar-with-archive-config-1.0-SNAPSHOT-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) -String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +String[] includedEntries = ["META-INF/MANIFEST.MF", "MyClass.java", "main.properties",] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyTest.java", - "test.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyTest.java", "test.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } -System.out.println( "Checking manifest for attribute: Implementation-Version " ); -Map manifestAttributes = jar.getManifest().getMainAttributes(); -String implVersion = manifestAttributes.getValue( "Implementation-Version" ); +System.out.println("Checking manifest for attribute: Implementation-Version ") +Map manifestAttributes = jar.getManifest().getMainAttributes() +String implVersion = manifestAttributes.getValue("Implementation-Version") assert implVersion != null diff --git a/src/it/jar-without-descriptor-config/verify.groovy b/src/it/jar-without-descriptor-config/verify.groovy index 77035bb..218b7b4 100644 --- a/src/it/jar-without-descriptor-config/verify.groovy +++ b/src/it/jar-without-descriptor-config/verify.groovy @@ -17,31 +17,22 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/jar-without-descriptor-config-1.0-SNAPSHOT-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/jar-without-descriptor-config-1.0-SNAPSHOT-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) -String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +String[] includedEntries = ["META-INF/MANIFEST.MF", "MyClass.java", "main.properties",] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyTest.java", - "test.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyTest.java", "test.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } diff --git a/src/it/jar/verify.groovy b/src/it/jar/verify.groovy index 4793936..8273f28 100644 --- a/src/it/jar/verify.groovy +++ b/src/it/jar/verify.groovy @@ -17,32 +17,22 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/jar-1.0-SNAPSHOT-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/jar-1.0-SNAPSHOT-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) -String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyClass.java", - "main.properties", - "generated.properties", -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +String[] includedEntries = ["META-INF/MANIFEST.MF", "MyClass.java", "main.properties", "generated.properties",] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyTest.java", - "test.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyTest.java", "test.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } diff --git a/src/it/manifest-content/verify.groovy b/src/it/manifest-content/verify.groovy index 9614c9f..8aa6bfc 100644 --- a/src/it/manifest-content/verify.groovy +++ b/src/it/manifest-content/verify.groovy @@ -18,14 +18,14 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File target = new File( basedir, "target" ); +File target = new File(basedir, "target") assert target.exists() && target.isDirectory() : "target file is missing or not a directory." -File artifact = new File( target, "manifest-content-1.0-SNAPSHOT-sources.jar" ); +File artifact = new File( target, "manifest-content-1.0-SNAPSHOT-sources.jar" ) assert artifact.exists() && !artifact.isDirectory() : "artifact file is missing or a directory." -JarFile jar = new JarFile( artifact ); +JarFile jar = new JarFile( artifact ) return true diff --git a/src/it/project-without-sources/verify.groovy b/src/it/project-without-sources/verify.groovy index ab6a060..f3ce3b7 100755 --- a/src/it/project-without-sources/verify.groovy +++ b/src/it/project-without-sources/verify.groovy @@ -17,10 +17,10 @@ * under the License. */ -File jarFile = new File( basedir, "target/project-without-sources-1.0-SNAPSHOT-sources.jar" ); -System.out.println( "Checking for non-existence of " + jarFile ); +File jarFile = new File(basedir, "target/project-without-sources-1.0-SNAPSHOT-sources.jar") +System.out.println("Checking for non-existence of " + jarFile) assert !jarFile.isFile() -File testJarFile = new File( basedir, "target/project-without-sources-1.0-SNAPSHOT-test-sources.jar" ); -System.out.println( "Checking for non-existence of " + testJarFile ); +File testJarFile = new File(basedir, "target/project-without-sources-1.0-SNAPSHOT-test-sources.jar") +System.out.println("Checking for non-existence of " + testJarFile) assert !testJarFile.exists() diff --git a/src/it/reproducible/verify.groovy b/src/it/reproducible/verify.groovy index 8c11d18..27e98b3 100644 --- a/src/it/reproducible/verify.groovy +++ b/src/it/reproducible/verify.groovy @@ -18,69 +18,64 @@ * under the License. */ -import java.nio.file.attribute.FileTime; -import java.time.Instant; -import org.apache.commons.compress.archivers.zip.*; +import java.nio.file.attribute.FileTime +import java.time.Instant +import org.apache.commons.compress.archivers.zip.* -File deployDir = new File( basedir, 'target/repo/org/apache/maven/its/reproducible/1.0' ) +File deployDir = new File(basedir, 'target/repo/org/apache/maven/its/reproducible/1.0') assert deployDir.exists() -File sha1File = new File( deployDir, 'reproducible-1.0-sources.jar.sha1' ) +File sha1File = new File(deployDir, 'reproducible-1.0-sources.jar.sha1') assert deployDir.exists() String sha1 = sha1File.text StringBuffer r = new StringBuffer() -r.append( "reproducible-1.0-sources.jar sha1 = $sha1\n\n" ) - -File jarFile = new File( deployDir, 'reproducible-1.0-sources.jar' ) -ZipFile zipFile = new ZipFile( jarFile ); - -r.append( 'encoding: ' + zipFile.getEncoding() + '\n' ) -r.append( 'timezone offset (minutes): ' + new Date().getTimezoneOffset() + '\n' ) -r.append( 'M size (cmp) crc java time date time zip time mode name -comment; extra\n' ) - -String describeExtra( ZipExtraField[] extras ) -{ - StringBuffer b = new StringBuffer() - b.append( extras.length ) - for( ZipExtraField extra : extras ) - { - b.append( sprintf( " [%s]%x", extra.getHeaderId().toString(), getLocalFileDataData() ) ) - } - return b.toString() +r.append("reproducible-1.0-sources.jar sha1 = $sha1\n\n") + +File jarFile = new File(deployDir, 'reproducible-1.0-sources.jar') +ZipFile zipFile = new ZipFile(jarFile) + +r.append('encoding: ' + zipFile.getEncoding() + '\n') +r.append('timezone offset (minutes): ' + new Date().getTimezoneOffset() + '\n') +r.append('M size (cmp) crc java time date time zip time mode name -comment; extra\n') + +String describeExtra(ZipExtraField[] extras) { + StringBuffer b = new StringBuffer() + b.append(extras.length) + for(ZipExtraField extra : extras) { + b.append(sprintf(" [%s]%x", extra.getHeaderId().toString(), getLocalFileDataData())) + } + return b.toString() } -long javaToDosTime( Date d ) -{ - int year = d.getYear() + 1900; - if ( year < 1980 ) - { - return ZipEntry.DOSTIME_BEFORE_1980; +long javaToDosTime(Date d) { + int year = d.getYear() + 1900 + if (year < 1980) { + return ZipEntry.DOSTIME_BEFORE_1980 } - return ( year - 1980 ) << 25 | ( d.getMonth() + 1 ) << 21 | - d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 | - d.getSeconds() >> 1; + return (year - 1980) << 25 | (d.getMonth() + 1) << 21 | + d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 | + d.getSeconds() >> 1 } // Normalize to UTC -long millis = Instant.parse( "2019-08-21T18:28:52Z" ).toEpochMilli(); -Calendar cal = Calendar.getInstance(); -cal.setTimeInMillis( millis ); -millis = millis - ( cal.get( Calendar.ZONE_OFFSET ) + cal.get( Calendar.DST_OFFSET ) ); -FileTime timestamp = FileTime.fromMillis( millis ); - -for ( ZipArchiveEntry zae : zipFile.getEntries() ) -{ - r.append( sprintf( "%d %4d (%3d) %8x %d %<tF %<tT %<tz %d %6o %s %s; %s\n", zae.getMethod(), zae.getSize(), zae.getCompressedSize(), zae.getCrc(), zae.getTime(), javaToDosTime( zae.getLastModifiedDate() ), zae.getUnixMode(), zae.getName(), ( zae.getComment() == null ) ? '-' : zae.getComment(), describeExtra( zae.getExtraFields() ) ) ) - assert timestamp.equals( zae.getLastModifiedTime() ); +long millis = Instant.parse("2019-08-21T18:28:52Z").toEpochMilli() +Calendar cal = Calendar.getInstance() +cal.setTimeInMillis(millis) +millis = millis - (cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)) +FileTime timestamp = FileTime.fromMillis(millis) + +for (ZipArchiveEntry zae : zipFile.getEntries()) { + r.append(sprintf("%d %4d (%3d) %8x %d %<tF %<tT %<tz %d %6o %s %s; %s\n", zae.getMethod(), zae.getSize(), zae.getCompressedSize(), zae.getCrc(), zae.getTime(), javaToDosTime(zae.getLastModifiedDate()), zae.getUnixMode(), zae.getName(), (zae.getComment() == null) ? '-' : zae.getComment(), describeExtra(zae.getExtraFields()))) + assert timestamp.equals(zae.getLastModifiedTime()) } -zipFile.close(); +zipFile.close() String buf = r.toString() println buf // on Windows executable bit is not set -assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519" ) || buf.startsWith( "reproducible-1.0-sources.jar sha1 = e14cb3b37b6d82db1728886d1959ad0cd79708d8" ) +assert buf.startsWith("reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519") || buf.startsWith("reproducible-1.0-sources.jar sha1 = e14cb3b37b6d82db1728886d1959ad0cd79708d8") diff --git a/src/it/test-jar-classifier/verify.groovy b/src/it/test-jar-classifier/verify.groovy index 0b17d1c..0f28a08 100644 --- a/src/it/test-jar-classifier/verify.groovy +++ b/src/it/test-jar-classifier/verify.groovy @@ -17,32 +17,22 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/test-jar-classifier-1.0-SNAPSHOT-bar.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/test-jar-classifier-1.0-SNAPSHOT-bar.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) -String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyTest.java", - "test.properties", - "generated.properties", -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +String[] includedEntries = ["META-INF/MANIFEST.MF", "MyTest.java", "test.properties", "generated.properties",] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyClass.java", - "main.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyClass.java", "main.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } diff --git a/src/it/test-jar-generated/verify.groovy b/src/it/test-jar-generated/verify.groovy index 97c3346..afc7b93 100644 --- a/src/it/test-jar-generated/verify.groovy +++ b/src/it/test-jar-generated/verify.groovy @@ -17,13 +17,13 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/test-jar-generated-1.0-SNAPSHOT-test-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/test-jar-generated-1.0-SNAPSHOT-test-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) String[] includedEntries = [ "META-INF/MANIFEST.MF", @@ -31,19 +31,14 @@ String[] includedEntries = [ "test.properties", "generated.properties", "generate-test-sources.properties" -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyClass.java", - "main.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyClass.java", "main.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } diff --git a/src/it/test-jar-no-fork/verify.groovy b/src/it/test-jar-no-fork/verify.groovy index 5922542..30f77b3 100644 --- a/src/it/test-jar-no-fork/verify.groovy +++ b/src/it/test-jar-no-fork/verify.groovy @@ -17,31 +17,22 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/test-jar-no-fork-1.0-SNAPSHOT-test-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/test-jar-no-fork-1.0-SNAPSHOT-test-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) -String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyTest.java", - "test.properties", -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +String[] includedEntries = ["META-INF/MANIFEST.MF", "MyTest.java", "test.properties",] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyClass.java", - "main.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyClass.java", "main.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } diff --git a/src/it/test-jar/verify.groovy b/src/it/test-jar/verify.groovy index 84f9d47..1f73e81 100644 --- a/src/it/test-jar/verify.groovy +++ b/src/it/test-jar/verify.groovy @@ -17,32 +17,22 @@ * under the License. */ -import java.util.jar.*; +import java.util.jar.* -File jarFile = new File( basedir, "target/test-jar-1.0-SNAPSHOT-test-sources.jar" ); -System.out.println( "Checking for existence of " + jarFile ); +File jarFile = new File(basedir, "target/test-jar-1.0-SNAPSHOT-test-sources.jar") +System.out.println("Checking for existence of " + jarFile) assert jarFile.isFile() -JarFile jar = new JarFile( jarFile ); +JarFile jar = new JarFile(jarFile) -String[] includedEntries = [ - "META-INF/MANIFEST.MF", - "MyTest.java", - "test.properties", - "generated.properties", -]; -for ( String included : includedEntries ) -{ - System.out.println( "Checking for existence of " + included ); - assert jar.getEntry( included ) != null +String[] includedEntries = ["META-INF/MANIFEST.MF", "MyTest.java", "test.properties", "generated.properties",] +for (String included : includedEntries) { + System.out.println("Checking for existence of " + included) + assert jar.getEntry(included) != null } -String[] excludedEntries = [ - "MyClass.java", - "main.properties", -]; -for ( String excluded : excludedEntries ) -{ - System.out.println( "Checking for absence of " + excluded ); - assert jar.getEntry( excluded ) == null +String[] excludedEntries = ["MyClass.java", "main.properties",] +for (String excluded : excludedEntries) { + System.out.println("Checking for absence of " + excluded) + assert jar.getEntry(excluded) == null } diff --git a/src/it/verify-parameter-goal-generated-test-jar/verify.groovy b/src/it/verify-parameter-goal-generated-test-jar/verify.groovy index 8ce92b3..424257b 100644 --- a/src/it/verify-parameter-goal-generated-test-jar/verify.groovy +++ b/src/it/verify-parameter-goal-generated-test-jar/verify.groovy @@ -18,7 +18,7 @@ * under the License. */ -File buildLog = new File( basedir, 'build.log' ) +File buildLog = new File(basedir, 'build.log') assert buildLog.exists() diff --git a/src/it/verify-parameter-goal-jar-no-fork/verify.groovy b/src/it/verify-parameter-goal-jar-no-fork/verify.groovy index 7294aa6..a44f5a5 100644 --- a/src/it/verify-parameter-goal-jar-no-fork/verify.groovy +++ b/src/it/verify-parameter-goal-jar-no-fork/verify.groovy @@ -18,7 +18,7 @@ * under the License. */ -File buildLog = new File( basedir, 'build.log' ) +File buildLog = new File(basedir, 'build.log') assert buildLog.exists() diff --git a/src/it/verify-parameter-goal-jar/verify.groovy b/src/it/verify-parameter-goal-jar/verify.groovy index 1184d4a..166b1d2 100644 --- a/src/it/verify-parameter-goal-jar/verify.groovy +++ b/src/it/verify-parameter-goal-jar/verify.groovy @@ -18,7 +18,7 @@ * under the License. */ -File buildLog = new File( basedir, 'build.log' ) +File buildLog = new File(basedir, 'build.log') assert buildLog.exists() diff --git a/src/it/verify-parameter-goal-test-jar-no-fork/verify.groovy b/src/it/verify-parameter-goal-test-jar-no-fork/verify.groovy index 572b9bc..b490b6e 100644 --- a/src/it/verify-parameter-goal-test-jar-no-fork/verify.groovy +++ b/src/it/verify-parameter-goal-test-jar-no-fork/verify.groovy @@ -18,7 +18,7 @@ * under the License. */ -File buildLog = new File( basedir, 'build.log' ) +File buildLog = new File(basedir, 'build.log') assert buildLog.exists() diff --git a/src/it/verify-parameter-goal-test-jar/verify.groovy b/src/it/verify-parameter-goal-test-jar/verify.groovy index 8ce92b3..424257b 100644 --- a/src/it/verify-parameter-goal-test-jar/verify.groovy +++ b/src/it/verify-parameter-goal-test-jar/verify.groovy @@ -18,7 +18,7 @@ * under the License. */ -File buildLog = new File( basedir, 'build.log' ) +File buildLog = new File(basedir, 'build.log') assert buildLog.exists()
