title: Get BuildType VersionName for ArtifactoryPublication
body: <p>I am using the following gradle to create a snapshot build type with a filename including the current commit hash and "SNAPSHOT" as suffix:</p>
  
  <pre><code>def libraryGroupId = 'my.group.id'
  def libraryVersion = '1.7.2'
  def libraryArtifactId = 'core'
  
  android {
      defaultConfig {
          versionName libraryVersion
      }
      buildTypes {
          debug {
              versionNameSuffix '-debug'
         }
          snapshot {
              versionNameSuffix '-SNAPSHOT-' + getCommitHash()
          }
      }
      libraryVariants.all { variant -&gt;
          variant.outputs.all {
              def versionName = variant.variantData.variantConfiguration.versionName
              outputFileName = "${libraryArtifactId}-" + versionName + ".aar"
          }
      }
  }
  </code></pre>
  
  <p></p>
  
  <p>Furthermore I have an artifactory publishing task:</p>
  
  <pre><code>publishing {
      publications {
          aar(MavenPublication) {
              groupId libraryGroupId
              version libraryVersion
              artifactId libraryArtifactId
  
              def artifactUrl = "$buildDir/outputs/aar/&lt;??outputFileName??&gt;"
              println "#### artifactUrl: " + artifactUrl
              artifact(artifactUrl)
  
              pom.withXml {
                  ...
              }
          }
      }
  }
  </code></pre>
  
  <p>Right now the "outputFileName" is always set to the last defined build type since variant.outputs.all is overriding it for each build type. So my question is: </p>
  
  <p><strong>How do I get the <code>outputFileName</code> of my current build within the <code>artifactory</code> publication closure?</strong> </p>
  
  <p>Any other way is welcome. It doesn't have to be via a self-defined variable. But the artifactoryUrl should match with the generated <code>/outputs/aar/&lt;snapshot-filename&gt;.aar</code>.</p>