Blohm NC
VS Code extension with a build panel for Blohm NC cycles. It builds selected packages and single cycles of a GrindingScript project (for example BlohmJung.GrindingScriptProjects.Standard) on your own computer, with the same core and rules as the pipeline build: header, ZipNC compression, packages and protected packages through protector.exe. The core is nc-build-tools (next to this folder), bundled into the extension; the plan and the deliberate deviations D1–D15 are in nc-build-tools/PLAN.md.
Internal use only. The extension ships kopf.txt and protector.exe of the Common package (see assets/SOURCE.md). It is never published to a public Marketplace. The SHA-256 check of the shipped files guards against accidental changes only, not against tampering (SOURCE.md ships with them); this is an accepted assumption for an internal extension.
Install
The pipeline .ado/blohm-nc-extension.yml publishes blohm-nc-extension-<version>.vsix as the artifact of every run on main. Install it with
code --install-extension blohm-nc-extension-0.1.0.vsix
Build panel
Open it with the Blohm NC icon in the activity bar or the command Blohm NC: Open build panel.
- Project: the workspace folder with
content/Zyklen/ (a dropdown when there are several). Variante and Version are pre-filled from projectName and projectVersion of .ado/azure-pipeline.yml (2.3.1 gives 002.003.001, like the pipeline); version/ is never read. Both stay editable; an empty field refuses the build, and when the YAML or a variable is missing the field starts empty with a hint. Output folder: default <project>/bin-local, or any folder chosen with Browse…; remembered per workspace.
- Packages: every
content/Zyklen/Pakete/*.INF with a checkbox; protected packages (name contains protect) have a lock and a Protect switch (see below). Select all, Select none, a filter field; click a name to see its cycles.
- Single files:
.txt cycles of content/Zyklen, each with a Protected switch (off by default). Add them with Add files…, with Add to NC build in the Explorer context menu (several files at once) or in the editor title.
- Build and Cancel. Build is disabled when nothing is selected, and when protected items (protected packages with Protect on, protected single files) are selected on a system other than Windows.
- Machine backup: an update of the cycles from a machine backup (see below).
- Result: files written, warnings, errors and run time, the list of written files and Open output folder. Errors and warnings with file and line are in the Problems panel; the full log is in the output channel Blohm NC Build.
The selection (packages, Protect switches of the packages, single files, protect switches, output folder) is saved per workspace. Files that no longer exist are marked and not built.
Fold a section: click a section heading, or focus it with Tab and press Enter or Space. A folded section shows only its heading (a ▸ chevron instead of ▾), with the same text, so Packages (X of Y) still shows the counts. Folding never changes the selection, the filter or an input. Which sections are folded is saved per workspace and stays when you choose another project; at first, every section is unfolded. When a build sets a new result, Result unfolds by itself, so errors are not missed. The cycle list of a package (click its name) opens and closes as before and is not saved.
Protect switch of a protected package
Each protected package row has a Protect switch, on by default. On, the package is encrypted with protector.exe as before. Off, the package is built exactly like a normal package: <out>/Zyklen/Pakete/<Name>/<Name>.arc with the usual header (;VERSION: <Variante>-<Patch> ;PACKAGE: <Name>), no staging folder and no protector.exe, so it also builds on a system other than Windows.
- The
.arc holds the cycles in clear text. The row says so, the Build section lists the packages that will be built without protection, and the build reports one warning per such package (output channel, Problems panel, Result, counted in the warnings).
- A ready
.CPF next to a cycle is not used when the switch is off; a cycle that exists only as .CPF is an error naming package and file, and that package is skipped.
- The switch is remembered per workspace and per package; Select all and Select none don't change it; choosing another project resets it. A state saved by version 0.1.0 restores with every switch on.
- Single files keep their own Protected switch.
Machine backup: an update of the cycles (story 256377)
The section Machine backup builds an update for one machine from its backup and the checked out branch:
- Choose backup… opens a file dialog for a
.dsf (SINUMERIK ONE) or an old .arc series start-up backup (@@MMCIBN). The panel reads it without blocking and without changing it, and shows how many cycles it holds (.spf and .cpf), how many of them a package of the project lists (into the .arc and protected as .cpf), how many are built as single files (see below), warnings, and the cycles left out, only on the machine. An unknown or damaged backup shows its error and no counts. Clear forgets the backup.
- Build update writes into the output folder above, which is emptied first like for a build:
<backup name>_update.arc with all clear-text cycles, each with its header, and one .cpf per cycle of a protected package in the folder of its ;$PATH line. Open output folder opens it.
- Only the backup's cycle folder (
cma.dir, _N_CMA_DIR) counts. The sources are the project's content/Zyklen, never the backup.
- The branch decides the protection. When the machine has a cycle in the other form, the update builds it as the branch says and warns.
- Built as single files: a cycle that no package lists but that exactly one
.txt of content/Zyklen (outside Pakete) holds is built from it like a single file, header without ;PACKAGE:. The machine decides the kind: .spf goes into the .arc, .cpf through protector.exe, both when the machine has both. They are counted and listed apart, in the section and in the Result. Two .txt files with the name refuse the update.
- A cycle with neither a package nor a
.txt is never built or deleted; it is listed as left out in the section and in the Result.
- The same file listed by several packages is one cycle; two different files with the same name refuse the update.
- Build update is disabled without a project or backup, when no cycle of the backup is in a package or a single
.txt of the project, when the backup has errors, and when protected cycles (of packages or single files) are needed on a system other than Windows.
- An error or Cancel during the update removes every file it wrote: the output folder then holds no update, only the marker.
- The chosen backup is remembered per workspace and stays when you choose another project.
What a build writes
| Selected |
Output |
| Normal package |
<out>/Zyklen/Pakete/<Name>/<Name>.arc |
| Protected package |
<out>/Zyklen/Pakete/<Name>/<dir from ;$PATH>/<cycle>.cpf |
| Protected package, Protect off |
like a normal package, in clear text: <out>/Zyklen/Pakete/<Name>/<Name>.arc |
| Single file |
header with ;VERSION: <Variante>-<Patch> (no ;PACKAGE:), compressed: <out>/Zyklen/<same path>/<name>.arc |
| Single file, protected |
no header, compressed, line 1 commented out, protector.exe: <out>/Zyklen/<same folder>/<dir from ;$PATH>/<name>.cpf |
| Update from a machine backup |
clear-text cycles: <out>/<backup name>_update.arc; protected cycles: <out>/<dir from ;$PATH>/<cycle>.cpf |
- The cycles of an
.INF must be in the project's content/Zyklen; no NuGet package is used. A cycle that only the Common package has is an error naming package and file.
- Protected items need Windows.
protector.exe runs in a fresh, dot-free staging folder C:\BlohmNcStaging\local-build-<time>-<pid>, which is deleted after every build, also after an error or cancel.
- A selected item that can't be built (for example a package with a cycle that only the Common package has: a local build uses no NuGet package) is skipped and listed as an error with its reason; the other items are built and the result says Incomplete. Checks of the output folder, the assets and protector still refuse the whole build.
- protector runs without blocking VS Code (a hidden process, stopped after 120 s). Cancel stops a running protector call and no further item is built; the result then says that the output folder is incomplete.
Output folder safety
- Before a build or an update the output folder is emptied. A folder with the marker file
.blohm-nc-build (written by every build) is emptied without asking; any other non-empty folder only after you confirm.
- Refused, before anything is deleted: a drive root, the project folder or a folder above it, a folder in the project's
content/, Packages/, version/ or .git/, a folder that holds Git-tracked files.
- Inside a Git work tree the extension asks Git whether the folder holds tracked files, also when the path is typed in another case than on disk; the Git call does not block VS Code. If Git can't run, the build is refused with that message in the panel: install Git or choose an output folder outside the work tree.
bin-local should be in the project's .gitignore, so the output does not show up as untracked files.
Development
cd ../nc-build-tools && npm ci && cd ../blohm-nc-extension
npm ci
npm test # compiles nc-build-tools, unit, state, plan, manifest and asset hash tests
npm run release # writes blohm-nc-extension-<version>.vsix
npm run test:smoke # VS Code smoke test; opens a window, run by the pipeline
nc-build-tools is a file:../nc-build-tools dev dependency; esbuild bundles its library entry into out/extension.js, so the .vsix needs nothing else. The tests that run the fake protector are in nc-build-tools (npm run test:protector, run by the pipeline).
| |