Skip to content

Conversation

@rpalcolea
Copy link
Member

This commit improves Gradle configuration avoidance and prepares the plugin for configuration cache support by implementing the Provider API throughout the codebase.

Key improvements:

  1. Converted properties to use Provider API:

    • FacetDefinition.parentSourceSet now uses Property<String>
    • TestFacetDefinition.testTaskName now uses Property<String>
    • TestFacetDefinition.includeInCheckLifecycle now uses Property<Boolean>
    • Added @Inject constructors with ObjectFactory parameters
  2. Updated object creation:

    • All FacetDefinition and TestFacetDefinition instances now created via project.objects.newInstance() for proper dependency injection
  3. Add configuration cache tests

rpalcolea and others added 2 commits November 26, 2025 16:33
This commit improves Gradle configuration avoidance and prepares the plugin
for configuration cache support by implementing the Provider API throughout
the codebase.

Key improvements:

1. Fixed eager task configuration:
   - Removed .configure() calls on tasks.named() in NebulaFacetPlugin
   - Changed from tasks.named('build').configure() to tasks.named('build', action)
   - Changed from tasks.named('check').configure() to tasks.named('check', action)
   - These changes eliminate eager task configuration and improve build performance

2. Converted properties to use Provider API:
   - FacetDefinition.parentSourceSet now uses Property<String>
   - TestFacetDefinition.testTaskName now uses Property<String>
   - TestFacetDefinition.includeInCheckLifecycle now uses Property<Boolean>
   - Added @Inject constructors with ObjectFactory parameters
   - Provides better configuration cache compatibility

3. Updated object creation:
   - All FacetDefinition and TestFacetDefinition instances now created via
     project.objects.newInstance() for proper dependency injection
   - Ensures Provider properties are correctly initialized

Benefits:
- Improved build performance through better configuration avoidance
- Reduced configuration time by avoiding eager task realization
- Better preparation for configuration cache support
- More idiomatic Gradle 7+ patterns

All existing tests pass without modification, ensuring backward compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Added comprehensive test suite to verify configuration cache compatibility
for all plugins with JUnit 5:

Tests added:
- NebulaFacetPlugin with non-test facets
- NebulaFacetPlugin with custom test facets
- NebulaIntegTestPlugin
- NebulaIntegTestStandalonePlugin
- Multiple facets support
- Test facet lifecycle configuration (included/excluded from check)

All tests verify that:
1. Configuration cache is properly stored on first build
2. Configuration cache is reused on subsequent builds
3. Tasks execute correctly with cached configuration

The test suite uses JUnit 5 (Jupiter) with a custom writeJUnit5Test helper
to generate appropriate test files. All 67 tests pass including the new
configuration cache tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Added 20 new configuration cache tests across 4 test classes that can
run in parallel for better test performance:

**ConfigurationCacheAdvancedSpec** (5 tests):
- Nested facet inheritance (smokeTest extends functionalTest extends test)
- Multiple test facets with mixed check lifecycle inclusion
- Facets with external dependencies (Mockito)
- Parallel execution of multiple facets
- Custom source directories

**ConfigurationCacheMultiProjectSpec** (3 tests):
- Facets in multi-project builds
- Cross-project facet dependencies
- Parallel multi-project builds with facets

**ConfigurationCacheInvalidationSpec** (6 tests):
- Cache invalidation when includeInCheckLifecycle changes
- Cache invalidation when new facet is added
- Cache invalidation when dependencies change
- Cache invalidation when testTaskName changes
- Cache invalidation when parentSourceSet changes
- Cache reuse when only source code changes (not configuration)

**ConfigurationCacheResponsiblePluginSpec** (6 tests):
- NebulaResponsiblePlugin basic functionality
- Combined with integTest plugin
- With custom facets
- With dependency lock disabled
- Publishing with configuration cache
- Javadoc configuration

All tests use JUnit 5 exclusively and verify that:
1. Configuration cache is stored on first build
2. Configuration cache is reused on subsequent builds
3. Cache is invalidated when configuration changes
4. Cache is reused when only source code changes

Test Results: 87/87 tests passing (67 original + 20 new)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@rpalcolea rpalcolea force-pushed the improve-provider-api-configuration-avoidance branch from 62fd2eb to 9ae7856 Compare November 27, 2025 15:25
@rpalcolea rpalcolea merged commit 5e2a8c4 into main Dec 1, 2025
10 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.

3 participants