New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reader Conditionals #1827
Comments
Right now lein completely ignores .cljc files (e.g., |
With Clojure 1.7 nearing release, this issue should be a priority. Reader conditional support is a huge boon for full stack clj/cljs developers, so it would be good to know that leiningen will be ready before 1.7 lands. |
Issues become prioritized when someone chooses to work on them. The best way to make sure something happens is to make it happen. |
(also Raynes/bultitude#28) |
Nice! Could we get some clojurescript users to try this out and leave feedback? |
@technomancy: there is one function that I have not updated to support cljc that probably needs to be updated, but I don't understand its purpose. I was hoping you could explain what It's only use is in the following function,
Is there a clojure compilation pattern that results in class files created in a subdirectory named after the compiling namespace? |
#1911 is ready for testing now. It's only somewhat relevant to Clojurescript users, it's most relevant to users who previously shared code between Clojurescript and Clojure using CLJX, particularly if they have shared tests or need AOT support. |
there is one function that I have not updated to support cljc that probably needs to be updated, but I don't understand its purpose. I was hoping you could explain what `source-in-project?`
This exists in order to support :clean-non-project-classes, which is a
workaround for a problem in the Clojure compiler where there is no way
to AOT-compile a class without compiling all the namespaces it requires.
So we need a way to know whether a given class in :target-path came from
a source file in the project or whether it came from the source of one
of its dependencies.
|
Thanks. I understand the reason to want to clean non-project class files, but I don't understand how the third clause of Is there a case I'm not familiar with where |
I see; sorry, I misread you.
I believe that clause is in there to support gen-class declarations
that live inside a namespace but not in the `ns` clause. Of course,
gen-class accepts any class name; it doesn't require it to be "under"
the namespace containing the gen-class call, so this is more of a
convention than anything else.
Anyway, I would call this a safety net for gen-class in projects where
you need more than one class generated for a given namespace; as long as
the generated class is directly "under" the namespace that generated it,
we won't delete it.
|
Thanks. I've updated the merge request to support this use case. |
Add support for reader conditional files (cljc) (#1827)
This is out in 2.5.2. I assume that if we don't hear too much about this not working, then this could be closed. |
Verified working for crossover code ported from cljx, including an extensive test suite. |
Stupid question, but what do I need to do exactly to get lein to recognise cljc files? I just renamed a bunch of cljx files to cljc and put them into a directory called cljc/myproject/*cljc I removed all the cljx plugin references from my project.clj file. I pulled the latest lein 2.5.2. Did a lein clean and then a lein test and got the compiler blowing up, complaining that it can't find the first of my cljc files. java.io.FileNotFoundException: Could not locate myproject/maths__init.class or myproject/maths.clj on classpath., compiling:(core.clj:1:1) Anything else I need to do? Is there a particular place lein is looking for the cljcs? |
@interstar is the |
Ah yes, that was it. (No cljc in :source_paths ). I presumably didn't need to explicitly state that when I was using the cljx plugin to put clj files into src so there was nothing explicit. Thanks |
This is working for me with lein 2.5.2. I suggest closing the issue. |
I've tested it to some extent myself with the same results, so I'll close this. Thanks for verifying. |
http://dev.clojure.org/display/design/Reader+Conditionals contains information about upcoming changes in Clojure (presumably 1.7). Right now, the only thing that's of importance seems to be supporting reading/compiling
.cljc
files.Enabling/disabling feature sets would only require the user to update the
:jvm-opts
, so there should be no issues there. However, merging these options would be messy (#878 might remedy this problem).The text was updated successfully, but these errors were encountered: