Read a project saved as a single XML file - #57
Merged
Merged
Conversation
`matlab.project.convertDefinitionFiles(root, "SingleFile")` collapses a project's whole content store into one `resources/project/Project.xml` whose root element is `<project MetadataType="monolithic">`. The reader indexed only documents rooted at `<Info>`, so that one document was dropped, the index came out empty, and a converted project reported "No readable project entries were found under resources/project/" and showed as empty — before any layout detection ran, so not even the "cannot read this format yet" message a user could act on. It is a third layout, and it fits the two that were already here: the entity tree IS the element tree, where a tag is the entity's type, the `Location` attribute is its location, and the `<Info>` child is its def. So `monolithicLayout` joins `fixedPathV2Layout` and `distributedLayout` behind the same `Layout` seam and all seven collection readers are unchanged. Two things in it are not obvious. `<Info>` means two things in this layout — every entity's def, AND the type of the entity holding the project's name — separated only by whether it carries a `Location`, so taking the first `<Info>` child blindly makes the name entity the def of `<project>` itself and loses the name. And an element with neither attributes nor children parses as the empty STRING rather than an object, which matters because a bare `<DIR_SIGNIFIER/>` is of that shape and `DIR_SIGNIFIER` is the only thing marking a member as a folder. Which KIND of store it is is settled structurally, by the root element, before `MetadataType` is consulted at all: a monolithic store's manifest is the store, so there is no separate document to ask. A store declaring a layout we cannot walk is still reported rather than guessed at, which now includes one that declares `monolithic` and holds no such document. Checked against MATLAB R2027a, which converts a project between these formats in place: the same 372-member project written as SingleFile, FixedPathMultiFile and MultiFile parses to byte-identical results, `format` aside. That is the invariant the new parity test pins — three encodings of one project cannot disagree about what the project is — since the per-layout tests can all pass while the walkers disagree.
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.
matlab.project.convertDefinitionFiles(root, "SingleFile")collapses a project's whole content store into oneresources/project/Project.xmlwhose root element is<project MetadataType="monolithic">. The reader indexed only documents rooted at<Info>, so that one document was dropped, the index came out empty, and a converted project reported "No readable project entries were found under resources/project/" and showed as empty — before any layout detection ran, so not even the "cannot read this format yet" message a user could act on.It is a third layout, and it fits the two already here: the entity tree IS the element tree, where a tag is the entity's type, the
Locationattribute is its location, and the<Info>child is its def. SomonolithicLayoutjoinsfixedPathV2LayoutanddistributedLayoutbehind the sameLayoutseam, and all seven collection readers are unchanged.Two things in it are not obvious:
<Info>means two things in this layout — every entity's def, AND the type of the entity holding the project's name — separated only by whether it carries aLocation. Taking the first<Info>child blindly makes the name entity the def of<project>itself and loses the name.<DIR_SIGNIFIER/>is of that shape andDIR_SIGNIFIERis the only thing marking a member as a folder.Which KIND of store it is is settled structurally, by the root element, before
MetadataTypeis consulted at all: a monolithic store's manifest is the store, so there is no separate document to ask. A store declaring a layout we cannot walk is still reported rather than guessed at — which now includes one that declaresmonolithicand holds no such document.Verification
Checked against MATLAB R2027a, which converts a project between these formats in place. The same 372-member project (89 folders, 197 labelled files, 88 path folders, 7 labels, 14 entry points, 2 groups, 3 working folders) written as SingleFile, FixedPathMultiFile and MultiFile parses to byte-identical results,
formataside, with zero warnings and identical startup/shutdown run order.That is the invariant the new parity test pins — three encodings of one project cannot disagree about what the project is — since the per-layout tests can all pass while the walkers disagree.
npm run verify: 5148 tests pass.Note on the fourth format:
DefinitionFiles.Tomlremovesresources/and the.prjmarker, leaving a rootmatlab.toml. There is no.prjfor the extension to open, so it is out of scope here rather than fixed.