Hi Jeffrey,
Unfortunately no, I didn't find any good way. What I'm having now is two
branches, one "develop" for fast and easy development that has all
dependencies as sources
dependencies {
compile project(':internalLibraryA')
compile project(':internalLibraryB')
}
and another "release" that has dependencies as jars and looks like this
ext.includeLibsFolder = 'libs-include'
dependencies {
compile fileTree(dir: includeLibsFolder, include: '*.jar')
includeLibs 'internalLibraryA:0.0.1'
includeLibs 'internalLibraryB:0.0.1'
}
task copyLibs(type: Copy, dependsOn: 'cleanLibs') {
from configurations.includeLibs
into includeLibsFolder
}
task cleanLibs(type: Delete) {
delete includeLibsFolder
}
When I ready to release my aar library, I compile all dependencies
(internalLibraryA and internalLibraryB) and push it to the repository
(Archiva in my case). Then checkout "release", copy libs to
includeLibsFolder (gradle copyLibs), then build the library with all sub
libraries included and obfuscated if needed.
Not the fastest solution, but does what I need. Let me know if you'll find
a better solution.
Pavel
On Wed, Feb 4, 2015 at 4:53 PM, Jeffrey Decker <[email protected]>
wrote:
> Hi Pavel,
>
> Have you found any good way of doing this? More specifically I'm looking
> to include all dependencies for my android library project in the
> classes.jar, do you know if this is possible. I've set this up to work in
> ant but have yet to find any way of doing the same with gradle.
>
> Thanks,
> Jeffrey
>
> On Tuesday, September 2, 2014 at 2:26:54 PM UTC-7, Pavel Dolgov wrote:
>>
>> Thank you for the reply! But with such an approach resulting
>> LibraryProject.aar will not have all dependencies packaged, unless I'm
>> missing something.
>> What I'm doing right now is manually adding compiled classes to libs
>> before packageLibrary task. Works in my particular case, but obviously
>> ugly, looks like a hack does not work with resources, manifests and etc.
>> What is the better gradle/android-library way?
>>
>> android.libraryVariants.all { variant ->
>>
>> Action copyClassesAction = new Action() {
>> @Override
>> void execute(Object o) {
>>
>> String variantLibsDir = getBuildDir().absolutePath +
>> "/intermediates/bundles/" + variant.name + "/libs"
>> String explodedDir = getBuildDir().absolutePath +
>> "/intermediates/exploded-aar/library-project/"
>> String[] dirs = new File(explodedDir).list()
>> for (int i = 0; i < dirs.length; i++) {
>> File source = new File(explodedDir + dirs[i] +
>> "/unspecified/classes.jar")
>> File destination = new File(variantLibsDir + "/" +
>> dirs[i] + ".jar")
>> destination.bytes = source.bytes
>> }
>> }
>> }
>> variant.packageLibrary.doFirst(copyClassesAction)
>> }
>>
>> On Monday, September 1, 2014 9:03:17 AM UTC-4, William Ferguson wrote:
>>>
>>> As an AAR artifact deployed to your artifact repository with a POM that
>>> lists the 3 libraries as dependencies.
>>>
>>> William
>>>
>>> On Thursday, August 28, 2014 10:45:19 AM UTC+10, Pavel Dolgov wrote:
>>>>
>>>> I have a library project with dependencies like:
>>>>
>>>> LibraryProject
>>>> --\LibraryA
>>>> --\LibraryB
>>>> --\LibraryC
>>>>
>>>> What I want to achieve is a LibraryProject.aar with all dependencies
>>>> compiled and included, so when used in an application, there is no need to
>>>> add any dependencies for LibraryA, LibraryB and LibraryC. What is the best
>>>> way to achieve the goal? Thanks.
>>>>
>>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "adt-dev" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/adt-dev/Zh_2NOUQevo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
Best Regards,
Pavel Dolgov
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.