Open laurentpetit opened 8 years ago
Thing is, local repositories are merged at the plugin-initialization level. I might either move it to middleware, or provide an exclusive lein droid classpath
command just for this purpose.
It would really be better to move it to the middleware, so its use will be pervasive whatever lein command is called after that.
Having lein droid classpath
would plut lein-droid in an island, forcing a special case for tooling wanting to get classpath information from arbitrary leiningen project.
Just afair middlewares in lein-droid are badly implemented, at least they were three years ago. Gotta take another look.
@laurentpetit I fixed this bug, and just accidentally pushed 0.4.0
:D. Hopefully nothing got broken there. Waiting for your affirmation.
Will test it ASAP, thanks!
2015-08-21 1:05 GMT+02:00 Alexander Yakushev notifications@github.com:
@laurentpetit https://github.com/laurentpetit I fixed this bug, and just accidentally pushed 0.4.0 :D. Hopefully nothing got broken there. Waiting for your affirmation.
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133207518 .
Laurent Petit
It's better than before: leiningen can now give a classpath to CCW. But it seems that the classpath is incomplete. In the hello world example, the SplashActivity java class complains there's no android.* stuff on the classpath.
Here's what I get when doing lein classpath: lein classpath (Warning: profile :android-common not found.) (Warning: profile :android-user not found.) /Users/laurentpetit/tmp test/myccwapp/test:/Users/laurentpetit/tmp test/myccwapp/src/clojure:/Users/laurentpetit/tmp test/myccwapp/src:/Users/laurentpetit/tmp test/myccwapp/resources:/Users/laurentpetit/tmp test/myccwapp/target/debug/classes:/Users/laurentpetit/.m2/repository/org/clojure-android/clojure/1.7.0/clojure-1.7.0.jar:/Users/laurentpetit/.m2/repository/neko/neko/4.0.0-alpha2/neko-4.0.0-alpha2.jar:/Users/laurentpetit/.m2/repository/org/clojure/tools.nrepl/0.2.10/tools.nrepl-0.2.10.jar:/Users/laurentpetit/.m2/repository/org/clojure/clojure/1.2.0/clojure-1.2.0.jar
2015-08-21 13:44 GMT+02:00 Laurent PETIT laurent.petit@gmail.com:
Will test it ASAP, thanks!
2015-08-21 1:05 GMT+02:00 Alexander Yakushev notifications@github.com:
@laurentpetit https://github.com/laurentpetit I fixed this bug, and just accidentally pushed 0.4.0 :D. Hopefully nothing got broken there. Waiting for your affirmation.
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133207518 .
Laurent Petit
Laurent Petit
I only moved the repositories to middleware. What exactly are you trying to do, get a full classpath, or something more?
Additional dependencies are merged into project (and end up on classpath eventually) in different hooks at different points of time. I'm not sure all of those can be moved to middleware, so I have to know what exactly you are trying to achieve.
I am trying to get a full classpath to give that to Eclipse.
So I'm doing basically lein classpath
2015-08-21 15:30 GMT+02:00 Alexander Yakushev notifications@github.com:
I only moved the repositories to middleware. What exactly are you trying to do, get a full classpath, or something more?
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133425603 .
Laurent Petit
Will lein droid classpath
do if it exists?
I fear not, because it's not a generic solution :-(
2015-08-21 15:34 GMT+02:00 Alexander Yakushev notifications@github.com:
Will lein droid classpath do if it exists?
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133426153 .
Laurent Petit
There's not much generic in lein-droid
, it's a separate build system rather than a plugin. It doesn't use any of the usual leiningen commands, like lein compile
or lein jar
. So it depends how "generic" you really expect it to be.
Currently, CCW embeds leiningen, gets the project map from it, and calls leiningen.core.classpath/resolve-dependencies with dependency keys and the project map.
Couldn't the droid plugin/middleware enhance the project map with the relevant information, so that after that point every lein command works as expected?
2015-08-21 15:44 GMT+02:00 Alexander Yakushev notifications@github.com:
There's not much generic in lein-droid, it's a separate build system rather than a plugin. It doesn't use none of the usual leiningen commands, like lein compile or lein jar. So it depends how "generic" you really expect it to be.
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133428149 .
Laurent Petit
The point here is that most lein commands don't make sense in context of Android, and many lein-droid commands don't have Leiningen counterparts. And those commands that match semantically, they involve more than just updating the project map, they have different code inside.
If CCW calls leiningen.core.classpath/resolve-dependencies
, then it will be enough for it to first call (leiningen.droid.classpath/init-hooks)
, and extra dependencies and classpath will be there. But the question is, again, what are you going to achieve once you have the classpath? All other actions have to run through lein-droid anyway.
To answer your question first: once I have the classpath, Eclipse is happy. The java parts of the project don't show up as error markers anymore. The user can browse the java classes of Android. Basically every static bit of Eclipse / CCW works again.
So do I understand well that the "fix" for having things to work with lein-droid 0.4.0 is just to first (require 'leiningen.droid.classpath), then call its init-hooks method?
2015-08-21 17:25 GMT+02:00 Alexander Yakushev notifications@github.com:
The point here is that most lein commands don't make sense in context of Android, and many lein-droid commands don't have Leiningen counterparts. And those commands that match semantically, they involve more than just updating the project map, they have different code inside.
If CCW calls leiningen.core.classpath/resolve-dependencies, then it will be enough for it to first call (leiningen.droid.classpath/init-hooks), and extra dependencies and classpath will be there. But the question is, again, what are you going to achieve once you have the classpath? All other actions have to run through lein-droid anyway.
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133462390 .
Laurent Petit
Yes, that would be the easy way to make it work. If it doesn't,I'll think of something else.
Also, I suggest to bump to 0.4.1, fixed a subtle bug there.
On Fri, Aug 21, 2015, 19:38 Laurent Petit notifications@github.com wrote:
To answer your question first: once I have the classpath, Eclipse is happy. The java parts of the project don't show up as error markers anymore. The user can browse the java classes of Android. Basically every static bit of Eclipse / CCW works again.
So do I understand well that the "fix" for having things to work with lein-droid 0.4.0 is just to first (require 'leiningen.droid.classpath), then call its init-hooks method?
2015-08-21 17:25 GMT+02:00 Alexander Yakushev notifications@github.com:
The point here is that most lein commands don't make sense in context of Android, and many lein-droid commands don't have Leiningen counterparts. And those commands that match semantically, they involve more than just updating the project map, they have different code inside.
If CCW calls leiningen.core.classpath/resolve-dependencies, then it will be enough for it to first call (leiningen.droid.classpath/init-hooks), and extra dependencies and classpath will be there. But the question is, again, what are you going to achieve once you have the classpath? All other actions have to run through lein-droid anyway.
— Reply to this email directly or view it on GitHub < https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133462390
.
Laurent Petit
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133486238 .
Unfortunately, it doesn't work
2015-08-21 19:04 GMT+02:00 Alexander Yakushev notifications@github.com:
Yes, that would be the easy way to make it work. If it doesn't,I'll think of something else.
Also, I suggest to bump to 0.4.1, fixed a subtle bug there.
On Fri, Aug 21, 2015, 19:38 Laurent Petit notifications@github.com wrote:
To answer your question first: once I have the classpath, Eclipse is happy. The java parts of the project don't show up as error markers anymore. The user can browse the java classes of Android. Basically every static bit of Eclipse / CCW works again.
So do I understand well that the "fix" for having things to work with lein-droid 0.4.0 is just to first (require 'leiningen.droid.classpath), then call its init-hooks method?
2015-08-21 17:25 GMT+02:00 Alexander Yakushev <notifications@github.com :
The point here is that most lein commands don't make sense in context of Android, and many lein-droid commands don't have Leiningen counterparts. And those commands that match semantically, they involve more than just updating the project map, they have different code inside.
If CCW calls leiningen.core.classpath/resolve-dependencies, then it will be enough for it to first call (leiningen.droid.classpath/init-hooks), and extra dependencies and classpath will be there. But the question is, again, what are you going to achieve once you have the classpath? All other actions have to run through lein-droid anyway.
— Reply to this email directly or view it on GitHub <
https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133462390
.
Laurent Petit
— Reply to this email directly or view it on GitHub < https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133486238
.
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-133496058 .
Laurent Petit
It's weird that it doesn't. But there is in fact no other way around this. Leiningen doesn't support putting extra stuff on classpath, so I have to hack the get-classpath function to do that. Those hooks are your only option.
OK, thanks for having explored the possibilities! I'll try to find a work-around on the CCW side. Cheers
2015-08-24 18:20 GMT+02:00 Alexander Yakushev notifications@github.com:
It's weird that it doesn't. But there is in fact no other way around this. Leiningen doesn't support putting extra stuff on classpath, so I have to hack the get-classpath function to do that. So those hooks are your only option.
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-134281791 .
Laurent Petit
Actually, you should try out 0.4.2
. I hail Mary moved the hook initialization to middleware, and now lein classpath
called from the shell has all the necessary artifacts. Maybe this will work for you as well.
@laurentpetit: Bump. All Leiningen commands see the new classpath now, so I will be really grateful if you check whether that works in your case too. Current version is 0.4.3
.
OK, will do ASAP ! Thanks !
2015-09-02 9:00 GMT+02:00 Alexander Yakushev notifications@github.com:
@laurentpetit https://github.com/laurentpetit: Bump. All Leiningen commands see the new classpath now, so I will be really grateful if you check whether that works in your case too. Current version is 0.4.3.
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-136956395 .
Laurent Petit
So, I tried with the following project.clj (see at the end), with lein-droid 0.4.3. The Android jars are still not on the classpath, making it impossible to compile java files depending on e.g. android.app.Activity. Also, in Eclipse/CCW, the SplashActivity java file is full of red marks, since the classpath is incomplete.
Doing lein classpath on the command line also doesn't show android jars.
The project.clj file I used:
(defproject myccwapp/myccwapp "0.1.0-SNAPSHOT" :description "FIXME: Android project description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"}
:global-vars {warn-on-reflection true}
:source-paths ["src/clojure" "src"] :java-source-paths ["src/java"] :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"] :plugins [[lein-droid "0.4.3"]]
:dependencies [[org.clojure-android/clojure "1.7.0" :use-resources true] [neko/neko "4.0.0-alpha2"]] :profiles {:default [:dev]
:dev
[:android-common :android-user
{:dependencies [[org.clojure/tools.nrepl "0.2.10"]]
:target-path "target/debug"
:android {:aot :all-with-unused
:rename-manifest-package "com.myapp.debug"
:manifest-options {:app-name "myccwapp (debug)"}}}]
:release
[:android-common
{:target-path "target/release"
:android
{;; :keystore-path "/home/user/.android/private.keystore"
;; :key-alias "mykeyalias"
;; :sigalg "MD5withRSA"
:ignore-log-priority [:debug :verbose]
:aot :all
:build-type :release}}]}
:android {;; Specify the path to the Android SDK directory. :sdk-path "/Users/laurentpetit/android-sdk-macosx/"
;; Try increasing this value if dexer fails with
;; OutOfMemoryException. Set the value according to your
;; available RAM.
:dex-opts ["-JXmx4096M" "--incremental"]
:target-version "19"
:aot-exclude-ns ["clojure.parallel" "clojure.core.reducers"
"cider.nrepl" "cider-nrepl.plugin"
"cider.nrepl.middleware.util.java.parser"
#"cljs-tooling\..+"]})
2015-09-02 9:37 GMT+02:00 Laurent PETIT laurent.petit@gmail.com:
OK, will do ASAP ! Thanks !
2015-09-02 9:00 GMT+02:00 Alexander Yakushev notifications@github.com:
@laurentpetit https://github.com/laurentpetit: Bump. All Leiningen commands see the new classpath now, so I will be really grateful if you check whether that works in your case too. Current version is 0.4.3.
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-136956395 .
Laurent Petit
Laurent Petit
Try doing lein classpath
in a sample project, or in a newly created project. It works correctly for both on my machine.
Indeed Alexander,
so now it's back to a CCW issue, I'll deal with it, thanks !
2015-09-05 13:07 GMT+02:00 Alexander Yakushev notifications@github.com:
Try doing `lein classpath
— Reply to this email directly or view it on GitHub https://github.com/clojure-android/lein-droid/issues/131#issuecomment-137943528 .
Laurent Petit
No problem. I don't know why it doesn't work correctly with your current project (which I assume is quite empty), but the case is quite marginal, so let's call it a non-matter unless it surfaces again.
Trying to get the classpath from leiningen via
lein classpath
gives the following problem (it's as if the m2repository was not added to the project repositories):Also, trying to get the deps tree from leiningen via
lein deps :tree
gives a similar problem:Finally, trying a last resort solution, e.g. calling
lein repl
so that hopefully I could try to get the classpath from(System/getProperty "java.class.path")
won't work either (same problem).So I'm having a hard time figuring out how I can get the project classpath from Leiningen so that CCW in Eclipse can correctly set up the java build path.
Starting the discussion about it. The goal would be to find a way to get the classpath from leiningen via the classic methods.