Open ruleant opened 10 years ago
Thanks @ruleant. I'll try to look into this during this week, but I wonder if it would not be better to invest some efforts in updating http://mvnrepository.com/artifact/com.google.android/android instead.
Ref:
Good point, @gildegoma
There are a few options to support building against recent android sdk with maven (some of them less likely to happen) :
I'm a bit busy this week due to LinuxTag, but I'd like to help where I can afterwards.
I have been in talks with the Google SDK team about pushing to Central since Android 1.5 days.... due to legal problems this is not going to happen. The Maven repo as part of the SDK is the best compromise that could be found. The Maven Android SDK Deployer I wrote installs it to a local Maven repo (and a lot of other jars from the SDK) and can be used to deploy it to a repository manager like Sonatype Nexus as well.
I am also involved in the Android4Maven project that recompiled AOSP in the past and pushed it to central but have run out of time doing that work. Maybe Robert Manning on the project could do it. He has been doing most of the leg work.
For most people the deployer is okay to use..
Also @ruleant keep in mind that the deployer also takes jars and other libraries from the SDK and makes them available to users that are NOT open source and will therefore never be available outside the SDK. As such using the deployer and integrating it some way is definitely going to have benefits for users. If you need any changes or so .. just ping me.
Thanks a lot @mosabua for the meaningful precisions.
@ruleant I won't have time to work on this next week. Feel free to submit pull request if you can/want. Otherwise be sure that I'll ping you guys to review this when I come to work on it.
@ruleant hopefully I can find some extra time today to work on this, so please keep watching.
Let me know if you need some help to test it.
The extra-google-m2repository
and extra-android-m2repository
SDK components creates local Maven repositories in these two locations for exactly this purpose:
$ANDROID_HOME/extras/google/m2repository
$ANDROID_HOME/extras/android/m2repository
I believe this is what the Gradle build system uses. Is there a way to make Maven builds also use these two repositories? I would have been nice if maven-android-plugin supported this.
Also see https://groups.google.com/forum/#!topic/maven-android-developers/EHnBh2XueiY - there is a suggestion that it may be possible by adding these repositories to ~/.m2/settings.xml
.
I'm not using Maven myself anymore, so I haven't tested any of this.
The cleaner solution is to copy these into the users local repository or the repository manager. That is exactly what the Maven Android SDK Deployer does.
Also these two repos only contain a small subset of what people actually need.
Ok, I see it only has the play services and support libraries. I was under the impression that it contained more (e.g. the Android platform jars as well). In that case I guess the Maven Android SDK Deployer is the best solution for Maven projects (and possibly some Gradle projects).
@gildegoma I'm trying to understand the code (and I'm new to Chef). It seems that files/default/android-update-sdk
is called in https://github.com/gildegoma/chef-android-sdk/blob/master/recipes/default.rb#L150, but I don't see any arguments being passed (fe. --components or --licenses), so this script would install all remaining SDK components because $COMPONENTS is not defined? Or am I missing something?
Anyway, is it a good idea to call maven-android-sdk-deployer in a similar way as in the section starting in node['android-sdk']['components'].each do |sdk_component|
on line 112
but with spawn mvn -pl platforms/#{sdk_component}
on line 121 or something similar (needs some work)? What do you think?
Hi guys, thanks for all the recent feedbacks.
@ruleant Sorry for missing my deadline of yesterday, but I am about to push something within the next hour. I'll try to answer your questions at the same time... stay tuned, as your review will be required!
I pushed a first cut, still full of ugly TODO/FIXME markers, but I think it will help us to follow the discussion. I also put some additional github comments directly on 566d5f0 (some specially addressed to @mosabua, hoping it does not bother you).
@joshk The idea is to finalize together this milestone 0.2.0 and then pull it downstream into travis-cookbooks for the next VM update.
@danielpassos I also added a Vagrantfile, for people who want to easily start to test this cookbook stuff.
@ruleant back to your questions:
https://github.com/gildegoma/chef-android-sdk/blob/master/recipes/default.rb#L150 is used to copy the helper scripts to the target machine. We'll add one more for the emulator wait (see #16), and I also I think that we might add some wrapper script(s) for this Maven Android SDK deployer stuff.
As you can see in https://github.com/gildegoma/chef-android-sdk/blob/566d5f077472c3f0e51b5eea556e9423e073e4c0/recipes/maven-rescue.rb#L27-L37, I currently opted for a --fail-never
KISS approach. The optimal solution would be to map for each node['android-sdk']['components']
items the corresponding maven subproject target. I quickly looked and it seemed that it was not obvious with the current state.
With such mapping, we'll also be able to (re-)populate the maven local repository when installing new sdk components, which will be quite nice to integrate into Travis CI builder.
I won't be able to work on this until middle of next week, but feel free to bring ideas or even pull requests :)
@gildegoma I created a pull request to loop over the android sdk components (and convert to the current project structure of maven-android-sdk-deployer)
@ruleant thanks a lot, I put it in my queue (but I cannot give any ETA yet, sorry).
Hi @gildegoma any progress on or in your roadmap still working on it?
@danielpassos No, no progress. At the moment it is not on my roadmap of personal needs, but I keep the issue open since its value is quite evident to me.
Actually, the relieving step would be to resolve the https://github.com/simpligility/maven-android-sdk-deployer/issues/236 prerequisite. Help is welcome!
As discussed in https://github.com/travis-ci/travis-ci/issues/1395#issuecomment-41911519 : Android SDK Jar files > 4.1.1.4 are not available in maven central. A workaround is to install those jar files from the SDK to the local maven repo ~/.m2/repository/
Project maven android sdk deployer does exactly this.
Fe. to install android-19 jar files, go up the directory tree :
Maybe @mosabua can shed a light on a way to integrate his tool and use the same component filter used when installing the android components with
android update sdk --filter tools,platform-tools,build-tools-19.0.3,android-19