Repository navigation
fix: CLI 6 findings from an MES 12.0 end-to-end tutorial run - #894
jpsmoreira-com wants to merge 11 commits into
Conversation
… behavior State that CLI v6 init needs no environment or infrastructure file, and that MES v9 or earlier needs CLI v5.x and the old init command. Document the mandatory and conditional dependency flags, the CIRepository paths written by init, and the assemble and pack behavior changed by this branch. Refs criticalmanufacturing#893
The task library and driver templates pinned moment, inversify, reflect-metadata and zone.js, so they drifted from the Connect IoT runtime: moment 2.30.1 breaks npm install on MES 11 (the engine peer is exactly 2.29.4), and reflect-metadata 0.1.13 and zone.js 0.14.7 duplicate the MES 12 runtime copies. new iot taskLibrary and driver now read these versions from the controller engine or driver package at the project's MES dist-tag, falling back to the known versions per MES version when the registry is unreachable or a library is not declared. Refs criticalmanufacturing#893
The .localenv/.env file holds the license id and system name shared by the whole project, so committing it saves every developer from passing the license id again. Refs criticalmanufacturing#893
| throw new CliException(errorMessage); | ||
| if (!dependency.Mandatory) | ||
| { | ||
| Log.Warning(string.Format(CliMessages.OptionalDependencyNotFound, dependency.Id, dependency.Version)); |
There was a problem hiding this comment.
Missing a continue after this warning. When an optional dependency is absent, dependency.CmfPackage remains null, so execution reaches line 285 and throws a NullReferenceException.
The new test Assemble_OptionalMissingDependencyAndMissingRepositoryFolder_AreSkipped reproduces this failure on the current PR head.
There was a problem hiding this comment.
Fixed in 5b34ffc: the optional branch now continues after the warning. Assemble_OptionalMissingDependencyAndMissingRepositoryFolder_AreSkipped passes.
| { | ||
| string errorMessage = string.Format(CoreMessages.MissingMandatoryDependency, dependency.Id, dependency.Version); | ||
| throw new CliException(errorMessage); | ||
| if (!dependency.Mandatory) |
There was a problem hiding this comment.
This also needs to preserve the mandatory flag when loading dependencies from ZIP manifests. CmfPackage.FromManifest currently reads only id and version, leaving Mandatory at its default of true.
I reproduced this with a root package depending on a ZIP whose manifest declares a missing dependency with mandatory="false": assemble still throws MissingMandatoryDependency.
The manifest parsing limitation predates this PR, but it leaves the optional dependency fix incomplete. Please preserve the flag and add coverage for this transitive case.
There was a problem hiding this comment.
Fixed in 5b34ffc: CmfPackage.FromManifest now reads the mandatory attribute of dependencies and test packages (left at the default true when absent). Added Assemble_MissingTransitiveDependency_UsesTheMandatoryFlagOfTheZipManifest, covering a ZIP whose manifest declares a missing dependency with mandatory="false" (skipped with a warning) and mandatory="true" (still fails). It fails without the fix. The full suite, except the cmf new specs, passes (820 passed, 2 skipped).
…ory flag from ZIP manifests - Continue after warning about a missing optional dependency, instead of dereferencing its null package. - Read the mandatory attribute of dependencies in DF package manifests, so optional dependencies of packages loaded from ZIP files are no longer treated as mandatory. Refs criticalmanufacturing#893
Lines appended to the generated .gitignore (for example Libs/LBOs/ after the first LBO generation) were joined to the last entry, Assemble/. Refs criticalmanufacturing#893
What was done
Fixes items 1 to 6 of #893, found while building an MES 12.0.0 customization end to end with CLI 6.0.0 (the developer portal Greetings tutorial), and updates the related documentation.
cmf new html: pass--skip-gittong new, so the Angular workspace no longer creates a nested, empty Git repository that breaksgit addat the project root.cmf new iot taskLibraryanddrivertemplates: read themoment,inversify,reflect-metadataandzone.jsversions from the Connect IoT package for the project's MES version (the controller engine for task libraries, the driver package for drivers). If the registry can't be reached or a library isn't declared, the CLI uses known versions per MES version. Before, the templates pinned fixed versions:reflect-metadata0.1.13 andzone.js0.14.7 duplicated the MES 12 runtime copies, and MES 11 needsmoment2.29.4, which the 11.x engine requires exactly. Also quote the mocha glob so tests in subfolders run.cmf init --deploymentDir: trim trailing separators from the deployment folder. The main-branch CI path is now built by the init command with the same separator as the other paths, instead of a templatejoinwith a hard-coded backslash. On Linux this gives<dir>/CIPackages/developmentinstead of<dir>//CIPackages\development. Windows and UNC output is unchanged.cmf assemble: skip repository folders that do not exist, and log a warning instead of failing for a missing dependency with"mandatory": false. Mandatory dependencies behave as before.cmf pack: the "already packed" skip is now a warning that names--forceand the version bump..gitignore: ignoredeploymentDir/andAssemble/, and end the file with a newline so appended entries do not join the last line.initpage states that from CLI v6 no environment or infrastructure file is required, because--tenantis enough and the public Critical Manufacturing registries are the default.initcommand. The concepts and tutorial pages now say v5.x instead of 5.8.0, since 5.10.7 still has the MES v9 init and HTML paths.cmfpackage.jsonpage documents themandatoryandconditionaldependency flags.repositories.json,assembleandpackpages describe the behavior above.Items 7 to 9 of #893 are not changed by this PR.
Validation checklist
Please ensure the following conditions are met in order for this PR to be merged:
Code validation. Init, assemble and pack tests pass: 139 tests, 5 of them new, 1 skipped. The new tests cover trailing separators, including drive roots and UNC paths, the generated
repositories.json, and an optional missing dependency with a missing repository folder.Not run. The
cmf newtest suite fails in the local environment withInvalid repository type "Portal", expected one of: CIFS, NPM.The failure is identical on unmodifieddevelopment.Manual checks. The
ng new --skip-gitchange was checked with Angular CLI 22. The task library template was checked by building a custom task and running its tests on MES 12.0, and by building, testing and packing a task library with the MES 11.3.5 versions. The registry lookup was checked against the CM registry for MES 12.0.0 and 11.3.5.Not verified. No full integration run of a CLI built from this branch was done.
Refs #893