Skip to content

fix(build): improve source generator packaging and add taskfile workflow#7

Merged
j-d-ha merged 5 commits into
mainfrom
fix/build
Dec 20, 2025
Merged

fix(build): improve source generator packaging and add taskfile workflow#7
j-d-ha merged 5 commits into
mainfrom
fix/build

Conversation

@j-d-ha

@j-d-ha j-d-ha commented Dec 20, 2025

Copy link
Copy Markdown
Collaborator

Summary

This PR enhances the build and packaging infrastructure for the source generator project by:

  • Adding a comprehensive taskfile.yaml for standardized development workflows
  • Improving the NuGet package configuration for proper source generator packaging
  • Updating .gitignore to exclude NuGet package output directory

Changes

Taskfile Workflow

Added taskfile.yaml with the following tasks:

  • format: Reformat code using CSharpier
  • clean: Clean build artifacts and NuGet packages
  • restore: Restore NuGet dependencies
  • build: Build solution in Release configuration
  • pack: Create NuGet packages

Source Generator Packaging

Enhanced LayeredCraft.SourceGeneratorTools.Generator.csproj:

  • Configured proper analyzer packaging with SuppressDependenciesWhenPacking
  • Disabled symbol packages for source generators
  • Used @(IntermediateAssembly) for more reliable packaging
  • Added custom MSBuild target to include PolySharp dependency in analyzer path

Build Configuration

  • Updated .gitignore to exclude ./nupkg directory
  • Added taskfile.yaml and .gitignore to solution items for visibility

Checklist

  • The build passes
  • Tests have been added or updated (if applicable)
  • Documentation has been updated (if applicable)
  • Code follows project conventions
  • Changes have been tested locally

Related Issues/PRs

N/A

Reviewer Notes

The key improvements are:

  1. Taskfile workflow: Provides a consistent interface for common development tasks with proper dependency ordering
  2. Packaging fixes: Ensures the source generator DLL and its dependencies are correctly packaged in the analyzers folder
  3. The custom MSBuild target IncludeAnalyzerDependencies ensures PolySharp is included with the generator

Please verify that the generated NuGet package structure is correct and that the source generator works when referenced from another project.

- Introduced `taskfile.yaml` to streamline common tasks such as formatting, restoring, building, and packing.
- Updated `.gitignore` to exclude generated `nupkg` directory.
- Included `taskfile.yaml` in the solution directory for better visibility.
- Added `clean` task to remove NuGet packages and clean Release folder.
- Introduced `publish` task for publishing packages to NuGet, with dependency on `pack`.
- Updated `.gitignore` to correctly ignore `.env` file instead of all `*.env` files.
- Linked `clean` task as a dependency for `restore` to ensure a fresh workspace.
- Removed `dotenv` configuration as it was unused.
- Deleted `publish` task to simplify the taskfile and remove NuGet publish workflow.
- Suppressed dependency/content warnings during source generator packaging.
- Updated analyzer packaging to use `@(IntermediateAssembly)` for better reliability.
- Added a target to include analyzer dependencies, e.g., `PolySharp`, in the package if required.
- Removed redundant `<ItemGroup>` entries from project files for `icon.png` and `README.md`.
- Centralized `icon` and `README` inclusion in `Directory.Build.props` for consistency.
@j-d-ha
j-d-ha merged commit d17f3ad into main Dec 20, 2025
1 check passed
@j-d-ha
j-d-ha deleted the fix/build branch December 20, 2025 20:20
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