Most of my projects using cljx end up with a configuration similar to:
:source-paths ["src" "target/generated-src"]
:test-paths ["test" "target/generated-test"]
:cljsbuild {:builds [{:source-paths ["src" "target/generated-src"]}]}
:cljx {:builds [{:source-paths ["src"]
:output-path "target/generated-src"
:rules :clj}
{:source-paths ["src"]
:output-path "target/generated-src"
:rules :cljs}
{:source-paths ["test"]
:output-path "target/generated-test"
:rules :clj}
{:source-paths ["test"]
:output-path "target/generated-test"
:rules :cljs}]}
Note that the cljx configuration has some implications on source-paths, test-paths and cljsbuild.
Most of it could be deduced and injected at run time (by a leiningen plugin). The configuration could be simplified down to:
:cljx {:builds [{:source-paths ["src" "test"]
:output-path "target/generated-%"
:rules [:clj :cljs]}]}
This is similar to this proposition for clojurescript.test.
The whole configuration could be omitted with some default:
source-paths is the concatenation of source-paths and test-paths
output-path has some default
rules defaults to [:clj :cljs]
Now this is probably too much (and assumes cljx files are in the same directory structures than clj files, which I usually do).
Most of my projects using cljx end up with a configuration similar to:
Note that the
cljxconfiguration has some implications onsource-paths,test-pathsandcljsbuild.Most of it could be deduced and injected at run time (by a leiningen plugin). The configuration could be simplified down to:
:cljx {:builds [{:source-paths ["src" "test"] :output-path "target/generated-%" :rules [:clj :cljs]}]}This is similar to this proposition for
clojurescript.test.The whole configuration could be omitted with some default:
source-pathsis the concatenation ofsource-pathsandtest-pathsoutput-pathhas some defaultrulesdefaults to[:clj :cljs]Now this is probably too much (and assumes
cljxfiles are in the same directory structures thancljfiles, which I usually do).