Skip to content

Modernization, Phase 2#290

Merged
OdysseusLives merged 6 commits intomainfrom
modernization
Feb 6, 2026
Merged

Modernization, Phase 2#290
OdysseusLives merged 6 commits intomainfrom
modernization

Conversation

@OdysseusLives
Copy link
Copy Markdown
Member

Migrates lock-plugin tasks from field-based configuration to Gradle’s Property API and removes conventionMapping.

Breaking change

Code that set task properties via public fields must use the Property API:

// Old (no longer supported)
task.diffFile = new File("...")

// New (required)
task.diffFile.set(project.layout.buildDirectory.file("..."))

Summary

Migrated SaveLockTask, GenerateLockTask, UpdateLockTask, DiffLockTask, and migration tasks to the Property API; removed conventionMapping. GenerateLockTask uses outputs.upToDateWhen { false }. CommitLockTask rootDirPathis@Internal`.

Breaking: task properties must be set via .set(...) (e.g. task.diffFile.set(project.layout.buildDirectory.file("..."))), not direct assignment.

- Make SaveLockTask abstract
- Convert generatedLock/outputLock to RegularFileProperty
- Update task configurer to use .set() instead of conventionMapping
- Update property checks to use .isPresent() and .get().asFile
- Make GenerateLockTask and UpdateLockTask abstract
- Convert all fields to Property API (SetProperty, MapProperty, RegularFileProperty, Property)
- Update DependencyLockTaskConfigurer to use .set() and property chaining
- Update unit tests to use Property API
- All unit tests passing, integration tests need investigation
- Update logic to explicitly check for null before calling lockableConfigurations()
- Add outputs.upToDateWhen { false } to GenerateLockTask to force re-execution
  - Dependency declarations in build.gradle aren't tracked as task inputs
  - Task must regenerate when dependencies change
- Make AbstractMigrateToCoreLocksTask abstract with Property getters
  - File outputLock → RegularFileProperty getOutputLock()
  - Set<String> configurationNames → SetProperty<String> getConfigurationNames()
- Make MigrateToCoreLocksTask and MigrateLockedDepsToCoreLocksTask abstract
- Add inputLockFile property to MigrateLockedDepsToCoreLocksTask
  - File inputLockFile → RegularFileProperty getInputLockFile()
  - Keep as @internal since task manually validates file existence
- Update all field access to use .get() and .asFile.get()
- Remove conventionMapping from migration task configuration
- Use project.layout.projectDirectory.file() for file properties
- Make DiffLockTask abstract with Property getters
- Convert file fields to RegularFileProperty and DirectoryProperty
- Update task action to use .asFile.get() for file access
- Conditionally set existingLockFile only when file exists
- Update unit tests to use Property API
Change rootDirPath from @input to @internal since it's a configuration
value (project directory path) used for git commands, not a build input
that affects task outputs
@OdysseusLives OdysseusLives merged commit 77bae44 into main Feb 6, 2026
3 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