Skip to content

Commit 1aa5cf6

Browse files
gnodetclaude
andcommitted
Revert gulpfile changes (moved to PR #22292)
The ENOENT race condition fix for the docs gulp build belongs in PR #22292 (fix/docs-gulp-race-condition), not in this PR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 31d3ec7 commit 1aa5cf6

1 file changed

Lines changed: 3 additions & 40 deletions

File tree

docs/gulpfile.js

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ const sources = {
206206
'../core/camel-base/src/main/docs/!(*-component|*-language|*-dataformat|*-summary).adoc',
207207
'../core/camel-main/src/main/docs/!(*-component|*-language|*-dataformat|*-summary).adoc',
208208
'../components/{*,*/*}/src/main/docs/!(*-component|*-language|*-dataformat|*-summary).adoc',
209-
'../dsl/src/main/docs/!(*-component|*-language|*-dataformat|*-summary).adoc',
210-
'../dsl/{*,*/*}/src/main/docs/!(*-component|*-language|*-dataformat|*-summary).adoc',
209+
'../dsl/**/src/main/docs/!(*-component|*-language|*-dataformat|*-summary).adoc',
211210
],
212211
destination: 'components/modules/others/pages',
213212
keep: [
@@ -315,37 +314,6 @@ const tasks = Array.from(sourcesMap).flatMap(([type, definition]) => {
315314
})
316315
}
317316

318-
// Wraps gulp.src to gracefully handle ENOENT from ephemeral directories
319-
// (e.g. .camel-jbang/work created/deleted by tests running in parallel).
320-
// We pipe through a passthrough transform so that on ENOENT we can
321-
// cleanly end() the passthrough, which properly signals downstream
322-
// pipes to finish. Direct error handling on gulp.src() doesn't work
323-
// because Node.js .pipe() does not propagate errors or end signals.
324-
const ignorePatterns = ['**/target/**', '**/.camel-jbang/**']
325-
const resilientSrc = (source, options) => {
326-
const src = gulp.src(source, options)
327-
const passthrough = through2.obj(function (file, enc, done) {
328-
done(null, file)
329-
})
330-
src.on('error', function (err) {
331-
if (err.code === 'ENOENT') {
332-
// Don't end passthrough — the source may continue with remaining files.
333-
// If it stops, the 'close' handler below will clean up.
334-
console.error(`⚠️ ENOENT (skipped): ${err.path || err.message}`)
335-
} else {
336-
passthrough.destroy(err)
337-
}
338-
})
339-
// If the source closes without emitting 'end' (e.g. after an error),
340-
// ensure the passthrough ends so downstream tasks don't hang.
341-
src.on('close', function () {
342-
if (!passthrough.writableEnded) {
343-
passthrough.end()
344-
}
345-
})
346-
return src.pipe(passthrough)
347-
}
348-
349317
// creates symlinks from source to destination that satisfy the
350318
// given filter removing the basedir from a path, i.e. symlinking
351319
// from a flat hiearchy
@@ -358,12 +326,10 @@ const tasks = Array.from(sourcesMap).flatMap(([type, definition]) => {
358326
}
359327
})
360328

361-
let fileCount = 0
362-
return resilientSrc(source, { ignore: ignorePatterns, allowEmpty: true })
329+
return gulp.src(source, { ignore: ['**/target/**'] })
363330
.pipe(filterFn)
364331
.pipe(
365332
map((file, done) => {
366-
fileCount++
367333
// this flattens the output to just .../pages/.../file.ext
368334
// instead of .../pages/camel-.../src/main/docs/.../file.ext
369335
file.base = path.dirname(file.path)
@@ -373,9 +339,6 @@ const tasks = Array.from(sourcesMap).flatMap(([type, definition]) => {
373339
.pipe(gulp.symlink(destination, {
374340
relativeSymlinks: true,
375341
}))
376-
.on('end', () => {
377-
console.log(` → symlinked ${fileCount} files to ${destination}`)
378-
})
379342
}
380343

381344
// generates sorted & grouped nav.adoc file from a set of .adoc
@@ -446,7 +409,7 @@ const tasks = Array.from(sourcesMap).flatMap(([type, definition]) => {
446409
return done()
447410
}
448411

449-
return resilientSrc(source, { ignore: ignorePatterns, allowEmpty: true }) // asciidoc files
412+
return gulp.src(source, { ignore: ['**/target/**'] }) // asciidoc files
450413
.pipe(through2.obj(extractExamples)) // extracted example files
451414
// symlink links from a fixed directory, i.e. we could link to
452415
// the example files from `destination`, that would not work for

0 commit comments

Comments
 (0)