xujiaao / AARLinkSources

Attach sources for .aar dependencies in AndroidStudio.
140 stars 9 forks source link

Automatically download all available sources #4

Open jenzz opened 9 years ago

jenzz commented 9 years ago

Hi there!

This is a great plugin. Thanks! :smile: What do you think of an option to automatically download available sources for all dependencies?

You could enable it like this:

aarLinkSources {
   downloadAllSources = true
}
danielesegato commented 9 years ago

+1 for this feature

noproxy commented 9 years ago

I add this add build.gradle

apply plugin: 'aar-link-sources'

dependencies {
    aarLinkSources {
        downloadAllSources = true
    }
}

But produce error when syncing:

Error:(113, 0) Cannot convert the provided notation to an object of type Dependency: build_835xzdg018b0t9zzo5vt54ie5$_run_closure5_closure11@54e59ba1.
The following types/formats are supported:
  - Instances of Dependency.
  - String or CharSequence values, e.g. 'org.gradle:gradle-core:1.0'.
  - Maps, e.g. [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
  - FileCollections, e.g. files('some.jar', 'someOther.jar').
  - Projects, e.g. project(':some:project:path').
  - ClassPathNotation, e.g. gradleApi().

Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.

How can I handle it?

mikeholler commented 9 years ago

This would be awesome. Although I would argue that this plugin should try to do that by default, so that all you need to do is apply the plugin and everything comes down automatically.

@xujiaao thank you so much for this library, it is proving to be very useful

xujiaao commented 9 years ago

Sorry everybody, the Plugin dose not support the feature 'downloadAllSources' currently.

It is a good suggestion, but I do not know how to implement this feature now.... :(

Thank you for your advice.

aluxian commented 9 years ago

+1

@xujiaao Could you look through every entry in dependencies {} and when you find compile com.something:lib:1.0.0 do what aarLinkSources would have done if it had found aarLinkSources com.something:lib:1.0.0:sources@jar?

ChaitanyaPramod commented 9 years ago

I see that this has been done by #7 (if I understand it right) and it's merged to master already. Time to cut out a release?

WonderCsabo commented 9 years ago

I agree. But this issue should be closed nevertheless.

BTW, you can easily build and install the plugin from source then use it. Clone the repo, then gradlew install. After, add this to your build.gradle

buildscript {
    repositories {
        mavenLocal()
       // etc
    }
    dependencies {
        classpath 'AARLinkSources:plugin:unspecified' // just installed to local repo
        // etc
    }
}
damonliuchn commented 9 years ago

What do you think of an default option to automatically link the available source and doc ?Don't need add "aarLinkSources 'xxxxxsources@jar' "

WonderCsabo commented 9 years ago

@MasonLiuChn i already implemented that.