Skip to content

feat: add --incremental flag to skip up-to-date page object generation - #243

Open
intermezzio wants to merge 1 commit into
salesforce:devfrom
intermezzio:ajgm/only-generate-updated-files
Open

feat: add --incremental flag to skip up-to-date page object generation#243
intermezzio wants to merge 1 commit into
salesforce:devfrom
intermezzio:ajgm/only-generate-updated-files

Conversation

@intermezzio

@intermezzio intermezzio commented Jun 11, 2026

Copy link
Copy Markdown

Closes #244

Summary

  • Adds an opt-in --incremental (-I) CLI flag (and matching JsonCompilerConfig constructor parameter) that causes the compiler to skip generation for page objects whose generated .java artifacts are newer than the source .utam.json.
  • New TranslatorTargetConfig.isUpToDate(...) interface method with a default return false, preserving behavior for downstream custom target configs.
  • DefaultTargetConfiguration overrides isUpToDate with a per-page-object timestamp check (interface and impl .java paths must exist and be ≥ source mtime; impl-only POs only require the impl artifact).
  • DefaultTranslatorRunner.write() consults isUpToDate before invoking getGeneratedCode() (which is where google-java-format runs) and skips the interface, class, JSON resource, and unit-test writes for that PO. Aggregate outputs (manifest, dependency-injection config) still cover every PO.

Motivation

When this library is consumed via the compiler plugin in a downstream project, mvn triggers an all-or-nothing rebuild on every invocation, with google-java-format dominating the cost. Incremental mode skips the formatter and file writes for page objects whose targets are already current, which is a large speedup on iterative dev loops.

Behavior

  • Default off; existing CLI/JSON-config callers unchanged.
  • With --incremental: a PO is skipped iff its generated targets exist and have mtime ≥ the source .utam.json mtime. Any missing or older target forces regeneration. Source mtime ≤ 0 also forces regeneration (matters for unit tests with synthetic sources).

Test plan

  • New tests in DefaultTargetConfigurationTests covering isUpToDate for: flag off, source mtime zero, missing interface file, missing class file, source newer than targets, targets newer than source, interface-only PO, impl-only PO.
  • New tests in DefaultTranslatorRunnerTests verifying write() skips all POs when target reports up-to-date and writes only the out-of-date PO when the target is selective.
  • New test in JsonCompilerConfigTests verifying the 4-arg constructor wires the incremental flag through to the resulting TranslatorTargetConfig.
  • mvn -pl utam-compiler test — 644/644 pass.
  • mvn -pl utam-core test — 385/385 pass.
  • mvn spotless:check clean.

@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Unfortunately we can't verify the commit author(s): Andrew Mascillaro <a***@s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, refresh the status of this Pull Request.

@intermezzio
intermezzio force-pushed the ajgm/only-generate-updated-files branch from 4b30990 to 7582172 Compare June 11, 2026 17:11
@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @intermezzio to sign the Salesforce Inc. Contributor License Agreement.

@intermezzio
intermezzio marked this pull request as ready for review June 11, 2026 17:28
Introduces an opt-in --incremental (-I) CLI flag and JsonCompilerConfig
constructor parameter that causes the compiler to skip generation for
page objects whose generated .java artifacts are newer than their source
.utam.json. TranslatorTargetConfig gains a default isUpToDate() method
(returns false to preserve behavior for downstream custom configs);
DefaultTargetConfiguration overrides it with a per-page-object timestamp
check, and DefaultTranslatorRunner.write() consults it before invoking
the (expensive) google-java-format pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support incremental page object generation

1 participant