Skip to content

Conversation

@ascheman
Copy link
Contributor

@ascheman ascheman commented Jan 7, 2026

Summary

  • Replace boolean flags (hasMain, hasTest, hasMainResources, etc.) with flexible set-based tracking using SourceHandlingContext
  • Rename ResourceHandlingContext to SourceHandlingContext to reflect unified handling of all source types
  • Add duplicate detection: first enabled source wins, duplicates trigger WARNING
  • Add hasSources(Language, ProjectScope) method for checking source existence
  • Replace Collectors.toList() with .toList() (Java 17+ idiom)

Closes #11612 (Phase 2: build-sources-validation)

Test plan

  • ProjectBuilderTest passes (19 tests)
  • New tests added:
    • testModularSourcesInjectResourceRoots - verifies module-aware resource injection
    • testModularSourcesWithExplicitResourcesIssuesWarning - verifies legacy resource warnings
    • testMixedSourcesModularMainClassicTest - mixed modular/classic configuration
    • testSourcesMixedModulesWithinSources - mixed modules within <sources>
    • testMultipleDirectoriesSameModule - multiple directories per module
    • testDuplicateEnabledSources - duplicate detection with WARNING

🤖 Generated with Claude Code

@ascheman ascheman force-pushed the feature/11612-source-handling-context branch from 159d2ae to 63d43d5 Compare January 13, 2026 21:14
ascheman and others added 4 commits February 1, 2026 14:48
Replace boolean flags (hasMain, hasTest, etc.) with flexible
set-based tracking for all language/scope combinations.
- Rename ResourceHandlingContext to SourceHandlingContext
- Add duplicate detection with WARNING for enabled sources
- Add hasSources() method for checking language/scope combinations
- Rename 'src' variable to 'sourceRoot' for clarity

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use Java 17+ Stream.toList() instead of Collectors.toList().

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Normalize path separators to forward slashes before comparing
directory paths in tests. On Windows, Path.toString() returns
backslashes, causing contains() checks with forward slashes to fail.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement validation rules for modular source handling (apache#11612):

- AC6: ERROR when mixing modular (with module) and classic (without
  module) sources within <sources>
- AC7: WARNING when legacy <sourceDirectory>/<testSourceDirectory>
  are used in modular projects (both explicit config and filesystem
  existence)

Changes:
- Add validateNoMixedModularAndClassicSources() to SourceHandlingContext
- Add warnIfExplicitLegacyDirectory() to DefaultProjectBuilder
- Update tests to verify AC6 and AC7 behavior
- Update test project comments to reflect correct behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ascheman ascheman force-pushed the feature/11612-source-handling-context branch from 63d43d5 to 19fd98d Compare February 1, 2026 13:56
- Use flatMap(Optional::stream) instead of filter/map
- Use File.separatorChar instead of hardcoded backslash
- Simplify module checks with orElse(null)
- Make getProfileIds() static

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@desruisseaux desruisseaux self-requested a review February 1, 2026 16:35
@desruisseaux
Copy link
Contributor

@gnodet or others, any objection in merging this commit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unified source handling for all lang/scope combinations with modular sources (Phase 2)

3 participants