Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Refactor the selected legacy emitter implementation from manual `string` / `Stri
### Requirements

1. Use structured declaration APIs where applicable:
- `WriteClass/WriteStruct/WriteRecordClass/WriteInterface/WriteEnum`
- `WriteMethod`, `WriteProperty`, `WriteField`, `WriteConstructor`
- `Class/Struct/RecordClass/Interface/Enum`
- `Method`, `Property`, `Field`, `Constructor`
2. Use XML helper extensions instead of raw `///` composition:
- `XmlSummary`, `XmlParam`, `XmlReturn`, `XmlRemarks`, `XmlCode` or `XmlCodeBlock`
3. Use `TypeReferenceOptions` when type text becomes complex (nullability, generics, arrays).
3. Use `TypeReference` when type text becomes complex (nullability, generics, arrays).
4. Ensure writer lifetime is output-scoped (`generationContext.CreateCodeWriter()` inside callback).
5. Preserve behavior, diagnostics, and generated names.
6. Keep changes minimal and focused; do not reformat unrelated logic.
Expand Down
26 changes: 5 additions & 21 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,10 @@ concurrency:
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"

- name: Run PR pipeline
run: dotnet run --project build/PipelineCLI/PipelineCLI.csproj --configuration Release
uses: purview-dev/build/.github/workflows/purview-build.yml@main
with:
build-version: "0.2.1"
secrets: inherit

samples:
name: Build and test samples
Expand All @@ -42,13 +31,8 @@ jobs:
with:
dotnet-version: "10.0.x"

# This is so the analyzer projects can be used in the sample app projects.
# The analyzer projects are not referenced by the sample app projects, the assemblies are, so they need to be built first.
- name: Run pipeline build
run: dotnet run --project build/PipelineCLI/PipelineCLI.csproj --configuration Release -- --Build:RunTests=false --Release:Mode=None

- name: Build SampleApp
run: dotnet build samples/SampleApp/SampleApp.slnx --configuration Release

- name: Test SampleApp
run: dotnet test samples/SampleApp/SampleApp.slnx --configuration Release --no-build
run: dotnet test samples/SampleApp/SampleApp.slnx --configuration Release --no-build
48 changes: 7 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,14 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: false

jobs:
release:
name: Release packages
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"

- name: Check for version bump
id: version
shell: bash
run: |
VERSION=$(node -p "require('./package.json').version")
TAG="v$VERSION"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Version $VERSION is already tagged as $TAG. Skipping release."
echo "should_publish=false" >> "$GITHUB_OUTPUT"
else
echo "New version $VERSION detected. Releasing $TAG."
echo "should_publish=true" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
fi

- name: Run release pipeline
if: steps.version.outputs.should_publish == 'true'
env:
Release__ShouldPublish: true
Release__Mode: NuGet
Build__RunPack: true
NuGet__ApiKey: ${{ secrets.NUGET__APIKEY }}
GITHUB_TOKEN: ${{ github.token }}
run: dotnet run --project build/PipelineCLI/PipelineCLI.csproj --configuration Release
uses: purview-dev/build/.github/workflows/purview-release.yml@main
with:
build-version: "0.2.1"
release-mode: NuGet
release-branch: main
secrets: inherit
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,5 @@ node_modules/

# BenchmarkDotNet output
BenchmarkDotNet.Artifacts/!scripts/*
!build/
!build/
.tools/
9 changes: 1 addition & 8 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,9 @@
Consumers on net48 or net8+ built with VS 2022 17.14+ or .NET 10+ SDK are fully supported. -->
<RoslynVersion>4.14.0</RoslynVersion>
<TUnitVersion>1.65.51</TUnitVersion>
<PurviewSGFVersion>1.0.0-prerelease.30</PurviewSGFVersion>
<ModularPipelinesVersion>3.2.8</ModularPipelinesVersion>
<PurviewSGFVersion>1.0.0-prerelease.33</PurviewSGFVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="ModularPipelines" Version="$(ModularPipelinesVersion)" />
<PackageVersion Include="ModularPipelines.DotNet" Version="$(ModularPipelinesVersion)" />
<PackageVersion Include="ModularPipelines.Git" Version="$(ModularPipelinesVersion)" />
<PackageVersion Include="ModularPipelines.GitHub" Version="$(ModularPipelinesVersion)" />
<PackageVersion Include="NuGet.Packaging" Version="7.9.0" />
<PackageVersion Include="NuGet.Versioning" Version="7.9.0" />
<PackageVersion Include="Purview.SourceGeneratorFramework" Version="$(PurviewSGFVersion)" />
<PackageVersion Include="Purview.SourceGeneratorFramework.Testing.TUnit" Version="$(PurviewSGFVersion)" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.400" />
Expand Down
34 changes: 21 additions & 13 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ solution_file := root_folder + "Telemetry.SourceGenerator.slnx"
test_solution := solution_file
build_configuration := "Release"

pipeline_solution := "build/Pipeline.slnx"
pipeline_project := "build/PipelineCLI/PipelineCLI.csproj"
pipeline_version := "0.2.1"
pipeline_feed := "https://api.nuget.org/v3/index.json"
pipeline_tool := ".tools/purview-build/purview-build"

sample_solution_file := "./samples/SampleApp/SampleApp.slnx"
artifact_folder := "./artifacts/"
Expand All @@ -18,38 +19,50 @@ benchmark_solution := "./benchmarks/Purview.Telemetry.Benchmarks/Purview.Telemet
default:
just --list

# Install the shared Purview.Build tool (authenticated to the Purview-Dev feed) if not present
[private]
ensure-pipeline-tool:
if [ ! -x "{{ pipeline_tool }}" ]; then \
dotnet tool install Purview.Build --tool-path .tools/purview-build --add-source "{{ pipeline_feed }}" --version "{{ pipeline_version }}"; \
fi

# Run the PR pipeline (restore, build, lint, tests)
[group('Pipeline')]
pipeline-pr *args:
just ensure-pipeline-tool
echo "Running PR pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} {{ args }}
"{{ pipeline_tool }}" {{ args }}

# Run the build pipeline (restore, build, lint)
[group('Pipeline')]
pipeline-build *args:
just ensure-pipeline-tool
echo "Running build pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} -- --Build:RunTests=false --Release:Mode=None {{ args }}
"{{ pipeline_tool }}" --Build:RunTests=false --Release:Mode=None {{ args }}

# Run the release pipeline (restore, build, lint, tests, pack, publish, GitHub release)
[group('Pipeline')]
pipeline-release *args:
just ensure-pipeline-tool
echo "Running release pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} -- --Release:Mode=NuGet {{ args }}
"{{ pipeline_tool }}" --Release:Mode=NuGet {{ args }}

# Run the release pipeline (restore, build, lint, tests, pack, local nuget publish)
# Note: `just` runs recipes through the shell, which strips backslashes from unquoted arguments.
# Always use forward slashes for the feed path, e.g.
# Use the LOCAL_NUGET_FEED_PATH environment variable or forward slashes, e.g.
# just pipeline-local-release --PublishLocalNuGet:LocalFeedPath=p:/_sync-projects/.local-nuget/
[group('Pipeline')]
pipeline-local-release *args:
just ensure-pipeline-tool
echo "Running local release pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} -- --Release:Mode=LocalNuGet {{ args }}
"{{ pipeline_tool }}" --Release:Mode=LocalNuGet {{ args }}

# Run the pipeline with tests enabled
[group('Pipeline')]
pipeline-tests *args:
just ensure-pipeline-tool
echo "Running tests pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} -- --Build:RunTests=true --Release:Mode=None {{ args }}
"{{ pipeline_tool }}" --Build:RunTests=true --Release:Mode=None {{ args }}

# -----------------------------------------------------------------------------
# Build and Test
Expand Down Expand Up @@ -156,11 +169,6 @@ vs:
echo "Opening {{ BLUE }}{{ solution_file }}{{ NORMAL }}..."
open "{{ solution_file }}"

# Open the solution in Visual Studio/ Registered application
[group('Utilities')]
vs-pipeline:
open {{ pipeline_solution }}

# Opens the root folder in Visual Studio Code

[group('System/ Shell')]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Generates [`ActivitySource`](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.activitysource), [`ILogger`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.ilogger), and [`Metrics`](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.metrics) based telemetry from methods you define on an interface.

[![CI](https://github.com/purview-dev/telemetry-sourcegenerator/actions/workflows/ci.yml/badge.svg)](https://github.com/purview-dev/telemetry-sourcegenerator/actions/workflows/ci.yml)
[![Release](https://github.com/purview-dev/telemetry-sourcegenerator/actions/workflows/release.yml/badge.svg)](https://github.com/purview-dev/telemetry-sourcegenerator/actions/workflows/release.yml)

## Features

Expand Down
12 changes: 0 additions & 12 deletions build/Directory.Build.props

This file was deleted.

3 changes: 0 additions & 3 deletions build/Directory.Build.targets

This file was deleted.

11 changes: 0 additions & 11 deletions build/Pipeline.slnx

This file was deleted.

11 changes: 0 additions & 11 deletions build/PipelineCLI/GlobalUsings.cs

This file was deleted.

9 changes: 0 additions & 9 deletions build/PipelineCLI/Helpers/DotNetCLIOptions.cs

This file was deleted.

21 changes: 0 additions & 21 deletions build/PipelineCLI/Helpers/PathHelpers.cs

This file was deleted.

39 changes: 0 additions & 39 deletions build/PipelineCLI/Helpers/TestHelpers.cs

This file was deleted.

30 changes: 0 additions & 30 deletions build/PipelineCLI/Modules/BuildModule.cs

This file was deleted.

Loading
Loading