Repository navigation
feat(project): Offer configPath property to workspace configs (workspace/1.1) - #1643
maxreichmann wants to merge 36 commits into
Conversation
workspace/1.1)configPath property to workspace yamls (workspace/1.1)
configPath property to workspace yamls (workspace/1.1)configPath property to workspace configs (workspace/1.1)
|
Kindly asking @KlattG to review the documentation part of this PR already ( (I didn't add this feature to the usual |
398ace8 to
5c857ed
Compare
d3xter666
left a comment
There was a problem hiding this comment.
Please, check the log when you try to build with this new validation/schema:
strict mode: missing type "object" for keyword "properties" at "ui5-workspace.json#/then/properties/dependencyManagement" (strictTypes)
strict mode: missing type "array" for keyword "items" at "ui5-workspace.json#/then/properties/dependencyManagement/properties/resolutions" (strictTypes)
strict mode: missing type "object" for keyword "required" at "ui5-workspace.json#/then/properties/dependencyManagement/properties/resolutions/items/then/not" (strictTypes)This is from AJV's strict mode
Resolved with 4ebdb73 |
b5f28b4 to
2a27fc6
Compare
adf732b to
6e7dcd2
Compare
Implements the previously created concept markdown for "specificity wins + Error on duplicate"
NodePackageDependencies silently ignored the `configPath` of a workspace-resolved dependency. It's now carried through to projectGraphBuilder so the custom config is loaded instead of the default ui5.yaml.
When a workspace declares a resolution for a collection and a more specific one for a nested sub-collection or library inside it, the nested resolution must own its subtree's configPath. Which one applied depended on the order the async traversals finished: first to mark a node visited won. For members reached via recursion that order is I/O dependent, so a broader resolution could claim a module meant for a more specific one. Record the declared resolution roots up front and skip recursion into any member that is itself a declared resolution, leaving it and its subtree to that resolution.
Resolve workspace entries one at a time and track visited paths per resolution to prevent cycles. Preserve the most specific configuration when workspace globs overlap.
Treat paths with and without trailing slashes as the same directory, so overlapping resolutions load only the most specific config. + Add tests
51acda3 to
d3b7fb4
Compare
b4ee83b to
75f8e5e
Compare
|
As this PR is quite huge, this review order might ease the start:
The many new files under Fixture: collection.cLocated under Fixture: collection.c.noCustomConfigForLibALocated under The added tests mostly test if the correct config was loaded in various scenarios. |
| log.verbose(`Module located at ${nodePath} has already been visited`); | ||
| return []; | ||
| async _getModulesFromPath( | ||
| visitedNodesPerResolution, |
There was a problem hiding this comment.
[suggestion only] you could make visitedNodesPerResolution the last parameter and give it a default of new Set(). The recursive call in lines 282-283 would propagate the parameter to nested calls. The call on top level (line 180) would not provide a value (-> the default applies).
That way, this helper collection would be fully local to _getModulesFromPath and not be spread over two levels.
| const absolutePath = path.resolve(this.#cwd, resolutionPath); | ||
| if (seenAbsolutePaths.includes(absolutePath)) { | ||
| throw new Error( | ||
| `Multiple resolutions for the same dependency '${path.basename(absolutePath)}' ` + |
There was a problem hiding this comment.
[suggestion only] I find the term dependency misleading / confusing. A resolution path is not necessarily the same as a dependency in the sense of the ui5.yaml. It might e.g. point to the openui5 repository as a whole, covering multiple dependencies.
Suggestion: "Two resolutions in workspace '${this.getName()}' point to the same folder: ${resolutionPath} and ${earlierResolutionPath}"
To be able to name the earlier resolution path, the bookkeeping seenAbsolutePaths would have to be changed maybe to a map (key: absolute path; value: original resolutionPath).
But again, only a suggestion :-)
There was a problem hiding this comment.
but what about more than two duplicate resolution paths? I would suggest:
"Two or more resolutions for '${path.basename(absolutePath)}' point to the same folder '${absolutePath}' in workspace '${this.getName()}'"
I guess, you also want to provide the full resolutionPath (what is written in the yaml)? Then we'd need to do some bookkeeping
There was a problem hiding this comment.
Your text proposal is acceptable. And yes, I thought that naming the original resolution path(s) would be helpful to the developer.
devtomtom
left a comment
There was a problem hiding this comment.
Overall it looks good to me.
| # UI5 Workspaces | ||
|
|
||
| ::: info | ||
| **UI5 Workspaces is a new feature available since UI5 CLI [`v3.0.0`](https://github.com/SAP/ui5-cli/releases/tag/v3.0.0)** |
There was a problem hiding this comment.
IMO we can get rid of the info and let the documentation start with the General Concept section
This offers a
configPathproperty to workspace dependency resolution entries as follows:(Introducing new specVersion
workspace/1.1)Other sub features:
pathis absolutepathproperty)configPathconfigPath(forpathit's already allowed)The workspace resolution logic is now explicitly implemented as "Most specific wins" (the resolution entry with the deepest
pathgets precedence). Entries are sequentially processed while keeping file reads, glob expansion, and traversal within each entry async.Closes: #1369
JIRA: CPOUI5FOUNDATION-1233