Skip to content

COMP: Shorten Windows build root to stay under ITK path limit#128

Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
hjmjohnson:fix-windows-long-path
Apr 15, 2026
Merged

COMP: Shorten Windows build root to stay under ITK path limit#128
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
hjmjohnson:fix-windows-long-path

Conversation

@hjmjohnson
Copy link
Copy Markdown
Member

@hjmjohnson hjmjohnson commented Apr 14, 2026

Shorten the build directory path on Windows using a directory junction instead of bypassing ITK's path length validation. The repo name is stripped of its "ITK" prefix and truncated to 12 characters, then a junction provides a short root for all build directories.

How it works
  1. Compute short name (bash, all platforms): ITKFixedPointInverseDisplacementField → strip ITK → truncate to 12 → FixedPointIn
  2. Create junction (pwsh, Windows only): D:\FixedPointInD:\a\ITKFixedPointInverseDisplacementField
  3. Use ITK_BUILD_ROOT env var in all subsequent steps (Download ITK, Build ITK, Configure CTest)
  4. On Linux/macOS, ITK_BUILD_ROOT is just the real workspace parent (no junction needed)

Path math: D:\FixedPointIn\ITK-build = 26 chars (well under the 50-char limit).

Why not ITK_SKIP_PATH_LENGTH_CHECKS?

The previous approach disabled ITK's path validation entirely. This approach keeps the safety check active — if a path is genuinely too long even after shortening, ITK will still catch it at configure time.

Instead of unconditionally skipping ITK's path length checks, shorten
the build directory path on Windows using a directory junction. The
repo name is stripped of its "ITK" prefix and truncated to 12 characters
(e.g. ITKFixedPointInverseDisplacementField → FixedPointIn), then a
junction D:\<short> → D:\a\<full-repo-name> provides a short root for
ITK clone, build, and CTest dashboard directories.

This keeps ITK's 50-character path validation active as a safety check
while ensuring long-named remote module repos can build on Windows CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hjmjohnson hjmjohnson force-pushed the fix-windows-long-path branch from 2e1b922 to 8d8b425 Compare April 15, 2026 00:17
@hjmjohnson hjmjohnson changed the title COMP: Skip ITK path length checks on Windows CI COMP: Shorten Windows build root to stay under ITK path limit Apr 15, 2026
@hjmjohnson hjmjohnson requested review from dzenanz and thewtex April 15, 2026 02:05
Copy link
Copy Markdown
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this solution. Have you tested it on any remote module other than FixedPointInverseDisplacementField?

@hjmjohnson hjmjohnson merged commit bc8b850 into InsightSoftwareConsortium:main Apr 15, 2026
1 check passed
@hjmjohnson
Copy link
Copy Markdown
Member Author

@dzenanz That was the only one that had a long enough name to cause the issue. This only affects CI dashboards where only 1 item is built at at ime so thare should be no errors.

@dzenanz
Copy link
Copy Markdown
Member

dzenanz commented Apr 15, 2026

We changed the name of MorphologicalContourInterpolation for this reason some time ago.

@dzenanz
Copy link
Copy Markdown
Member

dzenanz commented Apr 15, 2026

Also, I meant does this affect negatively other modules with short names, such as e.g. Montage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants