Skip to content

Allow initial git.build.time from project.build.outputTimestamp to support reproducible builds #509

@kylixs

Description

@kylixs

Describe your idea

following Maven's guide https://maven.apache.org/guides/mini/guide-reproducible-builds.html
After add a project.build.outputTimestamp property to the project's pom.xml with the timestamp value, the output should be reproducible.

But there is no way to use project.build.outputTimestamp as the initial value of git.build.time,
it is always initialized to the current time of the system:

  // git-commit-id-plugin-core : pl.project13.core.cibuild.BuildServerDataProvider
  private void loadBuildVersionAndTimeData(@Nonnull Properties properties) {
    Supplier<String> buildTimeSupplier = () -> {
      Date buildDate = new Date();
      SimpleDateFormat smf = new SimpleDateFormat(dateFormat);
      if (dateFormatTimeZone != null) {
        smf.setTimeZone(TimeZone.getTimeZone(dateFormatTimeZone));
      }
      return smf.format(buildDate);
    };
    maybePut(properties, GitCommitPropertyConstant.BUILD_TIME, buildTimeSupplier);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions