Skip to content

Fix regression: non-Clojure files (e.g. README.md) breaking compileClojure since 14.0.2#65

Merged
rpalcolea merged 1 commit into
mainfrom
compilation-enhancements
Jul 23, 2026
Merged

Fix regression: non-Clojure files (e.g. README.md) breaking compileClojure since 14.0.2#65
rpalcolea merged 1 commit into
mainfrom
compilation-enhancements

Conversation

@rpalcolea

Copy link
Copy Markdown
Member

Problem

Upgrading from 14.0.1 → 14.0.2 causes clojureCompile (and clojureTest/clojureRun/clojureDoc)
to fail on projects that have non-Clojure files (like a README.md) sitting inside their
src/<sourceSet>/clojure directory. This surfaced as a compilation error after a consumer
enabled configuration cache, though the plugin change itself was believed to be a no-op.

Root cause

14.0.2's "Support configuration cache" change (e590239) replaced set.clojure — a
SourceDirectorySet filtered to **/*.clj, **/*.cljs, **/*.cljc in
DefaultClojureSourceSet — with a plain project.file("src/${set.name}/clojure"), to avoid
serializing the SourceSet object graph into task state.

That raw File carries no filter. SourceDirectoryTask.getSource() converts it straight into
an unfiltered FileTree (objectFactory.fileCollection().from(srcDirs).asFileTree), so every
file under the source directory — including non-Clojure files — is now treated as compile
input.

Fix

Restore the **/*.clj, **/*.cljs, **/*.cljc filter, applied centrally in
SourceDirectoryTask.getSource() via .matching { include ... }. srcDirs itself stays as
plain File directories (still needed unfiltered for the Clojure classpath in
ClojureCompile/ClojureRun/ClojureTest/ClojureDoc), keeping the fix fully
configuration-cache-compatible.

  Config-cache support (14.0.2) replaced the filtered SourceDirectorySet
  (set.clojure, restricted to **/*.clj, **/*.cljs, **/*.cljc) with a raw
  project.file(src/.../clojure) to avoid serializing the SourceSet
  object graph. SourceDirectoryTask.getSource() then turned that
  directory into an unfiltered FileTree, so any non-Clojure file sitting
  in the source directory (e.g. a README.md) got passed to the Clojure
  compiler and broke the build.

  Restore the extension filter in SourceDirectoryTask.getSource() so
  only Clojure files are treated as compile/test/run/doc source, while
  keeping srcDirs as plain File objects for classpath purposes and
  configuration-cache compatibility.
@rpalcolea
rpalcolea force-pushed the compilation-enhancements branch from e26c42c to cc9ca97 Compare July 23, 2026 02:11
@rpalcolea
rpalcolea merged commit 82cb879 into main Jul 23, 2026
3 checks passed
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.

1 participant