Mobbeel / fataar-gradle-plugin

Gradle plugin to help embed dependencies in generated AAR artifact
https://plugins.gradle.org/plugin/com.mobbeel.plugin
Apache License 2.0
342 stars 44 forks source link

Support for local external dependencies #18

Open jonbryantnz opened 5 years ago

jonbryantnz commented 5 years ago

Hello,

Summary aar libraries that are stored locally in the projects libs directory and are referenced as dependent aren't packaged in the final aar.

Example If we reference a local aar library directly within the build.gradle files dependencies:

dependencies {
    api (name: 'example-native-local-lib', ext: 'aar')
}

And within the sample file structure we have the below file: example-lib/libs/example-native-local-lib.aar

This library isn't included in the built aar.

Code When the analyzeDependencies() method within CopyDependenciesTask.groovy detects an external dependency, it expects the dependant libraries path to be found at the following location: <gradleUserHomeDir>/caches/modules-2/files-2.1/

This is fine if the dependency has been downloaded from an external repository however this isn't always the case (as demonstrated in the above example).

Thanks, Jon

oscarcpozas commented 5 years ago

Hey @TomTasche,

Yep, you are right. Right now, I assume the same location for all dependencies because I can't find a correct way to determine if an artifact is from dependency manager (downloaded from internet) or it's stored locally on any location. Any suggestion?

jonbryantnz commented 5 years ago

Hello @oscarcpozas ,

I've added a pull request for this issue.
I can't find a method in gradle that allows us to find automatically the dependency path.
What I ended up using was a trial and error approach. For example, try path A, if it doesn't exist, then try path B.

Regards, Jon

PS Thanks again for this plugin!

oscarcpozas commented 5 years ago

https://github.com/Mobbeel/fataar-gradle-plugin/pull/20#issuecomment-454016706