Uploading a Tar

Hi,

For purposes of helping our our System Admins, I’m attempting to upload the distribution we build (a tgz) to our repository. I’m wondering how I might configure a suitable task to do this? I’ve attempted to use “artifacts” but that seemed to be unsuccessful:

task distribution(type: Tar, dependsOn: preDistribution) {
    ext {
        gitVersion = "git rev-parse --verify --short HEAD".execute().text.trim()
    }
       baseName = 'fubar-' + new Date().format('yyyyMMdd') + '-' + gitVersion
    description = "Builds the final distribution archive '${baseName}-${version}.tgz' that is suitable for systems deployment."
    destinationDir = new File("${project.buildDir}/dist")
    compression = Compression.GZIP
    from "${project.buildDir}/dist/tmp"
    doLast {
        delete "${project.buildDir}/dist/tmp"
    }
   }

I don’t think Tar (task) has the concept of destFile, otherwise doing this might have worked:

artifacts {
    archives distribution.destFile
}

Similarly using “distribution.archiveName” didn’t appear to work.

Please may I have some assistance on this? Thank you.

Did you check the Gradle Build Language Reference? It should tell you that ‘Tar’ has an ‘archivePath’ property.

PS: The way your build script is written, the ‘git rev-parse’ command will be executed for each and every build, no matter which task is invoked (configuration phase vs. execution phase).

Hi Peter,

w00t - will definitely look at that. Thank you kindly for your help :slight_smile: Oh, I wrote that block when I was learning about Gradle (was still confused about configuration and execution). I will make it better :slight_smile:

-=david=-