Skip to content

Add addGeneratedAnnotationDate config option to omit timestamp from @Generated - #43

Merged
Besi97 merged 1 commit into
mainfrom
feat/add-generated-annotation-date
Aug 5, 2026
Merged

Besi97 merged 1 commit into
mainfrom
feat/add-generated-annotation-date

Conversation

@Besi97

@Besi97 Besi97 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a new addGeneratedAnnotationDate configuration option (default: true) that controls whether the date attribute is included in the @Generated annotation on generated classes.

When set to false, the generated annotation omits the date:

// addGeneratedAnnotationDate = true (default, unchanged)
@javax.annotation.Generated(
    value = "io.github.besi97.graphql.codegen.GraphQLCodegen",
    date = "2026-08-05T12:00:00+0000"
)

// addGeneratedAnnotationDate = false
@javax.annotation.Generated(
    value = "io.github.besi97.graphql.codegen.GraphQLCodegen"
)

Motivation

The timestamp in @Generated makes outputs non-reproducible, which reduces build cache effectiveness. This option allows users to opt into reproducible builds while preserving backward compatibility (default behavior unchanged).

…generated

When set to false, the date attribute is omitted from the @generated
annotation in generated code. Default is true (backward compatible).

This enables reproducible builds by removing the non-deterministic
timestamp, which improves build cache effectiveness.

Changes:
- Added addGeneratedAnnotationDate to config chain (MappingConfig,
  GraphQLCodegenConfiguration, MappingContext, etc.)
- Updated GeneratedInformation.getDateTime() to return null when flag is false
- Updated all 20 FreeMarker templates (Java + Kotlin) to conditionally
  render the date line
- Added property to Gradle plugin task
- Added test for the new behavior
- Updated docs/codegen-options.md
@Besi97
Besi97 force-pushed the feat/add-generated-annotation-date branch from 504c0e6 to e371c1a Compare August 5, 2026 19:09
@Besi97
Besi97 merged commit d0e7470 into main Aug 5, 2026
3 checks passed
@Besi97
Besi97 deleted the feat/add-generated-annotation-date branch August 6, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant