Skip to content

Add @SkipWhenEmpty and @IgnoreEmptyDirectories for better incremental…#1670

Merged
Frisch12 merged 3 commits intomainfrom
refactor/add-skip-when-empty-annotations
Apr 3, 2026
Merged

Add @SkipWhenEmpty and @IgnoreEmptyDirectories for better incremental…#1670
Frisch12 merged 3 commits intomainfrom
refactor/add-skip-when-empty-annotations

Conversation

@Frisch12
Copy link
Copy Markdown
Member

… builds.

Improve incremental build performance by adding skip annotations to tasks that should skip execution when inputs are empty:

  • PlantumlTask: Override getSource() with @SkipWhenEmpty to skip when no PlantUML source files exist
  • GenerateCodeTask: Add @SkipWhenEmpty and @IgnoreEmptyDirectories to inputDir
  • DescriptorGeneratorTask: Add @SkipWhenEmpty to source and classes directories
  • MkDocsBuild/MkDocsServe: Add @IgnoreEmptyDirectories to themeDir, add @PathSensitive for MkDocsServe consistency

These annotations allow Gradle to skip task execution when inputs are empty, improving build performance and enabling better build cache usage.

… builds.

Improve incremental build performance by adding skip annotations to tasks
that should skip execution when inputs are empty:

- PlantumlTask: Override getSource() with @SkipWhenEmpty to skip when no
  PlantUML source files exist
- GenerateCodeTask: Add @SkipWhenEmpty and @IgnoreEmptyDirectories to inputDir
- DescriptorGeneratorTask: Add @SkipWhenEmpty to source and classes directories
- MkDocsBuild/MkDocsServe: Add @IgnoreEmptyDirectories to themeDir, add
  @PathSensitive for MkDocsServe consistency

These annotations allow Gradle to skip task execution when inputs are empty,
improving build performance and enabling better build cache usage.
@Frisch12 Frisch12 requested a review from larsgrefer February 12, 2026 18:15
Keep both the @SkipWhenEmpty/@IgnoreEmptyDirectories annotations from
this PR and the @PathSensitive/@classpath annotations added on main.
Both serve different purposes and are complementary.
@Frisch12
Copy link
Copy Markdown
Member Author

Automated maintenance: Resolved merge conflicts with main branch.

Conflicts were in:

  • GenerateCodeTask.java — kept both @SkipWhenEmpty/@IgnoreEmptyDirectories (from this PR) and @PathSensitive(PathSensitivity.RELATIVE) (from main)
  • DescriptorGeneratorTask.java — kept both @SkipWhenEmpty (from this PR) and @PathSensitive/@Classpath (from main)

Both sets of annotations serve complementary purposes and are non-conflicting. CI should re-run automatically. This PR is ready for manual review.

- MkDocsServe: resolve conflict by keeping both @IgnoreEmptyDirectories
  and @PathSensitive annotations
- DescriptorGeneratorTask: remove @SkipWhenEmpty from getClassesDirectories()
  to prevent incorrect task skipping when only one input is empty
- PlantumlTask: add @IgnoreEmptyDirectories to getSource() for consistent
  cache key behavior on this @CacheableTask
@Frisch12
Copy link
Copy Markdown
Member Author

Frisch12 commented Apr 3, 2026

Automated maintenance summary:

  1. Merge conflicts resolved: MkDocsServe.java — kept both @IgnoreEmptyDirectories (from this PR) and @PathSensitive(PathSensitivity.RELATIVE) (from main). Both annotations serve complementary purposes.

  2. Code fixes applied:

    • DescriptorGeneratorTask: Removed @SkipWhenEmpty from getClassesDirectories(). Having @SkipWhenEmpty on both getSourceDirectories() and getClassesDirectories() would cause incorrect task skipping when only one input is empty. Kept it only on getSourceDirectories() as the primary driver.
    • PlantumlTask: Added @IgnoreEmptyDirectories to getSource() for consistent cache key behavior, matching how other @CacheableTask classes handle @SkipWhenEmpty inputs.
  3. CI status: Pipelines triggered and running. Waiting for results.

@Frisch12 Frisch12 merged commit e8a2592 into main Apr 3, 2026
13 checks passed
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