Make classifiers and types accessible via the dependency graph


(spy99) #1

My in opnion, gradle does a reasonable job of supporting consuming maven artifacts, but a TERRIBLE job with publishing artifacts. This is more than obvious when googling for maven publisher helpers for gradle. I even contributed to one ( https://github.com/chrisdoyle/gradle-fury ). This is also evident by the amount of 3rd party repositories that have popped up recently that require you sure share your private key with them, which is just stupid.

Moving forward, one of the biggest issues I ran into was being able to figure out and specify the “type” (solved), “scope” (kind of solved) and the classifier (such as release,debug, etc, not resolved) from a given project/module. I can walk the tree of dependencies using the following snippet

    configurations[configurationName].allDependencies.each { dependency ->

however there’s no way for me to identify what the classifier is, such as release, debug, or some other flavor. It would be specified in a gradle build script like this (the ‘release’ part is what I’m after)

    compile "org.osmdroid:osmdroid-android:5.5:release@aar"

Pretty much the only option I have would be to open the gradle scripts and parse them myself. Again, the classifier is not accessible. Please fix this!

Also, making the type accessible (aar in the above example) would also be super useful. I currently have to rely on string matching to get the best match for whatever the type is. Here’s the snippet that is a best effort for resolving the type.

   configurations.findAll { set ->
          set.each { config ->
             // System.out.println(config.name)
              if (config.name.contains(d.artifactId)){
                  String extension=config.name.substring(config.name.lastIndexOf(".")+1);
                  d.type=extension;
              }
          }
      }
```
Anyhow, please, please make this information accessible.