Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip Java 9-14 in reproducible test #155

Merged
merged 1 commit into from Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/it/projects/reproducible/invoker.properties
Expand Up @@ -14,4 +14,12 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# javadoc has some annoying bugs that make the output unreproducible:
# See: https://issues.apache.org/jira/browse/MJAVADOC-681
# https://bugs.openjdk.org/browse/JDK-8268771
# https://bugs.openjdk.org/browse/JDK-8237909

# To create "reproducible" javadoc you need to use Java 8 or Java 15+
invoker.java.version = 1.8, 15+
invoker.goals = compile javadoc:jar
5 changes: 2 additions & 3 deletions src/it/projects/reproducible/pom.xml
Expand Up @@ -26,6 +26,8 @@
<artifactId>bar</artifactId>
<version>0.1.0-SNAPSHOT</version>

<inceptionYear>2010</inceptionYear>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>@maven.compiler.source@</maven.compiler.source>
Expand All @@ -39,9 +41,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<notimestamp>true</notimestamp>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
14 changes: 5 additions & 9 deletions src/it/projects/reproducible/verify.groovy
Expand Up @@ -29,7 +29,7 @@ assert apidocs.isDirectory()

def options = new File( apidocs, 'options' )
assert options.isFile()
assert options.text.contains( "'Copyright &#169; 2020. All rights reserved.'" )
assert options.text.contains( "'Copyright &#169; 2010&#x2013;2020. All rights reserved.'" )

def artifact = new File( target, 'bar-0.1.0-SNAPSHOT-javadoc.jar' )
assert artifact.isFile()
Expand All @@ -39,7 +39,8 @@ apidocs.eachFileRecurse
{
if ( it.name.endsWith( '.html' ) )
{
assert it.text =~ /<!-- Generated by javadoc (\(\d+\) )?-->/
def line = it.text.readLines().find { it.startsWith( "<!-- Generated by javadoc" ) }
assert line ==~ /<!-- Generated by javadoc (\(\d+\) )?-->/
}
}

Expand All @@ -53,13 +54,8 @@ long normalizeUTC( String timestamp )
}

JarFile jar = new JarFile( artifact )
assert jar.stream().count() > 0

// All entries should have the same timestamp
FileTime expectedTimestamp = FileTime.fromMillis( normalizeUTC( "2020-02-29T23:59:58Z" ) )
def testTimestamp =
{
JarEntry entry -> assert expectedTimestamp.equals( entry.getLastModifiedTime() )
}

jar.stream().forEach( testTimestamp )
jar.close()
jar.stream().forEach { assert expectedTimestamp.equals( it.getLastModifiedTime() ) }
Expand Up @@ -1286,14 +1286,16 @@ public abstract class AbstractJavadocMojo

/**
* Suppresses the timestamp, which is hidden in an HTML comment in the generated HTML near the top of each page.
* <br/>
* <br><br>
* <strong>Note:</strong> If the project has the property <code>project.build.outputTimestamp</code>, the value
* will be overwritten to true. This way it is possible to generate reproducible javadoc jars.
* <br><br>
* See
* <a href="https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#notimestamp">notimestamp</a>.
* <br/>
* <br>
* Since
* <a href="https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/whatsnew-1.5.0.html#commandlineoptions">
* Java 5.0</a>.
* <br/>
*
* @since 2.1
*/
Expand Down Expand Up @@ -5654,7 +5656,7 @@ private void addStandardDocletOptions( File javadocOutputDirectory,

addArgIf( arguments, nosince, "-nosince" );

if ( MavenArchiver.parseBuildOutputTimestamp( outputTimestamp ).isPresent() )
if ( !notimestamp && MavenArchiver.parseBuildOutputTimestamp( outputTimestamp ).isPresent() )
{
// Override the notimestamp option if a Reproducible Build is requested.
notimestamp = true;
Expand Down