Skip to content

feat: implement comprehensive solution modernization (CPM, KRaft, formatting) - #3

Merged
ffernandolima merged 5 commits into
mainfrom
CPM
Jun 25, 2025
Merged

feat: implement comprehensive solution modernization (CPM, KRaft, formatting)#3
ffernandolima merged 5 commits into
mainfrom
CPM

Conversation

@ffernandolima

@ffernandolima ffernandolima commented Jun 24, 2025

Copy link
Copy Markdown
Owner

🎯 Overview

This PR implements Central Package Management (CPM) across the entire Confluent.Kafka.Core solution, centralizing all NuGet package version management into a single Directory.Packages.props file with explicit package source configuration. Additionally, it standardizes code formatting and modernizes the development infrastructure.

📋 What Changed

  • Added Directory.Packages.props with centralized package version definitions
  • Added NuGet.Config for explicit package source management and security
  • Removed Version attributes from all PackageReference elements across 13 projects
  • Organized packages into logical, alphabetically-sorted sections for better maintainability
  • Enabled ManagePackageVersionsCentrally property for solution-wide consistency
  • Standardized indentation to 4 spaces across all project files (converted from tabs)
  • Fixed encoding issues and removed BOM signatures for clean UTF-8
  • Migrated Docker Compose from Zookeeper to modern KRaft mode
  • Resolved integration test failures with Kafka and Schema Registry infrastructure

🏗️ Package Organization

Packages are now organized in alphabetically-sorted sections:

  • Caching and Storage Packages - Redis and storage dependencies
  • Confluent Packages - Kafka and Schema Registry packages
  • Microsoft Extensions Packages - Configuration, hosting, and logging abstractions
  • Observability Packages - OpenTelemetry and monitoring tools
  • Resilience and Retry Packages - Polly and resilience patterns
  • Serialization Packages - JSON, Protobuf, and serialization libraries
  • Testing Packages - Test frameworks, utilities, and reporting tools

🔒 Package Source Configuration

  • NuGet.Config - Explicit package source mapping for enhanced security
  • Source Mapping - Formal package resolution configuration
  • Security Enhancement - Improved package supply chain security
  • Environment Consistency - Consistent package resolution across development environments

🎨 Code Formatting Standardization

  • Indentation: Converted all 13 project files from tabs to 4 spaces
  • Encoding: Standardized to UTF-8 without BOM signatures
  • Consistency: Uniform formatting across entire solution
  • Cross-Platform: Better compatibility with different editors and tools

🐳 Infrastructure Modernization

  • KRaft Mode: Migrated Kafka from Zookeeper-based to modern KRaft architecture
  • Simplified Setup: Reduced from 5 to 4 Docker services (removed Zookeeper)
  • Faster Startup: Eliminated Zookeeper bootstrap delays
  • Test Reliability: Fixed integration test failures with Kafka controller timeouts
  • Future-Proof: Aligned with Kafka's strategic direction

🚀 Benefits

  • 📦 Single Source of Truth - All package versions managed from one location
  • 🔄 Easier Updates - Update package versions once, applies everywhere
  • 🛡️ Version Consistency - Eliminates version conflicts across projects
  • 📚 Better Organization - Logical grouping makes dependencies easy to find
  • 🧹 Cleaner Project Files - Reduced noise in individual .csproj files
  • 🔒 Enhanced Security - Explicit package source mapping prevents supply chain attacks
  • Future-Proof - Follows NuGet 6.2+ best practices
  • 🎯 Prevents Warnings - Avoids NU1507 warnings in multi-source scenarios
  • 🎨 Professional Formatting - Consistent 4-space indentation and UTF-8 encoding
  • 🚀 Modern Infrastructure - KRaft mode for improved performance and reliability

🔧 Technical Details

  • NuGet Version: Requires NuGet 6.2+ (Visual Studio 2022 17.2+, .NET SDK 6.0.300+)
  • Projects Affected: 13 projects across src/ and tests/ directories
  • Package Count: 18 unique packages centrally managed
  • Configuration Files: Directory.Packages.props + NuGet.Config for complete package management
  • Code Formatting: Standardized 4-space indentation, UTF-8 without BOM
  • Docker Infrastructure: KRaft mode Kafka setup with cluster ID configuration
  • Backward Compatibility: Fully compatible with existing build processes

✅ Testing

  • Solution restores successfully
  • All projects build without errors
  • Package versions resolve correctly
  • Package source configuration works as expected
  • No NU1507 warnings generated
  • Integration tests pass with new Kafka infrastructure
  • Schema Registry connectivity working
  • No breaking changes to existing functionality

📖 Documentation

Follows Microsoft's Central Package Management guidelines and industry best practices for package source security.

⚠️ Breaking Changes

  • KRaft Migration: Zookeeper-based Kafka setup replaced with KRaft mode

Migration Impact: This comprehensive modernization makes future dependency management significantly easier, more secure, and more reliable across the entire solution while providing a more robust development infrastructure.

- Add Directory.Packages.props with centralized package versions
- Remove version attributes from all PackageReference elements
- Organize packages alphabetically in logical sections
- Enable solution-wide consistent dependency management
- Add explicit package source configuration at solution level
- Support CPM best practices and consistent package resolution
- Standardize indentation for better consistency and readability
@ffernandolima ffernandolima added the enhancement New feature or request label Jun 24, 2025
@ffernandolima
ffernandolima requested a review from Copilot June 24, 2025 23:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Implements Central Package Management (CPM) by centralizing all NuGet package versions into a single Directory.Packages.props and adding an explicit NuGet.Config, then cleaning up individual project files.

  • Added Directory.Packages.props for centralized version definitions and grouping
  • Added NuGet.Config for explicit package source mapping
  • Removed Version attributes from all <PackageReference> entries in 13 projects and updated the solution file

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Confluent.Kafka.Core.Tests/Confluent.Kafka.Core.Tests.csproj Removed Version attributes from test package references
tests/Confluent.Kafka.Core.Shared.Tests/Confluent.Kafka.Core.Shared.Tests.csproj Removed Version attributes from shared test package references
src/**/*.csproj Removed Version attributes across all production package references
NuGet.Config Added explicit package source mapping
Directory.Packages.props Introduced centralized <PackageVersion> definitions
Confluent.Kafka.Core.sln Added Directory.Packages.props and NuGet.Config to solution items
Comments suppressed due to low confidence (2)

tests/Confluent.Kafka.Core.Tests/Confluent.Kafka.Core.Tests.csproj:31

  • Consider adding PrivateAssets="all" to test-only dependencies (Microsoft.NET.Test.Sdk, Moq, xunit) to prevent them from flowing transitively to consuming projects.
		<PackageReference Include="Microsoft.NET.Test.Sdk" />

tests/Confluent.Kafka.Core.Shared.Tests/Confluent.Kafka.Core.Shared.Tests.csproj:29

  • Shared tests also reference configuration and test frameworks; add PrivateAssets="all" on PackageReference elements that should not be transitive.
		<PackageReference Include="Microsoft.Extensions.Configuration" />

Comment thread NuGet.Config
- Standardize indentation across all .csproj and Directory.Packages.props
- Fix encoding issues and remove BOM signatures
- Ensure consistent UTF-8 formatting throughout solution
- Convert Docker Compose from Zookeeper-based to KRaft mode
- Remove Zookeeper service for simplified architecture
- Add CLUSTER_ID and update Kafka configuration for KRaft
- Fix integration test failures with Schema Registry and Kafka connections
- Reduce container count and improve startup performance
@ffernandolima ffernandolima changed the title feat: Implement Central Package Management (CPM) for unified dependency management feat: implement comprehensive solution modernization (CPM, KRaft, formatting) Jun 25, 2025
@ffernandolima
ffernandolima merged commit 04f59bd into main Jun 25, 2025
5 checks passed
@ffernandolima
ffernandolima deleted the CPM branch June 25, 2025 00:34
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.

2 participants