Skip to content
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

Can't have Java code dependent on AOT'd Clojure code #180

Closed
nathanmarz opened this issue Feb 28, 2011 · 5 comments
Closed

Can't have Java code dependent on AOT'd Clojure code #180

nathanmarz opened this issue Feb 28, 2011 · 5 comments

Comments

@nathanmarz
Copy link

In a single project, you can't have a Java class use AOT'd Clojure code. This problem is exacerbated by the fact that a project can have dependencies going both ways between Clojure and Java, so you can't necessarily just change the order of compilation. It would be nice if both Clojure and Java somehow compiled together, or if there were some way to specify partial compilations (e.g., do these 4 Java classes, then all the Clojure, then the rest of the Java).

@kumarshantanu
Copy link
Collaborator

The way other build tools solve this problem is to split the project into modules and have dependencies between those modules. Every module compiles as a unit and together.

@technomancy
Copy link
Owner

I'm not likely to implement this myself, (projects that need even simplistic javac are edge cases) but if someone wants to take the initiative I can provide guidance. Alternatively arbitrarily complex multi-step compilation could be done easily in a plugin.

@nathanmarz
Copy link
Author

This might be a crazy idea, but what if leiningen compiled things in a loop? The compilation algorithm might look something like this:

  1. Compile all Java code followed by all Clojure code. Remember things that failed to compile
  2. If everything compiled, you're done
  3. Otherwise, go back to Step 1 and try compiling the things that failed on the last iteration

At some point, you'll reach a fixed point: either the set of things to compile doesn't change (failed compilation), or everything gets compiled (successful compilation).

This won't be as fast as explicit multi-step compilation, but it'll be easier to use.

@technomancy
Copy link
Owner

Interesting. I think it's got potential; probably worth experimenting with, either in a plugin or possibly in a branch.

@technomancy
Copy link
Owner

I think you can implement this in the master branch by tweaking the leiningen.core.eval/prep-tasks list. It won't let you do javac before and after Clojure AOT, but it'll let you swap the order. If you want to experiment with arbitrary ordering, probably best to begin in a plugin.

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

No branches or pull requests

3 participants