Skip to content

Commit 6762518

Browse files
jaredparCopilot
andauthored
Make Generate deterministic and add CI verification step (#89)
* Make Generate deterministic by sorting files by relative path The file system enumeration in FindDlls was non-deterministic because Directory.GetFiles does not guarantee ordering, and the ordering varies across operating systems. Fix by: 1. Collecting all results into a list instead of yielding immediately 2. Normalizing path separators to forward slash for consistent sorting 3. Sorting by relative path using ordinal comparison This ensures the generated output is identical regardless of OS or file system enumeration order. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add CI step to verify generated code is up-to-date Runs the generator after restore and fails the build if there are any uncommitted diffs, ensuring PRs always include freshly generated output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix cross-OS path separator in targets resource paths Path.Join uses the OS-specific separator between the prefix and the relative path, producing different output on Windows vs Linux. Replace with string interpolation using a consistent forward slash separator since MSBuild handles both styles. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix double-slash in resource paths by trimming leading separator On Linux, Substring(packagePrefix.Length) produces a leading / in the relative path. Combined with the interpolated /, this caused // in the output. TrimStart('/') after normalization ensures no leading separator. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Normalize line endings to LF for cross-OS determinism Add .gitattributes to enforce LF line endings and normalize the generator output with ReplaceLineEndings to always produce LF. This ensures the generator produces identical output on Windows and Linux, making the CI verification step pass on both platforms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 06032b9 commit 6762518

55 files changed

Lines changed: 44163 additions & 44149 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ensure consistent line endings across all platforms
2+
* text=auto eol=lf

.github/workflows/dotnet.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ jobs:
2424
- name: Restore dependencies
2525
run: dotnet restore
2626

27+
- name: Verify generated code is up-to-date
28+
run: |
29+
dotnet run --project Src/Generate
30+
git diff --exit-code || (echo "Generated code is out of date. Run 'dotnet run --project Src/Generate' and commit the results." && exit 1)
31+
2732
- name: Build
2833
run: dotnet build --no-restore -bl
2934

Src/Basic.Reference.Assemblies.AspNet100/Generated.cs

Lines changed: 3805 additions & 3805 deletions
Large diffs are not rendered by default.

Src/Basic.Reference.Assemblies.AspNet100/Generated.targets

Lines changed: 921 additions & 921 deletions
Large diffs are not rendered by default.

Src/Basic.Reference.Assemblies.AspNet110/Generated.cs

Lines changed: 4681 additions & 4681 deletions
Large diffs are not rendered by default.

Src/Basic.Reference.Assemblies.AspNet110/Generated.targets

Lines changed: 1002 additions & 1002 deletions
Large diffs are not rendered by default.

Src/Basic.Reference.Assemblies.AspNet80/Generated.cs

Lines changed: 3658 additions & 3658 deletions
Large diffs are not rendered by default.

Src/Basic.Reference.Assemblies.AspNet80/Generated.targets

Lines changed: 903 additions & 903 deletions
Large diffs are not rendered by default.

Src/Basic.Reference.Assemblies.AspNet90/Generated.cs

Lines changed: 3670 additions & 3670 deletions
Large diffs are not rendered by default.

Src/Basic.Reference.Assemblies.AspNet90/Generated.targets

Lines changed: 906 additions & 906 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)