feat add repostitory information to the source info of twin#527
Merged
PTKu merged 5 commits intoJun 3, 2026
Merged
Conversation
…normalizer Increment 1 of repository-aware source provenance (TDD red->green). - AXSharp.Connector.SourceRepositoryAttribute(url, commit, branch) and SourceLibraryAttribute(name, version), both [assembly]-scoped, single-use. - AXSharp.Compiler.GitUrlNormalizer: SSH/scp/https remote -> canonical credential-free https, strips port/.git/trailing slash; blank -> empty; unrecognized input returned verbatim.
Increment 2 of repository-aware source provenance (TDD red->green). - SourceOrigin + SourceOriginMode (Repository|Library|None) carrying the per-type path base folder plus repo/package identity. - ISourceOriginProvider seam with ApaxSourceOriginProvider (apax name/version, src-rooted), NoSourceOriginProvider (legacy, no emission) and GitSourceOriginProvider (LibGit2Sharp; innermost repo + origin remote -> normalized https url, HEAD sha, branch/empty on detached; falls back to apax when no repo or no usable remote). - Reference LibGit2Sharp (already pinned centrally) from the compiler and the compiler test project; temp-repo integration tests for the git provider.
…igin Increment 3 of repository-aware source provenance (TDD red->green). - AXSharpProject exposes a lazily-resolved SourceOrigin via an injectable ISourceOriginProvider (defaults to apax-mode for now; auto-detection is wired with the CLI option in a later increment). - SourceFileAttributeHelper relativizes against SourceOrigin.BaseFolder instead of AxProject.SrcFolder, so repository mode yields repo-root-relative paths and apax mode keeps src-relative paths. - Onliner/Plain builder call sites pass Project.SourceOrigin. Existing src-relative goldens stay green; new tests cover repo-rooted emission.
Increment 4 of repository-aware source provenance (TDD red->green). - SourceOriginEmitter renders the single [assembly: ...] declaration: SourceRepository(url, commit, branch) in repository mode, SourceLibrary(name, version) in library mode, nothing in None mode. - AXSharpProject.Generate writes it once to .g/AssemblyAttributes.g.cs (picked up by the existing .g/** compile glob), after the per-file/Configurations emission. None mode writes no file (legacy behavior preserved).
…default Increment 5 of repository-aware source provenance (TDD red->green). - ICompilerOptions.SourceOrigin (auto|apax|off) implemented across ixc/ixr/ixd options, AXSharpConfig (persisted + OverridesFromCli) and test options. - ixc gains --source-origin (default auto). - SourceOriginProviderFactory maps the value to a provider; AXSharpProject uses it when no provider is injected (auto => git detection in real builds). - Test options default to "off" (legacy: src-relative, no assembly attribute) so existing goldens/integration comparisons stay deterministic and repo-independent; provenance behavior is covered by explicit-provider tests. CLI generation tests bumped +1 file for the emitted .g/AssemblyAttributes.g.cs. - SourceFileAttribute doc clarified: path base is repo-root in repository mode, otherwise src-folder (discriminated by the assembly-level attribute).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SourceFileAttributepath is repo-root-relative when the project sits in a git repository with anoriginremote, otherwise src-relative (apax fallback / legacy).SourceRepository(url, commit, branch)(repo mode) andSourceLibrary(name, version)(apax mode). Exactly one is emitted per assembly, and its presence discriminates how the per-type path is rooted..git, so submodules resolve to their own repo; remote URL normalized to canonical credential-free https). Mode is selectable viaixc --source-origin auto|apax|off(defaultauto).ixcrun.Changes from CHANGELOG
No
CHANGELOG.mdin this repository — section omitted; see Commits and Diff stat.Commits
feat
ace5c5c8feat(provenance): add SourceRepository/SourceLibrary attrs + git URL normalizer6e91763ffeat(provenance): add SourceOrigin model and resolution providers7e80145dfeat(provenance): root per-type SourceFile path via resolved SourceOrigin0a13fb8cfeat(provenance): emit assembly-level source-origin attribute0f872d42feat(provenance): add --source-origin option and wire auto-detection defaultDiff stat
Test plan
dotnet buildof the compiler solution succeeds (LibGit2Sharp restores across target RIDs)dotnet testgreen forAXSharp.CompilerTests,AXSharp.Compiler.CsTests,AXSharp.ixc.Tests,AXSharp.ConnectorTestsdotnet ixcregenerates a twin without errors on a git-tracked apax project → emits[assembly: AXSharp.Connector.SourceRepository(...)]+ repo-root-relativeSourceFileAttributepathsdotnet ixc --source-origin apax→ emits[assembly: AXSharp.Connector.SourceLibrary(name, version)]+ src-relative pathsdotnet ixc --source-origin off→ no assembly attribute file, src-relative paths (legacy output unchanged)Generated by
/pr-description-update. Last regenerated: 2026-06-02.