What is the best practice in Gradle 2.1 for handling native artifacts and dependencies?

Looking forward to better support for native artifact publishing.

Below is a Hello World c++ example that I put together that compiles a hello world application, puts together a .tgz distribution and publishes it to an Artifactory snapshot repository. It pulls together some of the pieces I have been trying to figure out. Hopefully it will help some other people trying to publish native artifacts to Artifactory.

I’d also be VERY interested in ways to do this more easily or in a more Gradle-like way. I’m still wrapping my head around this stuff. Thx.

apply plugin: 'cpp'
apply plugin: 'maven-publish' //required by artifactory-publish
apply plugin: 'distribution'
  // automatically get the artifactory-publish plugin and it's dependencies
buildscript {
  repositories {
    maven { url 'http://repo.jfrog.org/artifactory/gradle-plugins-snapshots' }
  }
  dependencies {
    classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.1.x-SNAPSHOT')
  }
  configurations.classpath {
    resolutionStrategy {
      failOnVersionConflict()
      cacheDynamicVersionsFor 0, 'seconds'
      cacheChangingModulesFor 0, 'seconds'
    }
  }
}
  apply plugin: 'artifactory-publish'
  //set the default values for the artifactory repository
group = 'org.hw'
version = '0.1-SNAPSHOT'
def artifactId = projectDir.name
def versionNumber = version
    executables {
  hello{}
}
  // define sources
sources {
  hello {
    cpp {
      source {
        srcDir "."
        include "hw.cpp" //hello world c++ source
      }
    }
  }
}
  // create a distribution tarball and add the "hello" binary
// the distribution plugin requires a src/main/dist directory
distributions {
    main {
        baseName = 'gradlehw'
        contents {
          from {'build/binaries/helloExecutable'}
        }
    }
}
  // make sure the distribution tarball is compressed and
 // define a dependency on the helloExecutable task
distTar{
  compression = Compression.GZIP
  dependsOn('helloExecutable')
}
  // configure the artifactory repository.
Username/password values should be moved to gradle.properties
// file and hashed.
artifactory {
    contextUrl = 'http://morph2:8888/artifactory' // base artifactory url
  publish {
    contextUrl = 'http://morph2:8888/artifactory' // base artifactory url
    repository {
      repoKey = 'libs-snapshot-local'
 //The Artifactory repository key to publish to
      username = 'build'
    //The publisher user name
      password = 'Password!'
     //The publisher password
      maven = true
    }
  }
}
  // define the publication and add any files in the
distribution directory
publishing {
    publications {
        mavenStuff(MavenPublication) {
            File distDir
            distDir = file('build/distributions')
            FileCollection collection
            collection = files { distDir.listFiles() }
            collection.each {File thisFile ->
              artifact(file(thisFile))
            }
        }
    }
}
  // configure the artifactoryPublish task
artifactoryPublish {
  publications ('mavenStuff')
  dependsOn('distTar')