Browse Source

Polish "Complete support for project.build.outputTimestamp"

See gh-42922
pull/42986/head
Stéphane Nicoll 1 year ago
parent
commit
1a3f1a41b1
  1. 9
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/BuildInfoIntegrationTests.java
  2. 5
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-info-reproducible-epoch-seconds/pom.xml
  3. 0
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-info-reproducible-epoch-seconds/src/main/java/org/test/SampleApplication.java
  4. 2
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java

9
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/BuildInfoIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,6 +19,7 @@ package org.springframework.boot.maven; @@ -19,6 +19,7 @@ package org.springframework.boot.maven;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.time.Instant;
import java.util.Properties;
import java.util.function.Consumer;
@ -85,12 +86,12 @@ class BuildInfoIntegrationTests { @@ -85,12 +86,12 @@ class BuildInfoIntegrationTests {
@TestTemplate
void generatedBuildInfoReproducibleEpochSeconds(MavenBuild mavenBuild) {
mavenBuild.project("build-info-reproducible-epochseconds")
mavenBuild.project("build-info-reproducible-epoch-seconds")
.execute(buildInfo((buildInfo) -> assertThat(buildInfo).hasBuildGroup("org.springframework.boot.maven.it")
.hasBuildArtifact("build-reproducible-epochseconds")
.hasBuildArtifact("build-reproducible-epoch-seconds")
.hasBuildName("Generate build info with build time from project.build.outputTimestamp")
.hasBuildVersion("0.0.1.BUILD-SNAPSHOT")
.hasBuildTime("1976-01-09T12:00:00Z")));
.hasBuildTime(Instant.ofEpochSecond(1619004153).toString())));
}
@TestTemplate

5
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-info-reproducible-epochseconds/pom.xml → spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-info-reproducible-epoch-seconds/pom.xml

@ -3,15 +3,14 @@ @@ -3,15 +3,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.boot.maven.it</groupId>
<artifactId>build-reproducible-epochseconds</artifactId>
<artifactId>build-reproducible-epoch-seconds</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version>
<name>Generate build info with build time from project.build.outputTimestamp</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>@java.version@</maven.compiler.source>
<maven.compiler.target>@java.version@</maven.compiler.target>
<!-- Epoch seconds should be support bey build-info plugin too -->
<project.build.outputTimestamp>190036800</project.build.outputTimestamp>
<project.build.outputTimestamp>1619004153</project.build.outputTimestamp>
</properties>
<build>
<plugins>

0
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-info-reproducible-epochseconds/src/main/java/org/test/SampleApplication.java → spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/build-info-reproducible-epoch-seconds/src/main/java/org/test/SampleApplication.java

2
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

Loading…
Cancel
Save